Merge "Move up devunt's name to Developers"
[lhc/web/wiklou.git] / includes / debug / MWDebug.php
index 6ce5829..dde678f 100644 (file)
@@ -20,6 +20,8 @@
  * @file
  */
 
+use MediaWiki\Logger\LegacyLogger;
+
 /**
  * New debugger system that outputs a toolbar on page view.
  *
@@ -93,7 +95,7 @@ class MWDebug {
         */
        public static function addModules( OutputPage $out ) {
                if ( self::$enabled ) {
-                       $out->addModules( 'mediawiki.debug.init' );
+                       $out->addModules( 'mediawiki.debug' );
                }
        }
 
@@ -334,6 +336,7 @@ class MWDebug {
                                if ( isset( $context['seconds_elapsed'] ) && isset( $context['memory_used'] ) ) {
                                        $prefix .= "{$context['seconds_elapsed']} {$context['memory_used']}  ";
                                }
+                               $str = LegacyLogger::interpolate( $str, $context );
                                $str = $prefix . $str;
                        }
                        self::$debug[] = rtrim( UtfNormal\Validator::cleanUp( $str ) );
@@ -436,7 +439,7 @@ class MWDebug {
 
                if ( $wgDebugComments ) {
                        $html .= "<!-- Debug output:\n" .
-                               htmlspecialchars( implode( "\n", self::$debug ) ) .
+                               htmlspecialchars( implode( "\n", self::$debug ), ENT_NOQUOTES ) .
                                "\n\n-->";
                }
 
@@ -525,12 +528,19 @@ class MWDebug {
                // see: https://github.com/facebook/hhvm/issues/2257#issuecomment-39362246
                $realMemoryUsage = wfIsHHVM();
 
+               $branch = GitInfo::currentBranch();
+               if ( GitInfo::isSHA1( $branch ) ) {
+                       // If it's a detached HEAD, the SHA1 will already be
+                       // included in the MW version, so don't show it.
+                       $branch = false;
+               }
+
                return [
                        'mwVersion' => $wgVersion,
                        'phpEngine' => wfIsHHVM() ? 'HHVM' : 'PHP',
                        'phpVersion' => wfIsHHVM() ? HHVM_VERSION : PHP_VERSION,
                        'gitRevision' => GitInfo::headSHA1(),
-                       'gitBranch' => GitInfo::currentBranch(),
+                       'gitBranch' => $branch,
                        'gitViewUrl' => GitInfo::headViewUrl(),
                        'time' => microtime( true ) - $wgRequestTime,
                        'log' => self::$log,