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
$wgCookieSecure = ( substr( $wgServer, 0, 6 ) === 'https:' );
}
$wgCookieSecure = ( substr( $wgServer, 0, 6 ) === 'https:' );
}
+if ( $wgDebugToolbar ) {
+ MWDebug::init();
+}
if ( !defined( 'MW_COMPILED' ) ) {
if ( !MWInit::classExists( 'AutoLoader' ) ) {
if ( !defined( 'MW_COMPILED' ) ) {
if ( !MWInit::classExists( 'AutoLoader' ) ) {
/**
* New debugger system that outputs a toolbar on page view
*
/**
* New debugger system that outputs a toolbar on page view
*
+ * By default, most methods do nothing ( self::$enabled = false ). You have
+ * to explicitly call MWDebug::init() to enabled them.
+ *
* @todo Profiler support
*/
class MWDebug {
* @todo Profiler support
*/
class MWDebug {
- protected static $enabled = true;
+ protected static $enabled = false;
/**
* Array of functions that have already been warned, formatted
/**
* Array of functions that have already been warned, formatted
protected static $deprecationWarnings = array();
/**
protected static $deprecationWarnings = array();
/**
- * Called in Setup.php, initializes the debugger if it is enabled with
- * $wgDebugToolbar
+ * Enabled the debugger and load resource module.
+ * This is called by Setup.php when $wgDebugToolbar is true.
*/
public static function init() {
*/
public static function init() {
- global $wgDebugToolbar;
-
- if ( !$wgDebugToolbar ) {
- self::$enabled = false;
- return;
- }
-
RequestContext::getMain()->getOutput()->addModules( 'mediawiki.debug' );
}
RequestContext::getMain()->getOutput()->addModules( 'mediawiki.debug' );
}