From 0de3082ca442765b24c93f61688c7ef9d08bacde Mon Sep 17 00:00:00 2001 From: John Du Hart Date: Sun, 4 Dec 2011 18:29:57 +0000 Subject: [PATCH] Adding new debugging toolbar Needs a UI cleanup still, but for the most part is working. --- RELEASE-NOTES-1.19 | 1 + includes/Article.php | 4 +- includes/AutoLoader.php | 3 + includes/DefaultSettings.php | 8 + includes/GlobalFunctions.php | 2 + includes/Setup.php | 3 + includes/Skin.php | 6 +- includes/db/Database.php | 4 + resources/Resources.php | 4 + resources/mediawiki/mediawiki.debug.css | 111 +++++++++++++ resources/mediawiki/mediawiki.debug.js | 208 ++++++++++++++++++++++++ 11 files changed, 350 insertions(+), 4 deletions(-) create mode 100644 resources/mediawiki/mediawiki.debug.css create mode 100644 resources/mediawiki/mediawiki.debug.js diff --git a/RELEASE-NOTES-1.19 b/RELEASE-NOTES-1.19 index 3f79787c32..cf24f339ef 100644 --- a/RELEASE-NOTES-1.19 +++ b/RELEASE-NOTES-1.19 @@ -97,6 +97,7 @@ production. * (bug 32666) Special:ActiveUsers now allows a subpage to be used as the username (eg. Special:ActiveUsers/Username) * New JavaScript variable wgPageContentLanguage +* Added new debugging toolbar, enabled with $wgDebugToolbar === Bug fixes in 1.19 === * $wgUploadNavigationUrl should be used for file redlinks if. diff --git a/includes/Article.php b/includes/Article.php index 5633e2aaf2..edd9369444 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -374,7 +374,7 @@ class Article extends Page { */ public function view() { global $wgUser, $wgOut, $wgRequest, $wgParser; - global $wgUseFileCache, $wgUseETag; + global $wgUseFileCache, $wgUseETag, $wgDebugToolbar; wfProfileIn( __METHOD__ ); @@ -429,7 +429,7 @@ class Article extends Page { } # Try client and file cache - if ( $oldid === 0 && $this->mPage->checkTouched() ) { + if ( !$wgDebugToolbar && $oldid === 0 && $this->mPage->checkTouched() ) { if ( $wgUseETag ) { $wgOut->setETag( $parserCache->getETag( $this, $parserOptions ) ); } diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 908c8fdd35..f53d9a177c 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -436,6 +436,9 @@ $wgAutoloadLocalClasses = array( 'ResultWrapper' => 'includes/db/DatabaseUtility.php', 'SQLiteField' => 'includes/db/DatabaseSqlite.php', + # includes/debug + 'MWDebug' => 'includes/debug/Debug.php', + # includes/diff '_DiffEngine' => 'includes/diff/DairikiDiff.php', '_DiffOp' => 'includes/diff/DairikiDiff.php', diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 83e1e56093..b62597f15f 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -4160,6 +4160,14 @@ $wgParserTestRemote = false; */ $wgWikiID = false; +/** + * Display the new debugging toolbar. This also enables profiling on database + * queries and other useful output. + * + * @since 1.19 + */ +$wgDebugToolbar = false; + /** @} */ # end of profiling, testing and debugging } /************************************************************************//** diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 26157d69a1..3167b37b07 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -835,6 +835,8 @@ function wfDebug( $text, $logonly = false ) { wfErrorLog( $text, $wgDebugLogFile ); } } + + MWDebug::debugMsg( $text ); } /** diff --git a/includes/Setup.php b/includes/Setup.php index afde02fa80..5c08261abf 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -328,6 +328,8 @@ if ( $wgCookieSecure === 'detect' ) { $wgCookieSecure = ( substr( $wgServer, 0, 6 ) === 'https:' ); } +MWDebug::init(); + if ( !defined( 'MW_COMPILED' ) ) { if ( !MWInit::classExists( 'AutoLoader' ) ) { require_once( "$IP/includes/AutoLoader.php" ); @@ -392,6 +394,7 @@ if ( $wgCommandLineMode ) { } } wfDebug( "$debug\n" ); + MWDebug::processRequest( $wgRequest ); } wfProfileOut( $fname . '-misc1' ); diff --git a/includes/Skin.php b/includes/Skin.php index d69408f7cf..f3a37f9ae8 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -531,13 +531,15 @@ abstract class Skin extends ContextSource { protected function generateDebugHTML() { global $wgShowDebug; + $html = MWDebug::getDebugHTML(); + if ( $wgShowDebug ) { $listInternals = $this->formatDebugHTML( $this->getOutput()->mDebugtext ); - return "\n
\nDebug data: