From: Alexandre Emsenhuber Date: Mon, 6 Feb 2012 17:34:33 +0000 (+0000) Subject: Recommit r110758 (again) now that the problem has been fixed in r110761 X-Git-Tag: 1.31.0-rc.0~24912 X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;h=a172d738eb1cb5d62546e1c626ef3ec2226f4de6;p=lhc%2Fweb%2Fwiklou.git Recommit r110758 (again) now that the problem has been fixed in r110761 --- diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 6e892b4dfd..cc9118af52 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -2456,6 +2456,8 @@ $templates $this->addModules( 'mediawiki.util' ); } + MWDebug::addModules( $this ); + // Add various resources if required if ( $wgUseAjax ) { $this->addModules( 'mediawiki.legacy.ajax' ); diff --git a/includes/Setup.php b/includes/Setup.php index 1cf803c14a..00df897229 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -427,7 +427,6 @@ if ( $wgCommandLineMode ) { } } wfDebug( "$debug\n" ); - MWDebug::processRequest( $wgRequest ); } wfProfileOut( $fname . '-misc1' ); diff --git a/includes/debug/Debug.php b/includes/debug/Debug.php index b8376047a5..2f03feec9c 100644 --- a/includes/debug/Debug.php +++ b/includes/debug/Debug.php @@ -31,13 +31,6 @@ class MWDebug { */ protected static $query = array(); - /** - * Request information - * - * @var array - */ - protected static $request = array(); - /** * Is the debugger enabled? * @@ -59,7 +52,18 @@ class MWDebug { */ public static function init() { self::$enabled = true; - RequestContext::getMain()->getOutput()->addModules( 'mediawiki.debug' ); + } + + /** + * Add ResourceLoader modules to the OutputPage object if debugging is + * enabled. + * + * @param $out OutputPage + */ + public static function addModules( OutputPage $out ) { + if ( self::$enabled ) { + $out->addModules( 'mediawiki.debug' ); + } } /** @@ -216,24 +220,6 @@ class MWDebug { unset( self::$query[$id]['_start'] ); } - /** - * Processes a WebRequest object - * - * @param $request WebRequest - */ - public static function processRequest( WebRequest $request ) { - if ( !self::$enabled ) { - return; - } - - self::$request = array( - 'method' => $_SERVER['REQUEST_METHOD'], - 'url' => $request->getRequestURL(), - 'headers' => $request->getAllHeaders(), - 'params' => $request->getValues(), - ); - } - /** * Returns a list of files included, along with their size * @@ -267,6 +253,7 @@ class MWDebug { global $wgVersion, $wgRequestTime; MWDebug::log( 'MWDebug output complete' ); + $request = $context->getRequest(); $debugInfo = array( 'mwVersion' => $wgVersion, 'phpVersion' => PHP_VERSION, @@ -274,7 +261,12 @@ class MWDebug { 'log' => self::$log, 'debugLog' => self::$debug, 'queries' => self::$query, - 'request' => self::$request, + 'request' => array( + 'method' => $_SERVER['REQUEST_METHOD'], + 'url' => $request->getRequestURL(), + 'headers' => $request->getAllHeaders(), + 'params' => $request->getValues(), + ), 'memory' => $context->getLanguage()->formatSize( memory_get_usage() ), 'memoryPeak' => $context->getLanguage()->formatSize( memory_get_peak_usage() ), 'includes' => self::getFilesIncluded( $context ),