* (bug 17408) Add $wgShowDebug configuration variable, displays debug data at the...
authorRobert Leverington <roberthl@users.mediawiki.org>
Sun, 8 Feb 2009 23:39:17 +0000 (23:39 +0000)
committerRobert Leverington <roberthl@users.mediawiki.org>
Sun, 8 Feb 2009 23:39:17 +0000 (23:39 +0000)
includes/DefaultSettings.php
includes/Skin.php
includes/SkinTemplate.php

index 2102b2a..949fd81 100644 (file)
@@ -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
  */
index 66b2197..e326ed8 100644 (file)
@@ -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", "</li>\n<li>", htmlspecialchars( $wgOut->mDebugtext ) );
+                       return "\n<hr>\n<strong>Debug data:</strong><ul style=\"font-family:monospace;\"><li>" .
+                               $listInternals . "</li></ul>\n";
+               }
+               return '';
+       }
+
        /**
         * This gets called shortly before the </body> tag.
         * @return String HTML to be put before </body>
         */
        function afterContent() {
                $printfooter = "<div class=\"printfooter\">\n" . $this->printFooter() . "</div>\n";
-               return $printfooter . $this->doAfterContent();
+               return $this->generateDebugHTML() . $printfooter . $this->doAfterContent();
        }
 
        /**
index 5959671..60b3eaa 100644 (file)
@@ -401,7 +401,7 @@ class SkinTemplate extends Skin {
                $tpl->set( 'bottomscripts', $this->bottomScripts() );
 
                $printfooter = "<div class=\"printfooter\">\n" . $this->printSource() . "</div>\n";
-               $out->mBodytext .= $printfooter ;
+               $out->mBodytext .= $printfooter . $this->generateDebugHTML();
                $tpl->setRef( 'bodytext', $out->mBodytext );
 
                # Language links