Skip to content
Permalink
Browse files

Don't allow show_timer and show_memory_usage to be set in database

Harmonize options with treatment of show_queries_count

Fixes #25446
  • Loading branch information
atrol committed Feb 17, 2019
1 parent 9be5a95 commit 3965532be247727a81e8137623f20c19641a4a04
Showing with 11 additions and 7 deletions.
  1. +1 −1 config_defaults_inc.php
  2. +10 −6 core/layout_api.php
@@ -4342,7 +4342,7 @@
'hostname','html_valid_tags', 'html_valid_tags_single_line', 'default_language',
'language_auto_map', 'fallback_language', 'login_method', 'plugins_enabled',
'session_save_path', 'session_validation', 'show_detailed_errors', 'show_queries_count',
'stop_on_errors', 'version_suffix', 'debug_email',
'show_timer', 'show_memory_usage', 'stop_on_errors', 'version_suffix', 'debug_email',
'fileinfo_magic_db_file', 'css_include_file', 'css_rtl_include_file',
'file_type_icons', 'path', 'short_path', 'absolute_path', 'core_path',
'class_path','library_path', 'language_path', 'absolute_path_default_upload_folder',
@@ -1168,26 +1168,30 @@ function layout_footer() {

event_signal( 'EVENT_LAYOUT_PAGE_FOOTER' );

if( config_get( 'show_timer' ) || config_get( 'show_memory_usage' ) || config_get_global( 'show_queries_count' ) ) {
$t_show_timer = config_get_global( 'show_timer' );
$t_show_memory_usage = config_get_global( 'show_memory_usage' );
$t_show_queries_count = config_get_global( 'show_queries_count' );
$t_display_debug_info = $t_show_timer || $t_show_memory_usage || $t_show_queries_count;

if( $t_display_debug_info ) {
echo '<div class="col-xs-12 no-padding grey">' . "\n";
echo '<address class="no-margin pull-right">' . "\n";
}


# Print the page execution time
if( config_get( 'show_timer' ) ) {
if( $t_show_timer ) {
$t_page_execution_time = sprintf( lang_get( 'page_execution_time' ), number_format( microtime( true ) - $g_request_time, 4 ) );
echo '<small><i class="fa fa-clock-o"></i> ' . $t_page_execution_time . '</small>&#160;&#160;&#160;&#160;' . "\n";
}

# Print the page memory usage
if( config_get( 'show_memory_usage' ) ) {
if( $t_show_memory_usage ) {
$t_page_memory_usage = sprintf( lang_get( 'memory_usage_in_kb' ), number_format( memory_get_peak_usage() / 1024 ) );
echo '<small><i class="fa fa-bolt"></i> ' . $t_page_memory_usage . '</small>&#160;&#160;&#160;&#160;' . "\n";
}

# Determine number of unique queries executed
if( config_get_global( 'show_queries_count' ) ) {
if( $t_show_queries_count ) {
$t_total_queries_count = count( $g_queries_array );
$t_unique_queries_count = 0;
$t_total_query_execution_time = 0;
@@ -1213,7 +1217,7 @@ function layout_footer() {
echo '<small><i class="fa fa-clock-o"></i> ' . $t_total_query_time . '</small>&#160;&#160;&#160;&#160;' . "\n";
}

if( config_get( 'show_timer' ) || config_get( 'show_memory_usage' ) || config_get_global( 'show_queries_count' ) ) {
if( $t_display_debug_info ) {
echo '</address>' . "\n";
echo '</div>' . "\n";
}

0 comments on commit 3965532

Please sign in to comment.
You can’t perform that action at this time.