Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -308,7 +308,7 @@ |
309 | 309 | */ |
310 | 310 | function wfDebug( $text, $logonly = false ) { |
311 | 311 | global $wgOut, $wgDebugLogFile, $wgDebugComments, $wgProfileOnly, $wgDebugRawPage; |
312 | | - global $wgDebugLogPrefix; |
| 312 | + global $wgDebugLogPrefix, $wgShowDebug; |
313 | 313 | static $recursion = 0; |
314 | 314 | |
315 | 315 | static $cache = array(); // Cache of unoutputted messages |
— | — | @@ -318,7 +318,7 @@ |
319 | 319 | return; |
320 | 320 | } |
321 | 321 | |
322 | | - if ( $wgDebugComments && !$logonly ) { |
| 322 | + if ( ( $wgDebugComments || $wgShowDebug ) && !$logonly ) { |
323 | 323 | $cache[] = $text; |
324 | 324 | |
325 | 325 | if ( !isset( $wgOut ) ) { |
Index: trunk/phase3/includes/HTMLFileCache.php |
— | — | @@ -55,7 +55,7 @@ |
56 | 56 | if( $this->useGzip() ) |
57 | 57 | $this->mFileCache .= '.gz'; |
58 | 58 | |
59 | | - wfDebug( " fileCacheName() - {$this->mFileCache}\n" ); |
| 59 | + wfDebug( __METHOD__ . ": {$this->mFileCache}\n" ); |
60 | 60 | } |
61 | 61 | return $this->mFileCache; |
62 | 62 | } |
— | — | @@ -111,7 +111,7 @@ |
112 | 112 | $cachetime = $this->fileCacheTime(); |
113 | 113 | $good = $timestamp <= $cachetime && $wgCacheEpoch <= $cachetime; |
114 | 114 | |
115 | | - wfDebug(" isFileCacheGood() - cachetime $cachetime, touched '{$timestamp}' epoch {$wgCacheEpoch}, good $good\n"); |
| 115 | + wfDebug( __METHOD__ . ": cachetime $cachetime, touched '{$timestamp}' epoch {$wgCacheEpoch}, good $good\n"); |
116 | 116 | return $good; |
117 | 117 | } |
118 | 118 | |
— | — | @@ -137,7 +137,7 @@ |
138 | 138 | /* Working directory to/from output */ |
139 | 139 | public function loadFromFileCache() { |
140 | 140 | global $wgOut, $wgMimeType, $wgOutputEncoding, $wgContLanguageCode; |
141 | | - wfDebug(" loadFromFileCache()\n"); |
| 141 | + wfDebug( __METHOD__ . "()\n"); |
142 | 142 | $filename = $this->fileCacheName(); |
143 | 143 | // Raw pages should handle cache control on their own, |
144 | 144 | // even when using file cache. This reduces hits from clients. |
— | — | @@ -176,7 +176,7 @@ |
177 | 177 | return $text; |
178 | 178 | } |
179 | 179 | |
180 | | - wfDebug(" saveToFileCache()\n", false); |
| 180 | + wfDebug( __METHOD__ . "()\n", false); |
181 | 181 | |
182 | 182 | $this->checkCacheDirs(); |
183 | 183 | |
Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -141,7 +141,7 @@ |
142 | 142 | global $wgDisableCounters, $wgLogo, $wgHideInterlanguageLinks; |
143 | 143 | global $wgMaxCredits, $wgShowCreditsIfMax; |
144 | 144 | global $wgPageShowWatchingUsers; |
145 | | - global $wgUseTrackbacks, $wgUseSiteJs; |
| 145 | + global $wgUseTrackbacks, $wgUseSiteJs, $wgDebugComments; |
146 | 146 | global $wgArticlePath, $wgScriptPath, $wgServer, $wgCanonicalNamespaceNames; |
147 | 147 | |
148 | 148 | wfProfileIn( __METHOD__ ); |
— | — | @@ -419,7 +419,12 @@ |
420 | 420 | $tpl->set( 'privacy', $this->privacyLink() ); |
421 | 421 | $tpl->set( 'about', $this->aboutLink() ); |
422 | 422 | |
423 | | - $tpl->setRef( 'debug', $out->mDebugtext ); |
| 423 | + if ( $wgDebugComments ) { |
| 424 | + $tpl->setRef( 'debug', $out->mDebugtext ); |
| 425 | + } else { |
| 426 | + $tpl->set( 'debug', '' ); |
| 427 | + } |
| 428 | + |
424 | 429 | $tpl->set( 'reporttime', wfReportTime() ); |
425 | 430 | $tpl->set( 'sitenotice', wfGetSiteNotice() ); |
426 | 431 | $tpl->set( 'bottomscripts', $this->bottomScripts() ); |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -959,13 +959,48 @@ |
960 | 960 | protected function generateDebugHTML() { |
961 | 961 | global $wgShowDebug, $wgOut; |
962 | 962 | if ( $wgShowDebug ) { |
963 | | - $listInternals = str_replace( "\n", "</li>\n<li>", htmlspecialchars( $wgOut->mDebugtext ) ); |
964 | | - return "\n<hr>\n<strong>Debug data:</strong><ul style=\"font-family:monospace;\"><li>" . |
965 | | - $listInternals . "</li></ul>\n"; |
| 963 | + $listInternals = $this->formatDebugHTML( $wgOut->mDebugtext ); |
| 964 | + return "\n<hr />\n<strong>Debug data:</strong><ul style=\"font-family:monospace;\" id=\"mw-debug-html\">" . |
| 965 | + $listInternals . "</ul>\n"; |
966 | 966 | } |
967 | 967 | return ''; |
968 | 968 | } |
969 | 969 | |
| 970 | + private function formatDebugHTML( $debugText ) { |
| 971 | + $lines = explode( "\n", $debugText ); |
| 972 | + $curIdent = 0; |
| 973 | + $ret = '<li>'; |
| 974 | + foreach( $lines as $line ) { |
| 975 | + $m = array(); |
| 976 | + $display = ltrim( $line ); |
| 977 | + $ident = strlen( $line ) - strlen( $display ); |
| 978 | + $diff = $ident - $curIdent; |
| 979 | + |
| 980 | + if ( $display == '' ) |
| 981 | + $display = "\xc2\xa0"; |
| 982 | + |
| 983 | + if ( !$ident && $diff < 0 && substr( $display, 0, 9 ) != 'Entering ' && substr( $display, 0, 8 ) != 'Exiting ' ) { |
| 984 | + $ident = $curIdent; |
| 985 | + $diff = 0; |
| 986 | + $display = '<span style="background:yellow;">' . htmlspecialchars( $display ) . '</span>'; |
| 987 | + } else { |
| 988 | + $display = htmlspecialchars( $display ); |
| 989 | + } |
| 990 | + |
| 991 | + if ( $diff < 0 ) |
| 992 | + $ret .= str_repeat( "</li></ul>\n", -$diff ) . "<li>\n"; |
| 993 | + elseif ( $diff == 0 ) |
| 994 | + $ret .= "</li><li>\n"; |
| 995 | + else |
| 996 | + $ret .= str_repeat( "<ul><li>\n", $diff ); |
| 997 | + $ret .= $display . "\n"; |
| 998 | + |
| 999 | + $curIdent = $ident; |
| 1000 | + } |
| 1001 | + $ret .= str_repeat( '</li></ul>', $curIdent ) . '</li>'; |
| 1002 | + return $ret; |
| 1003 | + } |
| 1004 | + |
970 | 1005 | /** |
971 | 1006 | * This gets called shortly before the </body> tag. |
972 | 1007 | * @return String HTML to be put before </body> |