Index: trunk/phase3/includes/ResourceLoaderContext.php |
— | — | @@ -40,7 +40,7 @@ |
41 | 41 | /* Methods */ |
42 | 42 | |
43 | 43 | public function __construct( WebRequest $request ) { |
44 | | - global $wgLang, $wgDefaultSkin; |
| 44 | + global $wgLang, $wgDefaultSkin, $wgResourceLoaderDebug; |
45 | 45 | |
46 | 46 | $this->request = $request; |
47 | 47 | // Interperet request |
— | — | @@ -49,7 +49,7 @@ |
50 | 50 | $this->direction = $request->getVal( 'dir' ); |
51 | 51 | $this->skin = $request->getVal( 'skin' ); |
52 | 52 | $this->user = $request->getVal( 'user' ); |
53 | | - $this->debug = $request->getFuzzyBool( 'debug' ); |
| 53 | + $this->debug = $request->getFuzzyBool( 'debug', $wgResourceLoaderDebug ); |
54 | 54 | $this->only = $request->getVal( 'only' ); |
55 | 55 | $this->version = $request->getVal( 'version' ); |
56 | 56 | |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -2281,12 +2281,12 @@ |
2282 | 2282 | } |
2283 | 2283 | |
2284 | 2284 | static function makeResourceLoaderLink( $skin, $modules, $only ) { |
2285 | | - global $wgUser, $wgLang, $wgRequest, $wgLoadScript; |
| 2285 | + global $wgUser, $wgLang, $wgRequest, $wgLoadScript, $wgResourceLoaderDebug; |
2286 | 2286 | // TODO: Should this be a static function of ResourceLoader instead? |
2287 | 2287 | // TODO: Divide off modules starting with "user", and add the user parameter to them |
2288 | 2288 | $query = array( |
2289 | 2289 | 'lang' => $wgLang->getCode(), |
2290 | | - 'debug' => $wgRequest->getFuzzyBool( 'debug' ) ? 'true' : 'false', |
| 2290 | + 'debug' => $wgRequest->getFuzzyBool( 'debug', $wgResourceLoaderDebug ) ? 'true' : 'false', |
2291 | 2291 | 'skin' => $wgUser->getSkin()->getSkinName(), |
2292 | 2292 | 'only' => $only, |
2293 | 2293 | ); |
— | — | @@ -2346,8 +2346,7 @@ |
2347 | 2347 | * @return String: HTML fragment |
2348 | 2348 | */ |
2349 | 2349 | function getHeadScripts( Skin $sk ) { |
2350 | | - global $wgUser, $wgRequest; |
2351 | | - global $wgUseSiteJs; |
| 2350 | + global $wgUser, $wgRequest, $wgUseSiteJs, $wgResourceLoaderDebug; |
2352 | 2351 | |
2353 | 2352 | // Statup - this will immediately load jquery and mediawiki modules |
2354 | 2353 | $scripts = self::makeResourceLoaderLink( $sk, 'startup', 'scripts' ); |
— | — | @@ -2357,7 +2356,7 @@ |
2358 | 2357 | $scripts .= Skin::makeGlobalVariablesScript( $sk->getSkinName() ) . "\n"; |
2359 | 2358 | |
2360 | 2359 | // Script and Messages "only" |
2361 | | - if ( $wgRequest->getFuzzyBool( 'debug' ) ) { |
| 2360 | + if ( $wgRequest->getFuzzyBool( 'debug', $wgResourceLoaderDebug ) ) { |
2362 | 2361 | // Scripts |
2363 | 2362 | foreach ( $this->getModuleScripts() as $name ) { |
2364 | 2363 | $scripts .= self::makeResourceLoaderLink( $sk, $name, 'scripts' ); |
— | — | @@ -2455,7 +2454,7 @@ |
2456 | 2455 | * @return string HTML tag links to be put in the header. |
2457 | 2456 | */ |
2458 | 2457 | public function getHeadLinks( $sk ) { |
2459 | | - global $wgFeed, $wgRequest; |
| 2458 | + global $wgFeed, $wgRequest, $wgResourceLoaderDebug; |
2460 | 2459 | |
2461 | 2460 | // Ideally this should happen earlier, somewhere. :P |
2462 | 2461 | $this->addDefaultMeta(); |
— | — | @@ -2526,7 +2525,7 @@ |
2527 | 2526 | } |
2528 | 2527 | |
2529 | 2528 | // Support individual script requests in debug mode |
2530 | | - if ( $wgRequest->getFuzzyBool( 'debug' ) ) { |
| 2529 | + if ( $wgRequest->getFuzzyBool( 'debug', $wgResourceLoaderDebug ) ) { |
2531 | 2530 | foreach ( $this->getModuleStyles() as $name ) { |
2532 | 2531 | $tags[] = self::makeResourceLoaderLink( $sk, $name, 'styles' ); |
2533 | 2532 | } |
Index: trunk/phase3/includes/ResourceLoader.php |
— | — | @@ -249,8 +249,7 @@ |
250 | 250 | * @param $context ResourceLoaderContext object |
251 | 251 | */ |
252 | 252 | public static function respond( ResourceLoaderContext $context ) { |
253 | | - global $wgResourceLoaderVersionedClientMaxage, $wgResourceLoaderVersionedServerMaxage; |
254 | | - global $wgResourceLoaderUnversionedServerMaxage, $wgResourceLoaderUnversionedClientMaxage; |
| 253 | + global $wgResourceLoaderMaxage; |
255 | 254 | |
256 | 255 | wfProfileIn( __METHOD__ ); |
257 | 256 | self::initialize(); |
— | — | @@ -270,14 +269,14 @@ |
271 | 270 | // If a version wasn't specified we need a shorter expiry time for updates to |
272 | 271 | // propagate to clients quickly |
273 | 272 | if ( is_null( $context->getVersion() ) ) { |
274 | | - $maxage = $wgResourceLoaderUnversionedClientMaxage; |
275 | | - $smaxage = $wgResourceLoaderUnversionedServerMaxage; |
| 273 | + $maxage = $wgResourceLoaderMaxage['unversioned']['client']; |
| 274 | + $smaxage = $wgResourceLoaderMaxage['unversioned']['server']; |
276 | 275 | } |
277 | 276 | // If a version was specified we can use a longer expiry time since changing |
278 | 277 | // version numbers causes cache misses |
279 | 278 | else { |
280 | | - $maxage = $wgResourceLoaderVersionedClientMaxage; |
281 | | - $smaxage = $wgResourceLoaderVersionedServerMaxage; |
| 279 | + $maxage = $wgResourceLoaderMaxage['versioned']['client']; |
| 280 | + $smaxage = $wgResourceLoaderMaxage['versioned']['server']; |
282 | 281 | } |
283 | 282 | |
284 | 283 | // To send Last-Modified and support If-Modified-Since, we need to detect |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -1645,32 +1645,28 @@ |
1646 | 1646 | $wgClockSkewFudge = 5; |
1647 | 1647 | |
1648 | 1648 | /** |
1649 | | - * Maximum time in seconds to cache versioned resources served by the resource |
1650 | | - * loader on the client side (e.g. in the browser cache). |
| 1649 | + * Maximum time in seconds to cache resources served by the resource loader |
1651 | 1650 | */ |
1652 | | -$wgResourceLoaderVersionedClientMaxage = 30 * 24 * 60 * 60; // 30 days |
| 1651 | +$wgResourceLoaderMaxage = array( |
| 1652 | + 'versioned' => array( |
| 1653 | + // Squid/Varnish but also any other public proxy cache between the client and MediaWiki |
| 1654 | + 'server' => 30 * 24 * 60 * 60, // 30 days |
| 1655 | + // On the client side (e.g. in the browser cache). |
| 1656 | + 'client' => 30 * 24 * 60 * 60, // 30 days |
| 1657 | + ), |
| 1658 | + 'unversioned' => array( |
| 1659 | + 'server' => 5 * 60, // 5 minutes |
| 1660 | + 'client' => 5 * 60, // 5 minutes |
| 1661 | + ), |
| 1662 | +); |
1653 | 1663 | |
1654 | 1664 | /** |
1655 | | - * Maximum time in seconds to cache versioned resources served by the resource |
1656 | | - * loader on the server side. This means Squid/Varnish but also any other public |
1657 | | - * proxy cache between the client and MediaWiki. |
| 1665 | + * The default debug mode (on/off) for of ResourceLoader requests. This will still |
| 1666 | + * be overridden when the debug URL parameter is used. |
1658 | 1667 | */ |
1659 | | -$wgResourceLoaderVersionedServerMaxage = 30 * 24 * 60 * 60; // 30 days |
| 1668 | +$wgResourceLoaderDebug = false; |
1660 | 1669 | |
1661 | 1670 | /** |
1662 | | - * Maximum time in seconds to cache unversioned resources served by the resource |
1663 | | - * loader on the client. |
1664 | | - */ |
1665 | | -$wgResourceLoaderUnversionedClientMaxage = 5 * 60; // 5 minutes |
1666 | | - |
1667 | | -/** |
1668 | | - * Maximum time in seconds to cache unversioned resources served by the resource |
1669 | | - * loader on the server. This means Squid/Varnish but also any other public |
1670 | | - * proxy cache between the client and MediaWiki. |
1671 | | - */ |
1672 | | -$wgResourceLoaderUnversionedServerMaxage = 5 * 60; // 5 minutes |
1673 | | - |
1674 | | -/** |
1675 | 1671 | * Enable data URL embedding (experimental). This variable is very temporary and |
1676 | 1672 | * will be removed once we get this feature stable. |
1677 | 1673 | */ |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -57,11 +57,11 @@ |
58 | 58 | * $wgVectorExtraStyles was removed, and is no longer in use. |
59 | 59 | * $wgLoadScript was added to specify alternative locations for ResourceLoader |
60 | 60 | requests. |
61 | | -* $wgResourceLoaderVersionedClientMaxage, $wgResourceLoaderVersionedServerMaxage, |
62 | | - $wgResourceLoaderUnversionedClientMaxage and |
63 | | - $wgResourceLoaderUnversionedServerMaxage were added to specify maxage and |
64 | | - smaxage times for responses from ResourceLoader based on whether the request's |
65 | | - URL contained a version parameter or not. |
| 61 | +* $wgResourceLoaderMaxage was added to specify maxage and smaxage times for |
| 62 | + responses from ResourceLoader based on whether the request's URL contained a |
| 63 | + version parameter or not. |
| 64 | +* $wgResourceLoaderDebug was added to specify the default state of debug mode; |
| 65 | + this will still be overridden with the debug URL parameter a la $wgLanguageCode. |
66 | 66 | |
67 | 67 | === New features in 1.17 === |
68 | 68 | * (bug 10183) Users can now add personal styles and scripts to all skins via |