Add more time cost centers in handle_post to $debug['post']

This commit is contained in:
towards-a-new-leftypol 2024-12-31 07:08:14 -05:00
parent 7cfe5cc0e3
commit 977b23afe3
1 changed files with 28 additions and 1 deletions

View File

@ -598,6 +598,10 @@ function handle_post(){
$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']) {
$query = prepare(sprintf("SELECT `sticky`,`locked`,`cycle`,`sage`,`slug` FROM ``posts_%s`` WHERE `id` = :id AND `thread` IS NULL LIMIT 1", $board['uri']));
@ -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';