r47023 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47022‎ | r47023 | r47024 >
Date:23:39, 8 February 2009
Author:minuteelectron
Status:deferred (Comments)
Tags:
Comment:
* (bug 17408) Add $wgShowDebug configuration variable, displays debug data at the bottom of the main content area when enabled.
Modified paths:
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)
  • /trunk/phase3/includes/SkinTemplate.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SkinTemplate.php
@@ -401,7 +401,7 @@
402402 $tpl->set( 'bottomscripts', $this->bottomScripts() );
403403
404404 $printfooter = "<div class=\"printfooter\">\n" . $this->printSource() . "</div>\n";
405 - $out->mBodytext .= $printfooter ;
 405+ $out->mBodytext .= $printfooter . $this->generateDebugHTML();
406406 $tpl->setRef( 'bodytext', $out->mBodytext );
407407
408408 # Language links
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1039,6 +1039,13 @@
10401040 $wgDebugLogGroups = array();
10411041
10421042 /**
 1043+ * Display debug data at the bottom of the main content area.
 1044+ *
 1045+ * Useful for developers and technical users trying to working on a closed wiki.
 1046+ */
 1047+$wgShowDebug = false;
 1048+
 1049+/**
10431050 * Show the contents of $wgHooks in Special:Version
10441051 */
10451052 $wgSpecialVersionShowHooks = false;
Index: trunk/phase3/includes/Skin.php
@@ -890,12 +890,27 @@
891891 }
892892
893893 /**
 894+ * Generate debug data HTML for displaying at the bottom of the main content
 895+ * area.
 896+ * @return String HTML containing debug data, if enabled (otherwise empty).
 897+ */
 898+ protected function generateDebugHTML() {
 899+ global $wgShowDebug, $wgOut;
 900+ if ( $wgShowDebug ) {
 901+ $listInternals = str_replace( "\n", "</li>\n<li>", htmlspecialchars( $wgOut->mDebugtext ) );
 902+ return "\n<hr>\n<strong>Debug data:</strong><ul style=\"font-family:monospace;\"><li>" .
 903+ $listInternals . "</li></ul>\n";
 904+ }
 905+ return '';
 906+ }
 907+
 908+ /**
894909 * This gets called shortly before the </body> tag.
895910 * @return String HTML to be put before </body>
896911 */
897912 function afterContent() {
898913 $printfooter = "<div class=\"printfooter\">\n" . $this->printFooter() . "</div>\n";
899 - return $printfooter . $this->doAfterContent();
 914+ return $this->generateDebugHTML() . $printfooter . $this->doAfterContent();
900915 }
901916
902917 /**

Comments

#Comment by MinuteElectron (talk | contribs)   23:49, 8 February 2009

Minor adjustment in r47024, ordering unified between both Skin.php and SkinTemplate.php.

Status & tagging log