Merge "Remove unused $wgDebugDBTransactions"
[lhc/web/wiklou.git] / resources / mediawiki / mediawiki.debug.js
index 608c196..2afcbc6 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * JavaScript for the new debug toolbar, enabled with $wgDebugToolbar
+ * JavaScript for the new debug toolbar, enabled through $wgDebugToolbar.
  *
  * @author John Du Hart
  * @since 1.19
                data: {},
 
                /**
-                * Initializes the debugging pane
+                * Initializes the debugging pane.
+                * Shouldn't be called before the document is ready
+                * (since it binds to elements on the page).
                 *
-                * @param {Object} data
+                * @param {Object} data, defaults to 'debugInfo' from mw.config
                 */
                init: function ( data ) {
 
-                       this.data = data;
+                       this.data = data || mw.config.get( 'debugInfo' );
                        this.buildHtml();
 
                        // Insert the container into the DOM
 
                        paneTriggerBitDiv( 'querylist', 'Queries', this.data.queries.length );
 
-                       paneTriggerBitDiv( 'debuglog', 'Debug Log', this.data.debugLog.length );
+                       paneTriggerBitDiv( 'debuglog', 'Debug log', this.data.debugLog.length );
 
                        paneTriggerBitDiv( 'request', 'Request' );
 
                        paneTriggerBitDiv( 'includes', 'PHP includes', this.data.includes.length );
 
+                       var gitInfo = '';
+                       if ( this.data.gitRevision != false ) {
+                               gitInfo = ' (' + this.data.gitRevision.substring( 0, 7 ) + ')';
+                       }
+
                        bitDiv( 'mwversion' )
                                .append( $( '<a href="//www.mediawiki.org/"></a>' ).text( 'MediaWiki' ) )
-                               .append( ': ' + this.data.mwVersion );
+                               .append( ': ' + this.data.mwVersion + gitInfo );
+
+                       if ( this.data.gitBranch != false ) {
+                               bitDiv( 'gitbranch' ).text( 'Git branch: ' + this.data.gitBranch );
+                       }
 
                        bitDiv( 'phpversion' )
                                .append( $( '<a href="//www.php.net/"></a>' ).text( 'PHP' ) )
                                .append( $('<th>#</th>').css( 'width', '4em' )    )
                                .append( $('<th>SQL</th>') )
                                .append( $('<th>Time</th>').css( 'width', '8em'  ) )
-                               .append( $('<th>Call</th>').css( 'width', '12em' ) )
+                               .append( $('<th>Call</th>').css( 'width', '18em' ) )
                        .appendTo( $table );
 
                        for ( i = 0, length = this.data.queries.length; i < length; i += 1 ) {