http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89676
Revision: 89676
Author: catrope
Date: 2011-06-07 19:09:07 +0000 (Tue, 07 Jun 2011)
Log Message:
-----------
1.17: MFT r82247, r87203, r87265, r87494, r87497, r87711, r87840, r88076, r89615
Modified Paths:
--------------
branches/REL1_17/phase3/includes/DefaultSettings.php
branches/REL1_17/phase3/includes/OutputPage.php
branches/REL1_17/phase3/includes/installer/Installer.i18n.php
branches/REL1_17/phase3/includes/installer/Installer.php
branches/REL1_17/phase3/includes/installer/LocalSettingsGenerator.php
branches/REL1_17/phase3/includes/libs/CSSMin.php
branches/REL1_17/phase3/includes/resourceloader/ResourceLoader.php
branches/REL1_17/phase3/includes/resourceloader/ResourceLoaderContext.php
branches/REL1_17/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php
branches/REL1_17/phase3/resources/Resources.php
branches/REL1_17/phase3/resources/mediawiki/mediawiki.js
Property Changed:
----------------
branches/REL1_17/phase3/includes/DefaultSettings.php
branches/REL1_17/phase3/includes/OutputPage.php
branches/REL1_17/phase3/includes/installer/Installer.i18n.php
branches/REL1_17/phase3/includes/installer/Installer.php
branches/REL1_17/phase3/includes/resourceloader/ResourceLoader.php
branches/REL1_17/phase3/resources/Resources.php
branches/REL1_17/phase3/resources/mediawiki/mediawiki.js
Modified: branches/REL1_17/phase3/includes/DefaultSettings.php
===================================================================
--- branches/REL1_17/phase3/includes/DefaultSettings.php 2011-06-07
18:51:03 UTC (rev 89675)
+++ branches/REL1_17/phase3/includes/DefaultSettings.php 2011-06-07
19:09:07 UTC (rev 89676)
@@ -2452,6 +2452,19 @@
*/
$wgIncludeLegacyJavaScript = true;
+/**
+ * If set to a positive number, ResourceLoader will not generate URLs whose
+ * query string is more than this many characters long, and will instead use
+ * multiple requests with shorter query strings. This degrades performance,
+ * but may be needed if your web server has a low (less than, say 1024)
+ * query string length limit or a low value for suhosin.get.max_value_length
+ * that you can't increase.
+ *
+ * If set to a negative number, ResourceLoader will assume there is no query
+ * string length limit.
+ */
+$wgResourceLoaderMaxQueryLength = -1;
+
/** @} */ # End of resource loader settings }
Property changes on: branches/REL1_17/phase3/includes/DefaultSettings.php
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/REL1_15/phase3/includes/DefaultSettings.php:51646
/branches/new-installer/phase3/includes/DefaultSettings.php:43664-66004
/branches/sqlite/includes/DefaultSettings.php:58211-58321
/branches/wmf-deployment/includes/DefaultSettings.php:53381
/trunk/phase3/includes/DefaultSettings.php:78395,79166,79324,79746,79860,79968,80109,80113,80137-80138,80205,80210,80222-80223,80231,80272,80381,80432-80433,80436,80443,80475,80554,80575,80590,80614-80616,80620,80656,80666,80841,81311,81313,81349,81352,81376,81389,81397,81399,81412,81430,81488,81496,81554,81561,81589,81600,81611,81620,81622,81640,81648,81650-81652,81731,82038-82039,82518,82530,82538,82547,82550,82565,82572,82608,82696,82748,82836,82853,82858,82871,82938,83005,83015,83046,83114,83153,83173,83270,83284,83374,83390,83392,83402-83403,83410-83411,83420,83461,83463,83476,83489,83496,83586-83587,83798,83814,83876,83891,83897,83902-83903,83979,83988-83989,83997-83998,84118,84228,84271,84343,84353,84392,84430-84431,84464,84543,84553,84573-84574,84577,84579,84729,84765,84820,84846,84905,84985,85032,85140,85143,85152,85178,85194,85199,85377,85547,85555,85583,85803,85881,86065,86100,86121,86130,86142,86146,86182,86210,86257,86385,86394
+ /branches/REL1_15/phase3/includes/DefaultSettings.php:51646
/branches/new-installer/phase3/includes/DefaultSettings.php:43664-66004
/branches/sqlite/includes/DefaultSettings.php:58211-58321
/branches/wmf-deployment/includes/DefaultSettings.php:53381
/trunk/phase3/includes/DefaultSettings.php:78395,79166,79324,79746,79860,79968,80109,80113,80137-80138,80205,80210,80222-80223,80231,80272,80381,80432-80433,80436,80443,80475,80554,80575,80590,80614-80616,80620,80656,80666,80841,81311,81313,81349,81352,81376,81389,81397,81399,81412,81430,81488,81496,81554,81561,81589,81600,81611,81620,81622,81640,81648,81650-81652,81731,82038-82039,82247,82518,82530,82538,82547,82550,82565,82572,82608,82696,82748,82836,82853,82858,82871,82938,83005,83015,83046,83114,83153,83173,83270,83284,83374,83390,83392,83402-83403,83410-83411,83420,83461,83463,83476,83489,83496,83586-83587,83798,83814,83876,83891,83897,83902-83903,83979,83988-83989,83997-83998,84118,84228,84271,84343,84353,84392,84430-84431,84464,84543,84553,84573-84574,84577,84579,84729,84765,84820,84846,84905,84985,85032,85140,85143,85152,85178,85194,85199,85377,85547,85555,85583,85803,85881,86065,86100,86121,86130,86142,86146,86182,86210,86257,86385,86394,87203,87265,87494,87497,87711,87840,88076,89615
Modified: branches/REL1_17/phase3/includes/OutputPage.php
===================================================================
--- branches/REL1_17/phase3/includes/OutputPage.php 2011-06-07 18:51:03 UTC
(rev 89675)
+++ branches/REL1_17/phase3/includes/OutputPage.php 2011-06-07 19:09:07 UTC
(rev 89676)
@@ -2338,7 +2338,6 @@
$wgResourceLoaderInlinePrivateModules, $wgRequest;
// Lazy-load ResourceLoader
// TODO: Should this be a static function of ResourceLoader
instead?
- // TODO: Divide off modules starting with "user", and add the
user parameter to them
$baseQuery = array(
'lang' => $wgLang->getCode(),
'debug' => ResourceLoader::inDebugMode() ? 'true' :
'false',
@@ -2407,7 +2406,7 @@
continue;
}
- $query['modules'] = implode( '|', array_keys( $modules
) );
+ $query['modules'] =
ResourceLoader::makePackedModulesString( array_keys( $modules ) );
// Support inlining of private modules if configured as
such
if ( $group === 'private' &&
$wgResourceLoaderInlinePrivateModules ) {
@@ -2442,6 +2441,9 @@
ksort( $query );
$url = wfAppendQuery( $wgLoadScript, $query );
+ // Prevent the IE6 extension check from being triggered
(bug 28840)
+ // by appending a character that's invalid in Windows
extensions ('*')
+ $url .= '&*';
if ( $useESI && $wgResourceLoaderUseESI ) {
$esi = Xml::element( 'esi:include', array(
'src' => $url ) );
if ( $only == 'styles' ) {
@@ -2452,9 +2454,9 @@
} else {
// Automatically select style/script elements
if ( $only === 'styles' ) {
- $links .= Html::linkedStyle(
wfAppendQuery( $wgLoadScript, $query ) ) . "\n";
+ $links .= Html::linkedStyle( $url ) .
"\n";
} else {
- $links .= Html::linkedScript(
wfAppendQuery( $wgLoadScript, $query ) ) . "\n";
+ $links .= Html::linkedScript( $url ) .
"\n";
}
}
}
Property changes on: branches/REL1_17/phase3/includes/OutputPage.php
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/REL1_15/phase3/includes/OutputPage.php:51646
/branches/resourceloader/phase3/includes/OutputPage.php:68366-69676,69678-70682,70684-71999,72001-72255,72257-72305,72307-72342
/branches/wmf-deployment/includes/OutputPage.php:53381,57468
/trunk/phase3/includes/OutputPage.php:78011-78012,78014-78016,78018,78043,78046,78071,78081,78083,78099,78117,78161,78170,78172,78199,78248,78393,78506-78507,78510-78511,78536,78539,78544,78565,78574,78660,78679,78774,78808,78886-78887,78926,78943,79013,79018-79019,79034,79072,79115,79122,79324,79561,79732,79839,80003,80005,80697,80755,80771,80773-80774,80779,80816,80833,80841,81430,81488,81496,81554,81561,81589,81600,81611,81620,81622,81640,81648,81650-81652,81731,82038-82039,82129,82155-82156,82181,82191,82200,82203,82215,82219,82221,82253,82468,82474,82518,82530,82538,82547,82550,82565,82572,82608,82696,82748,82836,82853,82858,82871,82938,83005,83015,83046,83114,83153,83173,83270,83284,83374,83390,83392,83402-83403,83410-83411,83420,83461,83463,83476,83489,83496,83586-83587,83798,83814,83876,83891,83897,83902-83903,83979,83988-83989,83997-83998,84118,84228,84271,84343,84353,84392,84430,85377,85547,85555,85583,85803,85881,86065,86100,86121,86130,86142,86146,86182,86210,86257,86385,86394
/trunk/phase3/includes/includes/OutputPage.php:82474
+ /branches/REL1_15/phase3/includes/OutputPage.php:51646
/branches/resourceloader/phase3/includes/OutputPage.php:68366-69676,69678-70682,70684-71999,72001-72255,72257-72305,72307-72342
/branches/wmf-deployment/includes/OutputPage.php:53381,57468
/trunk/phase3/includes/OutputPage.php:78011-78012,78014-78016,78018,78043,78046,78071,78081,78083,78099,78117,78161,78170,78172,78199,78248,78393,78506-78507,78510-78511,78536,78539,78544,78565,78574,78660,78679,78774,78808,78886-78887,78926,78943,79013,79018-79019,79034,79072,79115,79122,79324,79561,79732,79839,80003,80005,80697,80755,80771,80773-80774,80779,80816,80833,80841,81430,81488,81496,81554,81561,81589,81600,81611,81620,81622,81640,81648,81650-81652,81731,82038-82039,82129,82155-82156,82181,82191,82200,82203,82215,82219,82221,82247,82253,82468,82474,82518,82530,82538,82547,82550,82565,82572,82608,82696,82748,82836,82853,82858,82871,82938,83005,83015,83046,83114,83153,83173,83270,83284,83374,83390,83392,83402-83403,83410-83411,83420,83461,83463,83476,83489,83496,83586-83587,83798,83814,83876,83891,83897,83902-83903,83979,83988-83989,83997-83998,84118,84228,84271,84343,84353,84392,84430,85377,85547,85555,85583,85803,85881,86065,86100,86121,86130,86142,86146,86182,86210,86257,86385,86394,87203,87265,87494,87497,87711,87840,88076,89615
/trunk/phase3/includes/includes/OutputPage.php:82474
Modified: branches/REL1_17/phase3/includes/installer/Installer.i18n.php
===================================================================
--- branches/REL1_17/phase3/includes/installer/Installer.i18n.php
2011-06-07 18:51:03 UTC (rev 89675)
+++ branches/REL1_17/phase3/includes/installer/Installer.i18n.php
2011-06-07 19:09:07 UTC (rev 89676)
@@ -155,6 +155,7 @@
'config-using531' => 'MediaWiki cannot be used with PHP
$1 due to a bug involving reference parameters to <code>__call()</code>.
Upgrade to PHP 5.3.2 or higher, or downgrade to PHP 5.3.0 to resolve this.
Installation aborted.',
+ 'config-suhosin-max-value-length' => "Suhosin is installed and limits
the GET parameter length to $1 bytes. MediaWiki's ResourceLoader component will
work around this limit, but that will degrade performance. If at all possible,
you should set suhosin.get.max_value_length to 1024 or higher in php.ini , and
set \$wgResourceLoaderMaxQueryLength to the same value in LocalSettings.php .",
'config-db-type' => 'Database type:',
'config-db-host' => 'Database host:',
'config-db-host-help' => 'If your database server is on
different server, enter the host name or IP address here.
Property changes on:
branches/REL1_17/phase3/includes/installer/Installer.i18n.php
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/REL1_15/phase3/includes/installer/Installer.i18n.php:51646
/branches/new-installer/phase3/includes/installer/Installer.i18n.php:43664-66004
/branches/sqlite/includes/installer/Installer.i18n.php:58211-58321
/branches/wmf-deployment/includes/installer/Installer.i18n.php:53381
/trunk/phase3/includes/installer/Installer.i18n.php:82845,82847-82848,84756,84875,84881-84882,84970,84976,87222,87423,88118,88124,88211,88498,88658,89099,89401,89451
+ /branches/REL1_15/phase3/includes/installer/Installer.i18n.php:51646
/branches/new-installer/phase3/includes/installer/Installer.i18n.php:43664-66004
/branches/sqlite/includes/installer/Installer.i18n.php:58211-58321
/branches/wmf-deployment/includes/installer/Installer.i18n.php:53381
/trunk/phase3/includes/installer/Installer.i18n.php:82247,82845,82847-82848,84756,84875,84881-84882,84970,84976,87203,87222,87265,87423,87494,87497,87711,87840,88076,88118,88124,88211,88498,88658,89099,89401,89451,89615
Modified: branches/REL1_17/phase3/includes/installer/Installer.php
===================================================================
--- branches/REL1_17/phase3/includes/installer/Installer.php 2011-06-07
18:51:03 UTC (rev 89675)
+++ branches/REL1_17/phase3/includes/installer/Installer.php 2011-06-07
19:09:07 UTC (rev 89676)
@@ -102,7 +102,8 @@
'envCheckExtension',
'envCheckShellLocale',
'envCheckUploadsDirectory',
- 'envCheckLibicu'
+ 'envCheckLibicu',
+ 'envCheckSuhosinMaxValueLength',
);
/**
@@ -140,6 +141,7 @@
'wgUseInstantCommons',
'wgUpgradeKey',
'wgDefaultSkin',
+ 'wgResourceLoaderMaxQueryLength',
);
/**
@@ -959,6 +961,21 @@
$this->showMessage( 'config-uploads-not-safe', $dir );
}
}
+
+ /**
+ * Checks if suhosin.get.max_value_length is set, and if so, sets
+ * $wgResourceLoaderMaxQueryLength to that value in the generated
+ * LocalSettings file
+ */
+ protected function envCheckSuhosinMaxValueLength() {
+ $maxValueLength = ini_get( 'suhosin.get.max_value_length' );
+ if ( $maxValueLength > 0 ) {
+ $this->showMessage( 'config-suhosin-max-value-length',
$maxValueLength );
+ } else {
+ $maxValueLength = -1;
+ }
+ $this->setVar( 'wgResourceLoaderMaxQueryLength',
$maxValueLength );
+ }
/**
* Convert a hex string representing a Unicode code point to that code
point.
Property changes on: branches/REL1_17/phase3/includes/installer/Installer.php
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/REL1_15/phase3/includes/installer/Installer.php:51646
/branches/new-installer/phase3/includes/installer/Installer.php:43664-66004
/branches/sqlite/includes/installer/Installer.php:58211-58321
/branches/wmf-deployment/includes/installer/Installer.php:53381
/trunk/phase3/includes/installer/Installer.php:81731,82038-82039,82845,82847-82848,84431,84464,84543,84553,84573-84574,84577,84579,84729,84755,84765,84820,84846,84875,84881-84882,84905,84970,84976,84985,85032,85140,85143,85152,85178,85194,85199,85377,85547,85555,85583,85803,85881,86065,86100,86121,86130,86142,86146,86182,86210,86257,86385,86394,87027,87222,88658
+ /branches/REL1_15/phase3/includes/installer/Installer.php:51646
/branches/new-installer/phase3/includes/installer/Installer.php:43664-66004
/branches/sqlite/includes/installer/Installer.php:58211-58321
/branches/wmf-deployment/includes/installer/Installer.php:53381
/trunk/phase3/includes/installer/Installer.php:81731,82038-82039,82247,82845,82847-82848,84431,84464,84543,84553,84573-84574,84577,84579,84729,84755,84765,84820,84846,84875,84881-84882,84905,84970,84976,84985,85032,85140,85143,85152,85178,85194,85199,85377,85547,85555,85583,85803,85881,86065,86100,86121,86130,86142,86146,86182,86210,86257,86385,86394,87027,87203,87222,87265,87494,87497,87711,87840,88076,88658,89615
Modified: branches/REL1_17/phase3/includes/installer/LocalSettingsGenerator.php
===================================================================
--- branches/REL1_17/phase3/includes/installer/LocalSettingsGenerator.php
2011-06-07 18:51:03 UTC (rev 89675)
+++ branches/REL1_17/phase3/includes/installer/LocalSettingsGenerator.php
2011-06-07 19:09:07 UTC (rev 89676)
@@ -47,7 +47,7 @@
'wgRightsText', 'wgRightsCode',
'wgMainCacheType', 'wgEnableUploads',
'wgMainCacheType', '_MemCachedServers',
'wgDBserver', 'wgDBuser',
'wgDBpassword', 'wgUseInstantCommons',
'wgUpgradeKey', 'wgDefaultSkin',
- 'wgMetaNamespace'
+ 'wgMetaNamespace',
'wgResourceLoaderMaxQueryLength'
),
$db->getGlobalNames()
);
@@ -336,7 +336,14 @@
# Path to the GNU diff3 utility. Used for conflict resolution.
\$wgDiff3 = \"{$this->values['wgDiff3']}\";
-{$groupRights}";
+{$groupRights}
+
+# Query string length limit for ResourceLoader. You should only set this if
+# your web server has a query string length limit (then set it to that limit),
+# or if you have suhosin.get.max_value_length set in php.ini (then set it to
+# that value)
+\$wgResourceLoaderMaxQueryLength =
{$this->values['wgResourceLoaderMaxQueryLength']};
+";
}
}
Modified: branches/REL1_17/phase3/includes/libs/CSSMin.php
===================================================================
--- branches/REL1_17/phase3/includes/libs/CSSMin.php 2011-06-07 18:51:03 UTC
(rev 89675)
+++ branches/REL1_17/phase3/includes/libs/CSSMin.php 2011-06-07 19:09:07 UTC
(rev 89676)
@@ -120,8 +120,9 @@
self::URL_REGEX . '(?P<post>[^;]*)[\;]?/';
$offset = 0;
while ( preg_match( $pattern, $source, $match,
PREG_OFFSET_CAPTURE, $offset ) ) {
- // Skip absolute URIs
- if ( preg_match( '/^https?:\/\//', $match['file'][0] )
) {
+ // Skip fully-qualified URLs and data URIs
+ $urlScheme = parse_url( $match['file'][0],
PHP_URL_SCHEME );
+ if ( $urlScheme ) {
// Move the offset to the end of the match,
leaving it alone
$offset = $match[0][1] + strlen( $match[0][0] );
continue;
Modified: branches/REL1_17/phase3/includes/resourceloader/ResourceLoader.php
===================================================================
--- branches/REL1_17/phase3/includes/resourceloader/ResourceLoader.php
2011-06-07 18:51:03 UTC (rev 89675)
+++ branches/REL1_17/phase3/includes/resourceloader/ResourceLoader.php
2011-06-07 19:09:07 UTC (rev 89676)
@@ -195,6 +195,7 @@
* this may also be a ResourceLoaderModule object. Optional when
using
* multiple-registration calling style.
* @throws MWException: If a duplicate module registration is attempted
+ * @throws MWException: If a module name contains illegal characters
(pipes or commas)
* @throws MWException: If something other than a ResourceLoaderModule
is being registered
* @return Boolean: False if there were any errors, in which case one
or more modules were not
* registered
@@ -219,6 +220,11 @@
'Another module has already been registered as
' . $name
);
}
+
+ // Check $name for illegal characters
+ if ( preg_match( '/[|,]/', $name ) ) {
+ throw new MWException( "ResourceLoader module name
'$name' is invalid. Names may not contain pipes (|) or commas (,)" );
+ }
// Attach module
if ( is_object( $info ) ) {
@@ -694,6 +700,33 @@
}
/**
+ * Convert an array of module names to a packed query string.
+ *
+ * For example, array( 'foo.bar', 'foo.baz', 'bar.baz', 'bar.quux' )
+ * becomes 'foo!bar,baz|bar!baz,quux'
+ * The ! is for IE6 being stupid with extensions.
+ * @param $modules array of module names (strings)
+ * @return string Packed query string
+ */
+ public static function makePackedModulesString( $modules ) {
+ $groups = array(); // array( prefix => array( suffixes ) )
+ foreach ( $modules as $module ) {
+ $pos = strrpos( $module, '.' );
+ $prefix = $pos === false ? '' : substr( $module, 0,
$pos );
+ $suffix = $pos === false ? $module : substr( $module,
$pos + 1 );
+ $groups[$prefix][] = $suffix;
+ }
+
+ $arr = array();
+ foreach ( $groups as $prefix => $suffixes ) {
+ $p = $prefix === '' ? '' : $prefix . '.';
+ $arr[] = $p . implode( ',', $suffixes );
+ }
+ $str = implode( '|', $arr );
+ return str_replace( ".", "!", $str ); # bug 28840
+ }
+
+ /**
* Determine whether debug mode was requested
* Order of priority is 1) request param, 2) cookie, 3) $wg setting
* @return bool
Property changes on:
branches/REL1_17/phase3/includes/resourceloader/ResourceLoader.php
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/REL1_15/phase3/includes/ResourceLoader.php:51646
/branches/new-installer/phase3/includes/ResourceLoader.php:43664-66004
/branches/resourceloader/phase3/includes/ResourceLoader.php:68366-69676,69678-71999,72001-72255,72257-72305,72307-72342
/branches/sqlite/includes/ResourceLoader.php:58211-58321
/branches/wmf-deployment/includes/ResourceLoader.php:53381
/trunk/phase3/includes/resourceloader/ResourceLoader.php:78011,78014-78016,78078,78099,78117,78161,78170,78172,78199,78248,78285,78393,78506-78507,78510-78511,78536,78539,78544,78565,78574,78660,78679,78774,78808,78886-78887,78924,78926,78943,79013,79018-79019,79034,79072,79115,79122,79246,79358,79480,79693,79732,79839,79862,79891,79900,80109,80113,80223,80475,80554,80575-80576,80583,80620,80656,80666,80842,80900,80913,80918-80920,80973-80974,80979,80993,81729,81765,81778,81812,81854,81890-81894,81896-81898,81900,81955,83885,83891,83897,83902-83903,83979,83988-83989,83997-83998,84118,84228,84271,84343,84353,84392,84430-84431,84464,84543,84553,84573-84574,84577,84579,84729,84765,84820,84846,84905,84985,85032,85140,85143,85152,85178,85194,85199
+ /branches/REL1_15/phase3/includes/ResourceLoader.php:51646
/branches/new-installer/phase3/includes/ResourceLoader.php:43664-66004
/branches/resourceloader/phase3/includes/ResourceLoader.php:68366-69676,69678-71999,72001-72255,72257-72305,72307-72342
/branches/sqlite/includes/ResourceLoader.php:58211-58321
/branches/wmf-deployment/includes/ResourceLoader.php:53381
/trunk/phase3/includes/resourceloader/ResourceLoader.php:78011,78014-78016,78078,78099,78117,78161,78170,78172,78199,78248,78285,78393,78506-78507,78510-78511,78536,78539,78544,78565,78574,78660,78679,78774,78808,78886-78887,78924,78926,78943,79013,79018-79019,79034,79072,79115,79122,79246,79358,79480,79693,79732,79839,79862,79891,79900,80109,80113,80223,80475,80554,80575-80576,80583,80620,80656,80666,80842,80900,80913,80918-80920,80973-80974,80979,80993,81729,81765,81778,81812,81854,81890-81894,81896-81898,81900,81955,82247,83885,83891,83897,83902-83903,83979,83988-83989,83997-83998,84118,84228,84271,84343,84353,84392,84430-84431,84464,84543,84553,84573-84574,84577,84579,84729,84765,84820,84846,84905,84985,85032,85140,85143,85152,85178,85194,85199,87203,87265,87494,87497,87711,87840,88076,89615
Modified:
branches/REL1_17/phase3/includes/resourceloader/ResourceLoaderContext.php
===================================================================
--- branches/REL1_17/phase3/includes/resourceloader/ResourceLoaderContext.php
2011-06-07 18:51:03 UTC (rev 89675)
+++ branches/REL1_17/phase3/includes/resourceloader/ResourceLoaderContext.php
2011-06-07 19:09:07 UTC (rev 89676)
@@ -51,7 +51,7 @@
// Interpret request
// List of modules
$modules = $request->getVal( 'modules' );
- $this->modules = $modules ? explode( '|', $modules ) :
array();
+ $this->modules = $modules ? self::expandModuleNames( $modules
) : array();
// Various parameters
$this->skin = $request->getVal( 'skin' );
$this->user = $request->getVal( 'user' );
@@ -63,6 +63,41 @@
$this->skin = $wgDefaultSkin;
}
}
+
+ /**
+ * Expand a string of the form jquery.foo,bar|jquery.ui.baz,quux to
+ * an array of module names like array( 'jquery.foo', 'jquery.bar',
+ * 'jquery.ui.baz', 'jquery.ui.quux' ) Also translating ! to .
+ * @param $modules String Packed module name list
+ * @return array of module names
+ */
+ public static function expandModuleNames( $modules ) {
+ $retval = array();
+ $modules = str_replace( "!", ".", $modules ); # bug 28840 - IE
is stupid.
+ $exploded = explode( '|', $modules );
+ foreach ( $exploded as $group ) {
+ if ( strpos( $group, ',' ) === false ) {
+ // This is not a set of modules in foo.bar,baz
notation
+ // but a single module
+ $retval[] = $group;
+ } else {
+ // This is a set of modules in foo.bar,baz
notation
+ $pos = strrpos( $group, '.' );
+ if ( $pos === false ) {
+ // Prefixless modules, i.e. without dots
+ $retval = explode( ',', $group );
+ } else {
+ // We have a prefix and a bunch of
suffixes
+ $prefix = substr( $group, 0, $pos ); //
'foo'
+ $suffixes = explode( ',', substr(
$group, $pos + 1 ) ); // array( 'bar', 'baz' )
+ foreach ( $suffixes as $suffix ) {
+ $retval[] = "$prefix.$suffix";
+ }
+ }
+ }
+ }
+ return $retval;
+ }
public function getResourceLoader() {
return $this->resourceLoader;
Modified:
branches/REL1_17/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php
===================================================================
---
branches/REL1_17/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php
2011-06-07 18:51:03 UTC (rev 89675)
+++
branches/REL1_17/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php
2011-06-07 19:09:07 UTC (rev 89676)
@@ -33,7 +33,8 @@
$wgArticlePath, $wgScriptPath, $wgServer, $wgContLang,
$wgVariantArticlePath, $wgActionPaths, $wgUseAjax,
$wgVersion,
$wgEnableAPI, $wgEnableWriteAPI, $wgDBname,
$wgEnableMWSuggest,
- $wgSitename, $wgFileExtensions;
+ $wgSitename, $wgFileExtensions, $wgExtensionAssetsPath,
+ $wgResourceLoaderMaxQueryLength;
// Pre-process information
$separatorTransTable = $wgContLang->separatorTransformTable();
@@ -77,6 +78,8 @@
'wgSiteName' => $wgSitename,
'wgFileExtensions' => array_values( $wgFileExtensions ),
'wgDBname' => $wgDBname,
+ 'wgExtensionAssetsPath' => $wgExtensionAssetsPath,
+ 'wgResourceLoaderMaxQueryLength' =>
$wgResourceLoaderMaxQueryLength,
);
if ( $wgContLang->hasVariants() ) {
$vars['wgUserVariant'] =
$wgContLang->getPreferredVariant();
Modified: branches/REL1_17/phase3/resources/Resources.php
===================================================================
--- branches/REL1_17/phase3/resources/Resources.php 2011-06-07 18:51:03 UTC
(rev 89675)
+++ branches/REL1_17/phase3/resources/Resources.php 2011-06-07 19:09:07 UTC
(rev 89676)
@@ -14,45 +14,45 @@
'skins.vector' => array(
'styles' => array( 'vector/screen.css' => array( 'media' =>
'screen' ) ),
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins"
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
),
'skins.monobook' => array(
'styles' => array(
'monobook/main.css' => array( 'media' => 'screen' ),
),
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins"
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
),
'skins.simple' => array(
'styles' => array( 'simple/main.css' => array( 'media' =>
'screen' ) ),
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins"
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
),
'skins.chick' => array(
'styles' => array( 'chick/main.css' => array( 'media' =>
'screen,handheld' ) ),
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins"
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
),
'skins.modern' => array(
'styles' => array( 'modern/main.css' => array( 'media' =>
'screen' ),
'modern/print.css' => array( 'media' =>
'print' ) ),
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins"
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
),
'skins.cologneblue' => array(
'styles' => array( 'common/cologneblue.css' => array( 'media'
=> 'screen' ) ),
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins"
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
),
'skins.nostalgia' => array(
'styles' => array( 'common/nostalgia.css' => array( 'media' =>
'screen' ) ),
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins"
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
),
'skins.standard' => array(
'styles' => array( 'common/wikistandard.css' => array( 'media'
=> 'screen' ) ),
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins"
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
),
/* jQuery */
@@ -447,7 +447,7 @@
'mediawiki.legacy.ajax' => array(
'scripts' => 'common/ajax.js',
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins",
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
'messages' => array(
'watch', 'unwatch', 'watching', 'unwatching',
'tooltip-ca-watch',
'tooltip-ca-unwatch'
@@ -455,25 +455,27 @@
'dependencies' => 'mediawiki.legacy.wikibits',
),
'mediawiki.legacy.ajaxwatch' => array(
- 'scripts' => 'skins/common/ajaxwatch.js',
+ 'scripts' => 'common/ajaxwatch.js',
+ 'remoteBasePath' => $GLOBALS['wgStylePath'],
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
'dependencies' => 'mediawiki.legacy.wikibits',
),
'mediawiki.legacy.block' => array(
'scripts' => 'common/block.js',
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins",
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
'dependencies' => 'mediawiki.legacy.wikibits',
),
'mediawiki.legacy.commonPrint' => array(
'styles' => array( 'common/commonPrint.css' => array( 'media'
=> 'print' ) ),
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins",
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
),
'mediawiki.legacy.config' => array(
'scripts' => 'common/config.js',
'styles' => array( 'common/config.css', 'common/config-cc.css'
),
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins",
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
'dependencies' => 'mediawiki.legacy.wikibits',
),
'mediawiki.legacy.diff' => array(
@@ -481,103 +483,105 @@
'styles' => 'common/diff.css',
'group' => 'mediawiki.action.history',
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins",
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
'dependencies' => 'mediawiki.legacy.wikibits',
),
'mediawiki.legacy.edit' => array(
'scripts' => 'common/edit.js',
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins",
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
'dependencies' => 'mediawiki.legacy.wikibits',
),
'mediawiki.legacy.enhancedchanges' => array(
- 'scripts' => 'skins/common/enhancedchanges.js',
+ 'scripts' => 'common/enhancedchanges.js',
+ 'remoteBasePath' => $GLOBALS['wgStylePath'],
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
'dependencies' => 'mediawiki.legacy.wikibits',
),
'mediawiki.legacy.history' => array(
'scripts' => 'common/history.js',
'group' => 'mediawiki.action.history',
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins",
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
'dependencies' => 'mediawiki.legacy.wikibits',
),
'mediawiki.legacy.htmlform' => array(
'scripts' => 'common/htmlform.js',
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins",
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
'dependencies' => 'mediawiki.legacy.wikibits',
),
'mediawiki.legacy.IEFixes' => array(
'scripts' => 'common/IEFixes.js',
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins",
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
'dependencies' => 'mediawiki.legacy.wikibits',
),
'mediawiki.legacy.metadata' => array(
'scripts' => 'common/metadata.js',
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins",
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
'dependencies' => 'mediawiki.legacy.wikibits',
'messages' => array( 'metadata-expand', 'metadata-collapse' ),
),
'mediawiki.legacy.mwsuggest' => array(
'scripts' => 'common/mwsuggest.js',
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins",
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
'dependencies' => 'mediawiki.legacy.wikibits',
'messages' => array( 'search-mwsuggest-enabled',
'search-mwsuggest-disabled' ),
),
'mediawiki.legacy.prefs' => array(
'scripts' => 'common/prefs.js',
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins",
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
'dependencies' => array( 'mediawiki.legacy.wikibits',
'mediawiki.legacy.htmlform' ),
),
'mediawiki.legacy.preview' => array(
'scripts' => 'common/preview.js',
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins",
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
'dependencies' => 'mediawiki.legacy.wikibits',
),
'mediawiki.legacy.protect' => array(
'scripts' => 'common/protect.js',
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins",
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
'dependencies' => 'mediawiki.legacy.wikibits',
),
'mediawiki.legacy.search' => array(
'scripts' => 'common/search.js',
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins",
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
'styles' => 'common/search.css',
'dependencies' => 'mediawiki.legacy.wikibits',
),
'mediawiki.legacy.shared' => array(
'styles' => array( 'common/shared.css' => array( 'media' =>
'screen' ) ),
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins"
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
),
'mediawiki.legacy.oldshared' => array(
'styles' => array( 'common/oldshared.css' => array( 'media' =>
'screen' ) ),
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins"
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
),
'mediawiki.legacy.upload' => array(
'scripts' => 'common/upload.js',
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins",
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
'dependencies' => 'mediawiki.legacy.wikibits',
),
'mediawiki.legacy.wikibits' => array(
'scripts' => 'common/wikibits.js',
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins",
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
'dependencies' => 'mediawiki.language',
'messages' => array( 'showtoc', 'hidetoc' ),
),
'mediawiki.legacy.wikiprintable' => array(
'styles' => array( 'common/wikiprintable.css' => array( 'media'
=> 'print' ) ),
'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins"
+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
),
);
Property changes on: branches/REL1_17/phase3/resources/Resources.php
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/REL1_15/phase3/resources/Resources.php:51646
/branches/new-installer/phase3/resources/Resources.php:43664-66004
/branches/sqlite/resources/Resources.php:58211-58321
/trunk/phase3/includes/Sanitizer.php:78344,78893,78897,78909
/trunk/phase3/resources/Resources.php:78108,78179,78344,78347,78350,78365,78380,78425,78539,78886,78893,78897,78909,78964,79086-79087,79091,79828,79830,79848,79853,79950-79951,79954,79989,80006-80007,80013,80016,80080,80083,80124,80128,80238,81657,81719,81722,81833,82200,82721,82845,82847-82849,87423,88118,88124,88211,88498,89099,89401,89451
+ /branches/REL1_15/phase3/resources/Resources.php:51646
/branches/new-installer/phase3/resources/Resources.php:43664-66004
/branches/sqlite/resources/Resources.php:58211-58321
/trunk/phase3/includes/Sanitizer.php:78344,78893,78897,78909
/trunk/phase3/resources/Resources.php:78108,78179,78344,78347,78350,78365,78380,78425,78539,78886,78893,78897,78909,78964,79086-79087,79091,79828,79830,79848,79853,79950-79951,79954,79989,80006-80007,80013,80016,80080,80083,80124,80128,80238,81657,81719,81722,81833,82200,82721,82845,82847-82849,87423,87711,87840,88076,88118,88124,88211,88498,89099,89401,89451,89615
Modified: branches/REL1_17/phase3/resources/mediawiki/mediawiki.js
===================================================================
--- branches/REL1_17/phase3/resources/mediawiki/mediawiki.js 2011-06-07
18:51:03 UTC (rev 89675)
+++ branches/REL1_17/phase3/resources/mediawiki/mediawiki.js 2011-06-07
19:09:07 UTC (rev 89676)
@@ -675,6 +675,20 @@
}
return sorted;
}
+
+ /**
+ * Converts a module map of the form { foo: [ 'bar', 'baz' ],
bar: [ 'baz, 'quux' ] }
+ * to a query string of the form foo.bar,baz|bar.baz,quux
+ */
+ function buildModulesString( moduleMap ) {
+ var arr = [];
+ for ( var prefix in moduleMap ) {
+ var p = prefix === '' ? '' : prefix + '.';
+ arr.push( p + moduleMap[prefix].join( ',' ) );
+ }
+ return arr.join( '|' ).replace( /\./g, '!' );
+ }
+
/* Public Methods */
@@ -728,9 +742,44 @@
version =
registry[groups[group][g]].version;
}
}
- requests[requests.length] = $.extend(
- { 'modules':
groups[group].join( '|' ), 'version': formatVersionNumber( version ) }, base
- );
+ var reqBase = $.extend( { 'version':
formatVersionNumber( version ) }, base );
+ var reqBaseLength = $.param( reqBase
).length;
+ var reqs = [];
+ var limit = mw.config.get(
'wgResourceLoaderMaxQueryLength', -1 );
+ // We may need to split up the request
to honor the query string length limit
+ // So build it piece by piece
+ var l = reqBaseLength + 9; //
'&modules='.length == 9
+ var r = 0;
+ reqs[0] = {}; // { prefix: [ suffixes ]
}
+ for ( var i = 0; i <
groups[group].length; i++ ) {
+ // Determine how many bytes
this module would add to the query string
+ var lastDotIndex =
groups[group][i].lastIndexOf( '.' );
+ // Note that these substr()
calls work even if lastDotIndex == -1
+ var prefix =
groups[group][i].substr( 0, lastDotIndex );
+ var suffix =
groups[group][i].substr( lastDotIndex + 1 );
+ var bytesAdded = prefix in
reqs[r] ?
+ suffix.length + 3 : //
'%2C'.length == 3
+ groups[group][i].length
+ 3; // '%7C'.length == 3
+
+ // If the request would become
too long, create a new one,
+ // but don't create empty
requests
+ if ( limit > 0 && reqs[r] !=
{} && l + bytesAdded > limit ) {
+ // This request would
become too long, create a new one
+ r++;
+ reqs[r] = {};
+ l = reqBaseLength + 9;
+ }
+ if ( !( prefix in reqs[r] ) ) {
+ reqs[r][prefix] = [];
+ }
+ reqs[r][prefix].push( suffix );
+ l += bytesAdded;
+ }
+ for ( var r = 0; r < reqs.length; r++ )
{
+ requests[requests.length] =
$.extend(
+ { 'modules':
buildModulesString( reqs[r] ) }, reqBase
+ );
+ }
}
// Clear the batch - this MUST happen before we
append the
// script element to the body or it's possible
that the script
Property changes on: branches/REL1_17/phase3/resources/mediawiki/mediawiki.js
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/REL1_15/phase3/resources/mediawiki/mediawiki.js:51646
/branches/new-installer/phase3/resources/mediawiki/mediawiki.js:43664-66004
/branches/sqlite/resources/mediawiki/mediawiki.js:58211-58321
/trunk/phase3/resources/mediawiki/mediawiki.js:78078,78108,78179,78285,78344,78347,78350,78365,78380,78425,78539,78886,78893,78897,78909,78943,78964,79086-79087,79091,79246,79358,79480,79915,79957,79960,79964,79990,80034,80036,80043-80044,80050,80053,80074-80077,80104,80112,80116,80119-80120,80687,80999,81006,81011,81101,81105,81138,81141,81146,81149-81150,81166,81171,82518,82530,82538,82547,82550,82565,82572,82608,82696,82748,82836,82853,82858,82871,82938,83005,83015,83046,83114,83153,83173,83270,83284,83374,83390,83392,83402-83403,83410-83411,83420,83461,83463,83476,83489,83496,83586-83587,83798,83814,83876,85546,86450,86625,86841,86904,86973,87030
+ /branches/REL1_15/phase3/resources/mediawiki/mediawiki.js:51646
/branches/new-installer/phase3/resources/mediawiki/mediawiki.js:43664-66004
/branches/sqlite/resources/mediawiki/mediawiki.js:58211-58321
/trunk/phase3/resources/mediawiki/mediawiki.js:78078,78108,78179,78285,78344,78347,78350,78365,78380,78425,78539,78886,78893,78897,78909,78943,78964,79086-79087,79091,79246,79358,79480,79915,79957,79960,79964,79990,80034,80036,80043-80044,80050,80053,80074-80077,80104,80112,80116,80119-80120,80687,80999,81006,81011,81101,81105,81138,81141,81146,81149-81150,81166,81171,82247,82518,82530,82538,82547,82550,82565,82572,82608,82696,82748,82836,82853,82858,82871,82938,83005,83015,83046,83114,83153,83173,83270,83284,83374,83390,83392,83402-83403,83410-83411,83420,83461,83463,83476,83489,83496,83586-83587,83798,83814,83876,85546,86450,86625,86841,86904,86973,87030,87203,87265,87494,87497,87711,87840,88076,89615
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs