r110488 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110487‎ | r110488 | r110489 >
Date:15:48, 1 February 2012
Author:ialex
Status:reverted
Tags:core 
Comment:
Recommit r109062 (Only run some MWDebug code when really needed) but leaving the addition of ResourceLoader module inside the MWDebug class this time
Modified paths:
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/Setup.php (modified) (history)
  • /trunk/phase3/includes/debug/Debug.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Setup.php
@@ -427,7 +427,6 @@
428428 }
429429 }
430430 wfDebug( "$debug\n" );
431 - MWDebug::processRequest( $wgRequest );
432431 }
433432
434433 wfProfileOut( $fname . '-misc1' );
Index: trunk/phase3/includes/OutputPage.php
@@ -2456,6 +2456,8 @@
24572457 $this->addModules( 'mediawiki.util' );
24582458 }
24592459
 2460+ MWDebug::addModules( $this );
 2461+
24602462 // Add various resources if required
24612463 if ( $wgUseAjax ) {
24622464 $this->addModules( 'mediawiki.legacy.ajax' );
Index: trunk/phase3/includes/debug/Debug.php
@@ -32,13 +32,6 @@
3333 protected static $query = array();
3434
3535 /**
36 - * Request information
37 - *
38 - * @var array
39 - */
40 - protected static $request = array();
41 -
42 - /**
4336 * Is the debugger enabled?
4437 *
4538 * @var bool
@@ -59,10 +52,21 @@
6053 */
6154 public static function init() {
6255 self::$enabled = true;
63 - RequestContext::getMain()->getOutput()->addModules( 'mediawiki.debug' );
6456 }
6557
6658 /**
 59+ * Add ResourceLoader modules to the OutputPage object if debugging is
 60+ * enabled.
 61+ *
 62+ * @param $out OutputPage
 63+ */
 64+ public static function addModules( OutputPage $out ) {
 65+ if ( self::$enabled ) {
 66+ $out->addModules( 'mediawiki.debug' );
 67+ }
 68+ }
 69+
 70+ /**
6771 * Adds a line to the log
6872 *
6973 * @todo Add support for passing objects
@@ -217,24 +221,6 @@
218222 }
219223
220224 /**
221 - * Processes a WebRequest object
222 - *
223 - * @param $request WebRequest
224 - */
225 - public static function processRequest( WebRequest $request ) {
226 - if ( !self::$enabled ) {
227 - return;
228 - }
229 -
230 - self::$request = array(
231 - 'method' => $_SERVER['REQUEST_METHOD'],
232 - 'url' => $request->getRequestURL(),
233 - 'headers' => $request->getAllHeaders(),
234 - 'params' => $request->getValues(),
235 - );
236 - }
237 -
238 - /**
239225 * Returns a list of files included, along with their size
240226 *
241227 * @param $context IContextSource
@@ -267,6 +253,7 @@
268254
269255 global $wgVersion, $wgRequestTime;
270256 MWDebug::log( 'MWDebug output complete' );
 257+ $request = $context->getRequest();
271258 $debugInfo = array(
272259 'mwVersion' => $wgVersion,
273260 'phpVersion' => PHP_VERSION,
@@ -274,7 +261,12 @@
275262 'log' => self::$log,
276263 'debugLog' => self::$debug,
277264 'queries' => self::$query,
278 - 'request' => self::$request,
 265+ 'request' => array(
 266+ 'method' => $_SERVER['REQUEST_METHOD'],
 267+ 'url' => $request->getRequestURL(),
 268+ 'headers' => $request->getAllHeaders(),
 269+ 'params' => $request->getValues(),
 270+ ),
279271 'memory' => $context->getLanguage()->formatSize( memory_get_usage() ),
280272 'memoryPeak' => $context->getLanguage()->formatSize( memory_get_peak_usage() ),
281273 'includes' => self::getFilesIncluded( $context ),

Follow-up revisions

RevisionCommit summaryAuthorDate
r110758reverts r110488...hashar16:42, 6 February 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r109062Only run some MWDebug code when really needed:...ialex21:29, 16 January 2012

Status & tagging log