From 47036c445a2e121ee16a5a25cd8a0f5dde183a91 Mon Sep 17 00:00:00 2001 From: Robert Leverington Date: Sun, 8 Feb 2009 23:39:17 +0000 Subject: [PATCH] * (bug 17408) Add $wgShowDebug configuration variable, displays debug data at the bottom of the main content area when enabled. --- includes/DefaultSettings.php | 7 +++++++ includes/Skin.php | 17 ++++++++++++++++- includes/SkinTemplate.php | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 2102b2adf2..949fd819bd 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1038,6 +1038,13 @@ $wgDebugDumpSql = false; */ $wgDebugLogGroups = array(); +/** + * Display debug data at the bottom of the main content area. + * + * Useful for developers and technical users trying to working on a closed wiki. + */ +$wgShowDebug = false; + /** * Show the contents of $wgHooks in Special:Version */ diff --git a/includes/Skin.php b/includes/Skin.php index 66b2197d80..e326ed806a 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -889,13 +889,28 @@ END; return $data; } + /** + * Generate debug data HTML for displaying at the bottom of the main content + * area. + * @return String HTML containing debug data, if enabled (otherwise empty). + */ + protected function generateDebugHTML() { + global $wgShowDebug, $wgOut; + if ( $wgShowDebug ) { + $listInternals = str_replace( "\n", "\n
  • ", htmlspecialchars( $wgOut->mDebugtext ) ); + return "\n
    \nDebug data:\n"; + } + return ''; + } + /** * This gets called shortly before the tag. * @return String HTML to be put before */ function afterContent() { $printfooter = "
    \n" . $this->printFooter() . "
    \n"; - return $printfooter . $this->doAfterContent(); + return $this->generateDebugHTML() . $printfooter . $this->doAfterContent(); } /** diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index 59596718e8..60b3eaa4a0 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -401,7 +401,7 @@ class SkinTemplate extends Skin { $tpl->set( 'bottomscripts', $this->bottomScripts() ); $printfooter = "
    \n" . $this->printSource() . "
    \n"; - $out->mBodytext .= $printfooter ; + $out->mBodytext .= $printfooter . $this->generateDebugHTML(); $tpl->setRef( 'bodytext', $out->mBodytext ); # Language links -- 2.20.1