Various getHTMLDebugLog() cleanups
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 1 Oct 2015 05:47:09 +0000 (22:47 -0700)
committerBryanDavis <bdavis@wikimedia.org>
Fri, 2 Oct 2015 21:06:01 +0000 (21:06 +0000)
* Removed used Entering/Exiting stuff
* Removed bogus empty entry on the first line

Change-Id: I0ade132e04d745a21f4ec9fdd52a43b10d85e4d3

includes/debug/MWDebug.php

index 1249eba..841636c 100644 (file)
@@ -455,59 +455,21 @@ class MWDebug {
         * @return string HTML fragment
         */
        public static function getHTMLDebugLog() {
-               global $wgDebugTimestamps, $wgShowDebug;
+               global $wgShowDebug;
 
                if ( !$wgShowDebug ) {
                        return '';
                }
 
-               $curIdent = 0;
-               $ret = "\n<hr />\n<strong>Debug data:</strong><ul id=\"mw-debug-html\">\n<li>";
+               $ret = "\n<hr />\n<strong>Debug data:</strong><ul id=\"mw-debug-html\">\n";
 
                foreach ( self::$debug as $line ) {
-                       $pre = '';
-                       if ( $wgDebugTimestamps ) {
-                               $matches = array();
-                               if ( preg_match( '/^(\d+\.\d+ {1,3}\d+.\dM\s{2})/', $line, $matches ) ) {
-                                       $pre = $matches[1];
-                                       $line = substr( $line, strlen( $pre ) );
-                               }
-                       }
-                       $display = ltrim( $line );
-                       $ident = strlen( $line ) - strlen( $display );
-                       $diff = $ident - $curIdent;
-
-                       $display = $pre . $display;
-                       if ( $display == '' ) {
-                               $display = "\xc2\xa0";
-                       }
-
-                       if ( !$ident
-                               && $diff < 0
-                               && substr( $display, 0, 9 ) != 'Entering '
-                               && substr( $display, 0, 8 ) != 'Exiting '
-                       ) {
-                               $ident = $curIdent;
-                               $diff = 0;
-                               $display = '<span style="background:yellow;">' .
-                                       nl2br( htmlspecialchars( $display ) ) . '</span>';
-                       } else {
-                               $display = nl2br( htmlspecialchars( $display ) );
-                       }
-
-                       if ( $diff < 0 ) {
-                               $ret .= str_repeat( "</li></ul>\n", -$diff ) . "</li><li>\n";
-                       } elseif ( $diff == 0 ) {
-                               $ret .= "</li><li>\n";
-                       } else {
-                               $ret .= str_repeat( "<ul><li>\n", $diff );
-                       }
-                       $ret .= "<code>$display</code>\n";
+                       $display = nl2br( htmlspecialchars( trim( $line ) ) );
 
-                       $curIdent = $ident;
+                       $ret .= "<li><code>$display</code></li>\n";
                }
 
-               $ret .= str_repeat( '</li></ul>', $curIdent ) . "</li>\n</ul>\n";
+               $ret .= '</ul>' . "\n";
 
                return $ret;
        }