option to log slow pages
This commit is contained in:
parent
6175b36cc9
commit
f4c18930ce
@ -41,6 +41,7 @@ _d("CORE_EXTS", "bbcode,user,mail,upload,image,view,handle_pixel,ext_manager,set
|
|||||||
_d("EXTRA_EXTS", ""); // string optional extra extensions
|
_d("EXTRA_EXTS", ""); // string optional extra extensions
|
||||||
_d("BASE_URL", null); // string force a specific base URL (default is auto-detect)
|
_d("BASE_URL", null); // string force a specific base URL (default is auto-detect)
|
||||||
_d("MIN_PHP_VERSION", '7.0');// string minimum supported PHP version
|
_d("MIN_PHP_VERSION", '7.0');// string minimum supported PHP version
|
||||||
|
_d("SLOW_PAGES", null); // float log pages which take more time than this
|
||||||
_d("ENABLED_MODS", "imageboard");
|
_d("ENABLED_MODS", "imageboard");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -350,6 +350,18 @@ function get_debug_info(): string {
|
|||||||
return $debug;
|
return $debug;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function log_slow() {
|
||||||
|
global $_shm_load_start;
|
||||||
|
if(!is_null(SLOW_PAGES)) {
|
||||||
|
$_time = microtime(true) - $_shm_load_start;
|
||||||
|
if($_time > SLOW_PAGES) {
|
||||||
|
$_query = _get_query();
|
||||||
|
$_dbg = get_debug_info();
|
||||||
|
file_put_contents("data/slow-pages.log", "$_time $_query $_dbg\n", FILE_APPEND | LOCK_EX);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function score_assert_handler($file, $line, $code, $desc = null) {
|
function score_assert_handler($file, $line, $code, $desc = null) {
|
||||||
$file = basename($file);
|
$file = basename($file);
|
||||||
print("Assertion failed at $file:$line: $code ($desc)");
|
print("Assertion failed at $file:$line: $code ($desc)");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user