diff options
| author | Jakub Senko <jakubsenko@gmail.com> | 2018-08-01 15:05:10 +0200 |
|---|---|---|
| committer | Marc Alexander <admin@m-a-styles.de> | 2019-05-09 19:02:14 +0200 |
| commit | 4f402465bf41c88876a499cacfc6bdc1762dfe44 (patch) | |
| tree | 435752e7e8eb25e6afef14d7c88ea098556c1c27 /phpBB/includes | |
| parent | 917880e2bf3a43c6b20bda0f9295f4fb4e6ed127 (diff) | |
| download | forums-4f402465bf41c88876a499cacfc6bdc1762dfe44.tar forums-4f402465bf41c88876a499cacfc6bdc1762dfe44.tar.gz forums-4f402465bf41c88876a499cacfc6bdc1762dfe44.tar.bz2 forums-4f402465bf41c88876a499cacfc6bdc1762dfe44.tar.xz forums-4f402465bf41c88876a499cacfc6bdc1762dfe44.zip | |
[ticket/12628] Introduce debug.memory
Also fix one debug.sql_explain missing from the previous PR
PHPBB3-12628
Diffstat (limited to 'phpBB/includes')
| -rw-r--r-- | phpBB/includes/functions.php | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 95e3ae8cb1..b30f500a4e 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4629,7 +4629,9 @@ function page_header($page_title = '', $display_online_list = false, $item_id = */ function phpbb_check_and_display_sql_report(\phpbb\request\request_interface $request, \phpbb\auth\auth $auth, \phpbb\db\driver\driver_interface $db) { - if ($request->variable('explain', false) && $auth->acl_get('a_') && defined('DEBUG')) + global $phpbb_container; + + if ($phpbb_container->getParameter('debug.sql_explain') && $request->variable('explain', false) && $auth->acl_get('a_')) { $db->sql_report('display'); } @@ -4659,9 +4661,10 @@ function phpbb_generate_debug_output(\phpbb\db\driver\driver_interface $db, \php $totaltime = microtime(true) - $GLOBALS['starttime']; $debug_info[] = sprintf('<span title="SQL time: %.3fs / PHP time: %.3fs">Time: %.3fs</span>', $db->get_sql_time(), ($totaltime - $db->get_sql_time()), $totaltime); } + } - $debug_info[] = sprintf('<span title="Cached: %d">Queries: %d</span>', $db->sql_num_queries(true), $db->sql_num_queries()); - + if ($phpbb_container->getParameter('debug.memory')) + { $memory_usage = memory_get_peak_usage(); if ($memory_usage) { @@ -4669,18 +4672,20 @@ function phpbb_generate_debug_output(\phpbb\db\driver\driver_interface $db, \php $debug_info[] = 'Peak Memory Usage: ' . $memory_usage; } - } - if (defined('DEBUG')) - { $debug_info[] = 'GZIP: ' . (($config['gzip_compress'] && @extension_loaded('zlib')) ? 'On' : 'Off'); if ($user->load) { $debug_info[] = 'Load: ' . $user->load; } + } + + if ($phpbb_container->getParameter('debug.sql_explain')) + { + $debug_info[] = sprintf('<span title="Cached: %d">Queries: %d</span>', $db->sql_num_queries(true), $db->sql_num_queries()); - if ($auth->acl_get('a_') && $phpbb_container->getParameter('debug.sql_explain')) + if ($auth->acl_get('a_')) { $debug_info[] = '<a href="' . build_url() . '&explain=1">SQL Explain</a>'; } |
