From 977b23afe3e0dce8fc46daa3f00245c51ec8c23d Mon Sep 17 00:00:00 2001 From: towards-a-new-leftypol Date: Tue, 31 Dec 2024 07:08:14 -0500 Subject: [PATCH] Add more time cost centers in handle_post to $debug['post'] --- post.php | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/post.php b/post.php index 4dfc4d3d..e4de8214 100644 --- a/post.php +++ b/post.php @@ -597,6 +597,10 @@ function handle_post(){ else { $mod = $post['mod'] = false; } + + $time_rolling2 = microtime(true); + $debug['time']['post']['pre_noticer1'] = round(($time_rolling1 - $time_1) * 1000, 2) . 'ms'; + $time_rolling1 = $time_rolling2; //Check if thread exists if (!$post['op']) { @@ -613,6 +617,9 @@ function handle_post(){ $thread = false; } + $time_rolling2 = microtime(true); + $debug['time']['post']['pre_noticer2'] = round(($time_rolling2 - $time_rolling1) * 1000, 2) . 'ms'; + $time_rolling1 = $time_rolling2; // Check for an embed field if ($config['enable_embedding'] && isset($_POST['embed']) && !empty($_POST['embed'])) { @@ -713,6 +720,10 @@ function handle_post(){ } + $time_rolling2 = microtime(true); + $debug['time']['post']['pre_noticer3'] = round(($time_rolling2 - $time_rolling1) * 1000, 2) . 'ms'; + $time_rolling1 = $time_rolling2; + $post['name'] = $_POST['name'] != '' ? $_POST['name'] : $config['anonymous']; $post['subject'] = $_POST['subject']; $post['email'] = str_replace(' ', '%20', htmlspecialchars($_POST['email'])); @@ -756,6 +767,10 @@ function handle_post(){ } } + $time_rolling2 = microtime(true); + $debug['time']['post']['pre_noticer4'] = round(($time_rolling2 - $time_rolling1) * 1000, 2) . 'ms'; + $time_rolling1 = $time_rolling2; + if ($post['has_file']) { // Determine size sanity $size = 0; @@ -791,6 +806,10 @@ function handle_post(){ $post['filesize'] = $size; } + $time_rolling2 = microtime(true); + $debug['time']['post']['pre_noticer5'] = round(($time_rolling2 - $time_rolling1) * 1000, 2) . 'ms'; + $time_rolling1 = $time_rolling2; + $post['capcode'] = false; if ($mod && preg_match('/^((.+) )?## (.+)$/', $post['name'], $matches)) { @@ -874,6 +893,10 @@ function handle_post(){ } } + $time_rolling2 = microtime(true); + $debug['time']['post']['pre_noticer6'] = round(($time_rolling2 - $time_rolling1) * 1000, 2) . 'ms'; + $time_rolling1 = $time_rolling2; + if ($config['strip_combining_chars']) { $post['name'] = strip_combining_chars($post['name']); $post['email'] = strip_combining_chars($post['email']); @@ -1033,8 +1056,12 @@ function handle_post(){ validate_images($post); + $time_rolling2 = microtime(true); + $debug['time']['post']['pre_noticer7'] = round(($time_rolling2 - $time_rolling1) * 1000, 2) . 'ms'; + $time_rolling1 = $time_rolling2; + $time_2 = microtime(true); - $debug['time']['post']['pre_noticer'] = round(($time_2 - $time_1) * 1000, 2) . 'ms'; + $debug['time']['post']['pre_noticer_total'] = round(($time_2 - $time_1) * 1000, 2) . 'ms'; if ($config['spam_noticer']['enabled']) { require_once 'inc/spamnoticer.php';