http://www.mediawiki.org/wiki/Special:Code/MediaWiki/73568
Revision: 73568
Author: tparscal
Date: 2010-09-22 20:44:12 +0000 (Wed, 22 Sep 2010)
Log Message:
-----------
* Added $wgResourceLoaderDebug, a default fallback for debug mode which can be
overridden by the debug URL parameter a la $wgLanguageCode
* Merged $wgResourceLoader(Unv|V)ersioned(Client|Server)Maxage vars into
$wgResourceLoaderMaxage, which contains an array of the same values.
Modified Paths:
--------------
trunk/phase3/RELEASE-NOTES
trunk/phase3/includes/DefaultSettings.php
trunk/phase3/includes/OutputPage.php
trunk/phase3/includes/ResourceLoader.php
trunk/phase3/includes/ResourceLoaderContext.php
Modified: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES 2010-09-22 20:15:31 UTC (rev 73567)
+++ trunk/phase3/RELEASE-NOTES 2010-09-22 20:44:12 UTC (rev 73568)
@@ -57,11 +57,11 @@
* $wgVectorExtraStyles was removed, and is no longer in use.
* $wgLoadScript was added to specify alternative locations for ResourceLoader
requests.
-* $wgResourceLoaderVersionedClientMaxage,
$wgResourceLoaderVersionedServerMaxage,
- $wgResourceLoaderUnversionedClientMaxage and
- $wgResourceLoaderUnversionedServerMaxage were added to specify maxage and
- smaxage times for responses from ResourceLoader based on whether the
request's
- URL contained a version parameter or not.
+* $wgResourceLoaderMaxage was added to specify maxage and smaxage times for
+ responses from ResourceLoader based on whether the request's URL contained a
+ version parameter or not.
+* $wgResourceLoaderDebug was added to specify the default state of debug mode;
+ this will still be overridden with the debug URL parameter a la
$wgLanguageCode.
=== New features in 1.17 ===
* (bug 10183) Users can now add personal styles and scripts to all skins via
Modified: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php 2010-09-22 20:15:31 UTC (rev
73567)
+++ trunk/phase3/includes/DefaultSettings.php 2010-09-22 20:44:12 UTC (rev
73568)
@@ -1645,32 +1645,28 @@
$wgClockSkewFudge = 5;
/**
- * Maximum time in seconds to cache versioned resources served by the resource
- * loader on the client side (e.g. in the browser cache).
+ * Maximum time in seconds to cache resources served by the resource loader
*/
-$wgResourceLoaderVersionedClientMaxage = 30 * 24 * 60 * 60; // 30 days
+$wgResourceLoaderMaxage = array(
+ 'versioned' => array(
+ // Squid/Varnish but also any other public proxy cache between
the client and MediaWiki
+ 'server' => 30 * 24 * 60 * 60, // 30 days
+ // On the client side (e.g. in the browser cache).
+ 'client' => 30 * 24 * 60 * 60, // 30 days
+ ),
+ 'unversioned' => array(
+ 'server' => 5 * 60, // 5 minutes
+ 'client' => 5 * 60, // 5 minutes
+ ),
+);
/**
- * Maximum time in seconds to cache versioned resources served by the resource
- * loader on the server side. This means Squid/Varnish but also any other
public
- * proxy cache between the client and MediaWiki.
+ * The default debug mode (on/off) for of ResourceLoader requests. This will
still
+ * be overridden when the debug URL parameter is used.
*/
-$wgResourceLoaderVersionedServerMaxage = 30 * 24 * 60 * 60; // 30 days
+$wgResourceLoaderDebug = false;
/**
- * Maximum time in seconds to cache unversioned resources served by the
resource
- * loader on the client.
- */
-$wgResourceLoaderUnversionedClientMaxage = 5 * 60; // 5 minutes
-
-/**
- * Maximum time in seconds to cache unversioned resources served by the
resource
- * loader on the server. This means Squid/Varnish but also any other public
- * proxy cache between the client and MediaWiki.
- */
-$wgResourceLoaderUnversionedServerMaxage = 5 * 60; // 5 minutes
-
-/**
* Enable data URL embedding (experimental). This variable is very temporary
and
* will be removed once we get this feature stable.
*/
Modified: trunk/phase3/includes/OutputPage.php
===================================================================
--- trunk/phase3/includes/OutputPage.php 2010-09-22 20:15:31 UTC (rev
73567)
+++ trunk/phase3/includes/OutputPage.php 2010-09-22 20:44:12 UTC (rev
73568)
@@ -2281,12 +2281,12 @@
}
static function makeResourceLoaderLink( $skin, $modules, $only ) {
- global $wgUser, $wgLang, $wgRequest, $wgLoadScript;
+ global $wgUser, $wgLang, $wgRequest, $wgLoadScript,
$wgResourceLoaderDebug;
// TODO: Should this be a static function of ResourceLoader
instead?
// TODO: Divide off modules starting with "user", and add the
user parameter to them
$query = array(
'lang' => $wgLang->getCode(),
- 'debug' => $wgRequest->getFuzzyBool( 'debug' ) ? 'true'
: 'false',
+ 'debug' => $wgRequest->getFuzzyBool( 'debug',
$wgResourceLoaderDebug ) ? 'true' : 'false',
'skin' => $wgUser->getSkin()->getSkinName(),
'only' => $only,
);
@@ -2346,8 +2346,7 @@
* @return String: HTML fragment
*/
function getHeadScripts( Skin $sk ) {
- global $wgUser, $wgRequest;
- global $wgUseSiteJs;
+ global $wgUser, $wgRequest, $wgUseSiteJs,
$wgResourceLoaderDebug;
// Statup - this will immediately load jquery and mediawiki
modules
$scripts = self::makeResourceLoaderLink( $sk, 'startup',
'scripts' );
@@ -2357,7 +2356,7 @@
$scripts .= Skin::makeGlobalVariablesScript( $sk->getSkinName()
) . "\n";
// Script and Messages "only"
- if ( $wgRequest->getFuzzyBool( 'debug' ) ) {
+ if ( $wgRequest->getFuzzyBool( 'debug', $wgResourceLoaderDebug
) ) {
// Scripts
foreach ( $this->getModuleScripts() as $name ) {
$scripts .= self::makeResourceLoaderLink( $sk,
$name, 'scripts' );
@@ -2455,7 +2454,7 @@
* @return string HTML tag links to be put in the header.
*/
public function getHeadLinks( $sk ) {
- global $wgFeed, $wgRequest;
+ global $wgFeed, $wgRequest, $wgResourceLoaderDebug;
// Ideally this should happen earlier, somewhere. :P
$this->addDefaultMeta();
@@ -2526,7 +2525,7 @@
}
// Support individual script requests in debug mode
- if ( $wgRequest->getFuzzyBool( 'debug' ) ) {
+ if ( $wgRequest->getFuzzyBool( 'debug', $wgResourceLoaderDebug
) ) {
foreach ( $this->getModuleStyles() as $name ) {
$tags[] = self::makeResourceLoaderLink( $sk,
$name, 'styles' );
}
Modified: trunk/phase3/includes/ResourceLoader.php
===================================================================
--- trunk/phase3/includes/ResourceLoader.php 2010-09-22 20:15:31 UTC (rev
73567)
+++ trunk/phase3/includes/ResourceLoader.php 2010-09-22 20:44:12 UTC (rev
73568)
@@ -249,8 +249,7 @@
* @param $context ResourceLoaderContext object
*/
public static function respond( ResourceLoaderContext $context ) {
- global $wgResourceLoaderVersionedClientMaxage,
$wgResourceLoaderVersionedServerMaxage;
- global $wgResourceLoaderUnversionedServerMaxage,
$wgResourceLoaderUnversionedClientMaxage;
+ global $wgResourceLoaderMaxage;
wfProfileIn( __METHOD__ );
self::initialize();
@@ -270,14 +269,14 @@
// If a version wasn't specified we need a shorter expiry time
for updates to
// propagate to clients quickly
if ( is_null( $context->getVersion() ) ) {
- $maxage = $wgResourceLoaderUnversionedClientMaxage;
- $smaxage = $wgResourceLoaderUnversionedServerMaxage;
+ $maxage =
$wgResourceLoaderMaxage['unversioned']['client'];
+ $smaxage =
$wgResourceLoaderMaxage['unversioned']['server'];
}
// If a version was specified we can use a longer expiry time
since changing
// version numbers causes cache misses
else {
- $maxage = $wgResourceLoaderVersionedClientMaxage;
- $smaxage = $wgResourceLoaderVersionedServerMaxage;
+ $maxage =
$wgResourceLoaderMaxage['versioned']['client'];
+ $smaxage =
$wgResourceLoaderMaxage['versioned']['server'];
}
// To send Last-Modified and support If-Modified-Since, we need
to detect
Modified: trunk/phase3/includes/ResourceLoaderContext.php
===================================================================
--- trunk/phase3/includes/ResourceLoaderContext.php 2010-09-22 20:15:31 UTC
(rev 73567)
+++ trunk/phase3/includes/ResourceLoaderContext.php 2010-09-22 20:44:12 UTC
(rev 73568)
@@ -40,7 +40,7 @@
/* Methods */
public function __construct( WebRequest $request ) {
- global $wgLang, $wgDefaultSkin;
+ global $wgLang, $wgDefaultSkin, $wgResourceLoaderDebug;
$this->request = $request;
// Interperet request
@@ -49,7 +49,7 @@
$this->direction = $request->getVal( 'dir' );
$this->skin = $request->getVal( 'skin' );
$this->user = $request->getVal( 'user' );
- $this->debug = $request->getFuzzyBool( 'debug' );
+ $this->debug = $request->getFuzzyBool( 'debug',
$wgResourceLoaderDebug );
$this->only = $request->getVal( 'only' );
$this->version = $request->getVal( 'version' );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs