r76138 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76137‎ | r76138 | r76139 >
Date:20:36, 5 November 2010
Author:catrope
Status:ok
Tags:
Comment:
Followup r75825: per bug 25610 comment #3, check for debug mode in all other places too.
Modified paths:
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/resourceloader/ResourceLoader.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/OutputPage.php
@@ -2304,13 +2304,9 @@
23052305 }
23062306 // TODO: Should this be a static function of ResourceLoader instead?
23072307 // TODO: Divide off modules starting with "user", and add the user parameter to them
2308 - // Determine whether we're in debug mode
2309 - // Order of priority is 1) request param, 2) cookie, 3) $wg setting
2310 - $debug = $wgRequest->getFuzzyBool( 'debug',
2311 - $wgRequest->getCookie( 'resourceLoaderModule', '', $wgResourceLoaderDebug ) );
23122308 $query = array(
23132309 'lang' => $wgLang->getCode(),
2314 - 'debug' => $debug ? 'true' : 'false',
 2310+ 'debug' => ResourceLoader::inDebugMode() ? 'true' : 'false',
23152311 'skin' => $wgUser->getSkin()->getSkinName(),
23162312 'only' => $only,
23172313 );
@@ -2407,7 +2403,7 @@
24082404 $scripts .= Skin::makeGlobalVariablesScript( $sk->getSkinName() ) . "\n";
24092405
24102406 // Script and Messages "only"
2411 - if ( $wgRequest->getFuzzyBool( 'debug', $wgResourceLoaderDebug ) ) {
 2407+ if ( ResourceLoader::inDebugMode() ) {
24122408 // Scripts
24132409 foreach ( $this->getModuleScripts() as $name ) {
24142410 $scripts .= $this->makeResourceLoaderLink( $sk, $name, 'scripts' );
@@ -2576,7 +2572,7 @@
25772573 }
25782574
25792575 // Support individual script requests in debug mode
2580 - if ( $wgRequest->getFuzzyBool( 'debug', $wgResourceLoaderDebug ) ) {
 2576+ if ( ResourceLoader::inDebugMode() ) {
25812577 foreach ( $this->getModuleStyles() as $name ) {
25822578 $tags[] = $this->makeResourceLoaderLink( $sk, $name, 'styles' );
25832579 }
Index: trunk/phase3/includes/resourceloader/ResourceLoader.php
@@ -582,4 +582,18 @@
583583 public static function makeConfigSetScript( array $configuration ) {
584584 return Xml::encodeJsCall( 'mediaWiki.config.set', array( $configuration ) );
585585 }
 586+
 587+ /**
 588+ * Determine whether debug mode was requested
 589+ * Order of priority is 1) request param, 2) cookie, 3) $wg setting
 590+ * @return bool
 591+ */
 592+ public static function inDebugMode() {
 593+ global $wgRequest, $wgResourceLoaderDebug;
 594+ static $retval = null;
 595+ if ( !is_null( $retval ) )
 596+ return $retval;
 597+ return $retval = $wgRequest->getFuzzyBool( 'debug',
 598+ $wgRequest->getCookie( 'resourceLoaderDebug', '', $wgResourceLoaderDebug ) );
 599+ }
586600 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r76153Follow up r76138. Globals that are now unneeded.platonides22:29, 5 November 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r75825(bug 25610) Put ResourceLoader in debug mode when resourceLoaderDebug cookie ...catrope20:35, 1 November 2010

Status & tagging log