From 3206110cf4da231716a33d9960ff252784a4b34b Mon Sep 17 00:00:00 2001 From: Shish Date: Wed, 18 Mar 2020 20:26:52 +0000 Subject: [PATCH] InitExt / DatabaseUpgrade as part of the try/catch --- index.php | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/index.php b/index.php index ecaf6c0e..cd04ca5b 100644 --- a/index.php +++ b/index.php @@ -118,22 +118,22 @@ $_tracer->end(); * Send events, display output * \* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -//$_tracer->mark(@$_SERVER["REQUEST_URI"]); -$_tracer->begin( - $_SERVER["REQUEST_URI"] ?? "No Request", - [ - "user"=>$_COOKIE["shm_user"] ?? "No User", - "ip"=>$_SERVER['REMOTE_ADDR'] ?? "No IP", - "user_agent"=>$_SERVER['HTTP_USER_AGENT'] ?? "No UA", - ] -); - -if (!SPEED_HAX) { - send_event(new DatabaseUpgradeEvent()); -} -send_event(new InitExtEvent()); - try { + // $_tracer->mark(@$_SERVER["REQUEST_URI"]); + $_tracer->begin( + $_SERVER["REQUEST_URI"] ?? "No Request", + [ + "user"=>$_COOKIE["shm_user"] ?? "No User", + "ip"=>$_SERVER['REMOTE_ADDR'] ?? "No IP", + "user_agent"=>$_SERVER['HTTP_USER_AGENT'] ?? "No UA", + ] + ); + + if (!SPEED_HAX) { + send_event(new DatabaseUpgradeEvent()); + } + send_event(new InitExtEvent()); + // start the page generation waterfall $user = _get_user(); send_event(new UserLoginEvent($user)); @@ -157,17 +157,17 @@ try { $database->rollback(); } _fatal_error($e); -} - -$_tracer->end(); -if (TRACE_FILE) { - if ( - empty($_SERVER["REQUEST_URI"]) - || ( - (microtime(true) - $_shm_load_start) > TRACE_THRESHOLD - && ($_SERVER["REQUEST_URI"] ?? "") != "/upload" - ) - ) { - $_tracer->flush(TRACE_FILE); +} finally { + $_tracer->end(); + if (TRACE_FILE) { + if ( + empty($_SERVER["REQUEST_URI"]) + || ( + (microtime(true) - $_shm_load_start) > TRACE_THRESHOLD + && ($_SERVER["REQUEST_URI"] ?? "") != "/upload" + ) + ) { + $_tracer->flush(TRACE_FILE); + } } }