r109032 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109031‎ | r109032 | r109033 >
Date:13:44, 16 January 2012
Author:hashar
Status:ok
Tags:
Comment:
Move MWDebug enabling logic to Setup.php

MWDebug initialization method was made to look up for a global variable. This
patch move the logic to Setup.php so we can replicate it when doing tests.

Side effect, MWDebug is disabled by default. Users will explicitly have to
enable it by using init().

Ping r105123
Modified paths:
  • /trunk/phase3/includes/Setup.php (modified) (history)
  • /trunk/phase3/includes/debug/Debug.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/debug/Debug.php
@@ -3,6 +3,9 @@
44 /**
55 * New debugger system that outputs a toolbar on page view
66 *
 7+ * By default, most methods do nothing ( self::$enabled = false ). You have
 8+ * to explicitly call MWDebug::init() to enabled them.
 9+ *
710 * @todo Profiler support
811 */
912 class MWDebug {
@@ -40,7 +43,7 @@
4144 *
4245 * @var bool
4346 */
44 - protected static $enabled = true;
 47+ protected static $enabled = false;
4548
4649 /**
4750 * Array of functions that have already been warned, formatted
@@ -51,17 +54,11 @@
5255 protected static $deprecationWarnings = array();
5356
5457 /**
55 - * Called in Setup.php, initializes the debugger if it is enabled with
56 - * $wgDebugToolbar
 58+ * Enabled the debugger and load resource module.
 59+ * This is called by Setup.php when $wgDebugToolbar is true.
5760 */
5861 public static function init() {
59 - global $wgDebugToolbar;
60 -
61 - if ( !$wgDebugToolbar ) {
62 - self::$enabled = false;
63 - return;
64 - }
65 -
 62+ self::$enabled = true;
6663 RequestContext::getMain()->getOutput()->addModules( 'mediawiki.debug' );
6764 }
6865
Index: trunk/phase3/includes/Setup.php
@@ -359,7 +359,9 @@
360360 $wgCookieSecure = ( substr( $wgServer, 0, 6 ) === 'https:' );
361361 }
362362
363 -MWDebug::init();
 363+if ( $wgDebugToolbar ) {
 364+ MWDebug::init();
 365+}
364366
365367 if ( !defined( 'MW_COMPILED' ) ) {
366368 if ( !MWInit::classExists( 'AutoLoader' ) ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r109033test with MWDebug enabled (made possible by r109032)hashar13:50, 16 January 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r105123svn:eol-style native on all phase3 stuff, since I messed that up in r105122...johnduhart18:35, 4 December 2011

Status & tagging log