r110758 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110757‎ | r110758 | r110759 >
Date:16:42, 6 February 2012
Author:hashar
Status:ok (Comments)
Tags:core 
Comment:
reverts r110488

Breaks maintenance/rebuildFileCache.php with stack trace saying that
FauxRequest::getRequestURL() not implemented

Backtrace:
#0 includes/WebRequest.php(1261): FauxRequest->notImplemented('FauxRequest::ge...')
#1 includes/debug/Debug.php(266): FauxRequest->getRequestURL()
#2 includes/Skin.php(561): MWDebug::getDebugHTML(Object(RequestContext))
#3 includes/SkinTemplate.php(461): Skin->generateDebugHTML()
#4 includes/OutputPage.php(1982): SkinTemplate->outputPage()
#5 maintenance/rebuildFileCache.php(119): OutputPage->output()
#6 maintenance/doMaintenance.php(105): RebuildFileCache->execute()
#7 maintenance/rebuildFileCache.php(146): require_once('/srv/trunk/main...')
#8 {main}
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/debug/Debug.php
@@ -32,6 +32,13 @@
3333 protected static $query = array();
3434
3535 /**
 36+ * Request information
 37+ *
 38+ * @var array
 39+ */
 40+ protected static $request = array();
 41+
 42+ /**
3643 * Is the debugger enabled?
3744 *
3845 * @var bool
@@ -52,21 +59,10 @@
5360 */
5461 public static function init() {
5562 self::$enabled = true;
 63+ RequestContext::getMain()->getOutput()->addModules( 'mediawiki.debug' );
5664 }
5765
5866 /**
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 - /**
7167 * Adds a line to the log
7268 *
7369 * @todo Add support for passing objects
@@ -221,6 +217,24 @@
222218 }
223219
224220 /**
 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+ /**
225239 * Returns a list of files included, along with their size
226240 *
227241 * @param $context IContextSource
@@ -253,7 +267,6 @@
254268
255269 global $wgVersion, $wgRequestTime;
256270 MWDebug::log( 'MWDebug output complete' );
257 - $request = $context->getRequest();
258271 $debugInfo = array(
259272 'mwVersion' => $wgVersion,
260273 'phpVersion' => PHP_VERSION,
@@ -261,12 +274,7 @@
262275 'log' => self::$log,
263276 'debugLog' => self::$debug,
264277 'queries' => self::$query,
265 - 'request' => array(
266 - 'method' => $_SERVER['REQUEST_METHOD'],
267 - 'url' => $request->getRequestURL(),
268 - 'headers' => $request->getAllHeaders(),
269 - 'params' => $request->getValues(),
270 - ),
 278+ 'request' => self::$request,
271279 'memory' => $context->getLanguage()->formatSize( memory_get_usage() ),
272280 'memoryPeak' => $context->getLanguage()->formatSize( memory_get_peak_usage() ),
273281 'includes' => self::getFilesIncluded( $context ),
Index: trunk/phase3/includes/OutputPage.php
@@ -2456,8 +2456,6 @@
24572457 $this->addModules( 'mediawiki.util' );
24582458 }
24592459
2460 - MWDebug::addModules( $this );
2461 -
24622460 // Add various resources if required
24632461 if ( $wgUseAjax ) {
24642462 $this->addModules( 'mediawiki.legacy.ajax' );
Index: trunk/phase3/includes/Setup.php
@@ -427,6 +427,7 @@
428428 }
429429 }
430430 wfDebug( "$debug\n" );
 431+ MWDebug::processRequest( $wgRequest );
431432 }
432433
433434 wfProfileOut( $fname . '-misc1' );

Follow-up revisions

RevisionCommit summaryAuthorDate
r110762Recommit r110758 (again) now that the problem has been fixed in r110761ialex17:34, 6 February 2012
r110829rebuildFileCache now really disable debugToolbar...hashar09:37, 7 February 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r110488Recommit r109062 (Only run some MWDebug code when really needed) but leaving ...ialex15:48, 1 February 2012

Comments

#Comment by Aaron Schulz (talk | contribs)   18:08, 6 February 2012

I'd prefer this script be fixed, but OK.

#Comment by Aaron Schulz (talk | contribs)   18:09, 6 February 2012

Oh, done already :)

#Comment by Hashar (talk | contribs)   20:25, 6 February 2012

> I'd prefer this script be fixed, but OK.

I have been a bit too fast at reverting that. Talked to iAlex immediately afterward :-]

Status & tagging log