Index: branches/REL1_17/phase3/includes/OutputPage.php |
— | — | @@ -2338,7 +2338,6 @@ |
2339 | 2339 | $wgResourceLoaderInlinePrivateModules, $wgRequest; |
2340 | 2340 | // Lazy-load ResourceLoader |
2341 | 2341 | // TODO: Should this be a static function of ResourceLoader instead? |
2342 | | - // TODO: Divide off modules starting with "user", and add the user parameter to them |
2343 | 2342 | $baseQuery = array( |
2344 | 2343 | 'lang' => $wgLang->getCode(), |
2345 | 2344 | 'debug' => ResourceLoader::inDebugMode() ? 'true' : 'false', |
— | — | @@ -2407,7 +2406,7 @@ |
2408 | 2407 | continue; |
2409 | 2408 | } |
2410 | 2409 | |
2411 | | - $query['modules'] = implode( '|', array_keys( $modules ) ); |
| 2410 | + $query['modules'] = ResourceLoader::makePackedModulesString( array_keys( $modules ) ); |
2412 | 2411 | |
2413 | 2412 | // Support inlining of private modules if configured as such |
2414 | 2413 | if ( $group === 'private' && $wgResourceLoaderInlinePrivateModules ) { |
— | — | @@ -2442,6 +2441,9 @@ |
2443 | 2442 | ksort( $query ); |
2444 | 2443 | |
2445 | 2444 | $url = wfAppendQuery( $wgLoadScript, $query ); |
| 2445 | + // Prevent the IE6 extension check from being triggered (bug 28840) |
| 2446 | + // by appending a character that's invalid in Windows extensions ('*') |
| 2447 | + $url .= '&*'; |
2446 | 2448 | if ( $useESI && $wgResourceLoaderUseESI ) { |
2447 | 2449 | $esi = Xml::element( 'esi:include', array( 'src' => $url ) ); |
2448 | 2450 | if ( $only == 'styles' ) { |
— | — | @@ -2452,9 +2454,9 @@ |
2453 | 2455 | } else { |
2454 | 2456 | // Automatically select style/script elements |
2455 | 2457 | if ( $only === 'styles' ) { |
2456 | | - $links .= Html::linkedStyle( wfAppendQuery( $wgLoadScript, $query ) ) . "\n"; |
| 2458 | + $links .= Html::linkedStyle( $url ) . "\n"; |
2457 | 2459 | } else { |
2458 | | - $links .= Html::linkedScript( wfAppendQuery( $wgLoadScript, $query ) ) . "\n"; |
| 2460 | + $links .= Html::linkedScript( $url ) . "\n"; |
2459 | 2461 | } |
2460 | 2462 | } |
2461 | 2463 | } |
Property changes on: branches/REL1_17/phase3/includes/OutputPage.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
2462 | 2464 | Merged /trunk/phase3/includes/OutputPage.php:r82247,87203,87265,87494,87497,87711,87840,88076,89615 |
Index: branches/REL1_17/phase3/includes/installer/Installer.php |
— | — | @@ -102,7 +102,8 @@ |
103 | 103 | 'envCheckExtension', |
104 | 104 | 'envCheckShellLocale', |
105 | 105 | 'envCheckUploadsDirectory', |
106 | | - 'envCheckLibicu' |
| 106 | + 'envCheckLibicu', |
| 107 | + 'envCheckSuhosinMaxValueLength', |
107 | 108 | ); |
108 | 109 | |
109 | 110 | /** |
— | — | @@ -140,6 +141,7 @@ |
141 | 142 | 'wgUseInstantCommons', |
142 | 143 | 'wgUpgradeKey', |
143 | 144 | 'wgDefaultSkin', |
| 145 | + 'wgResourceLoaderMaxQueryLength', |
144 | 146 | ); |
145 | 147 | |
146 | 148 | /** |
— | — | @@ -959,6 +961,21 @@ |
960 | 962 | $this->showMessage( 'config-uploads-not-safe', $dir ); |
961 | 963 | } |
962 | 964 | } |
| 965 | + |
| 966 | + /** |
| 967 | + * Checks if suhosin.get.max_value_length is set, and if so, sets |
| 968 | + * $wgResourceLoaderMaxQueryLength to that value in the generated |
| 969 | + * LocalSettings file |
| 970 | + */ |
| 971 | + protected function envCheckSuhosinMaxValueLength() { |
| 972 | + $maxValueLength = ini_get( 'suhosin.get.max_value_length' ); |
| 973 | + if ( $maxValueLength > 0 ) { |
| 974 | + $this->showMessage( 'config-suhosin-max-value-length', $maxValueLength ); |
| 975 | + } else { |
| 976 | + $maxValueLength = -1; |
| 977 | + } |
| 978 | + $this->setVar( 'wgResourceLoaderMaxQueryLength', $maxValueLength ); |
| 979 | + } |
963 | 980 | |
964 | 981 | /** |
965 | 982 | * 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 |
966 | 983 | Merged /trunk/phase3/includes/installer/Installer.php:r82247,87203,87265,87494,87497,87711,87840,88076,89615 |
Index: branches/REL1_17/phase3/includes/installer/Installer.i18n.php |
— | — | @@ -155,6 +155,7 @@ |
156 | 156 | 'config-using531' => 'MediaWiki cannot be used with PHP $1 due to a bug involving reference parameters to <code>__call()</code>. |
157 | 157 | Upgrade to PHP 5.3.2 or higher, or downgrade to PHP 5.3.0 to resolve this. |
158 | 158 | Installation aborted.', |
| 159 | + '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 .", |
159 | 160 | 'config-db-type' => 'Database type:', |
160 | 161 | 'config-db-host' => 'Database host:', |
161 | 162 | '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 |
162 | 163 | Merged /trunk/phase3/includes/installer/Installer.i18n.php:r82247,87203,87265,87494,87497,87711,87840,88076,89615 |
Index: branches/REL1_17/phase3/includes/installer/LocalSettingsGenerator.php |
— | — | @@ -47,7 +47,7 @@ |
48 | 48 | 'wgRightsText', 'wgRightsCode', 'wgMainCacheType', 'wgEnableUploads', |
49 | 49 | 'wgMainCacheType', '_MemCachedServers', 'wgDBserver', 'wgDBuser', |
50 | 50 | 'wgDBpassword', 'wgUseInstantCommons', 'wgUpgradeKey', 'wgDefaultSkin', |
51 | | - 'wgMetaNamespace' |
| 51 | + 'wgMetaNamespace', 'wgResourceLoaderMaxQueryLength' |
52 | 52 | ), |
53 | 53 | $db->getGlobalNames() |
54 | 54 | ); |
— | — | @@ -336,7 +336,14 @@ |
337 | 337 | # Path to the GNU diff3 utility. Used for conflict resolution. |
338 | 338 | \$wgDiff3 = \"{$this->values['wgDiff3']}\"; |
339 | 339 | |
340 | | -{$groupRights}"; |
| 340 | +{$groupRights} |
| 341 | + |
| 342 | +# Query string length limit for ResourceLoader. You should only set this if |
| 343 | +# your web server has a query string length limit (then set it to that limit), |
| 344 | +# or if you have suhosin.get.max_value_length set in php.ini (then set it to |
| 345 | +# that value) |
| 346 | +\$wgResourceLoaderMaxQueryLength = {$this->values['wgResourceLoaderMaxQueryLength']}; |
| 347 | +"; |
341 | 348 | } |
342 | 349 | |
343 | 350 | } |
Index: branches/REL1_17/phase3/includes/resourceloader/ResourceLoader.php |
— | — | @@ -195,6 +195,7 @@ |
196 | 196 | * this may also be a ResourceLoaderModule object. Optional when using |
197 | 197 | * multiple-registration calling style. |
198 | 198 | * @throws MWException: If a duplicate module registration is attempted |
| 199 | + * @throws MWException: If a module name contains illegal characters (pipes or commas) |
199 | 200 | * @throws MWException: If something other than a ResourceLoaderModule is being registered |
200 | 201 | * @return Boolean: False if there were any errors, in which case one or more modules were not |
201 | 202 | * registered |
— | — | @@ -219,6 +220,11 @@ |
220 | 221 | 'Another module has already been registered as ' . $name |
221 | 222 | ); |
222 | 223 | } |
| 224 | + |
| 225 | + // Check $name for illegal characters |
| 226 | + if ( preg_match( '/[|,]/', $name ) ) { |
| 227 | + throw new MWException( "ResourceLoader module name '$name' is invalid. Names may not contain pipes (|) or commas (,)" ); |
| 228 | + } |
223 | 229 | |
224 | 230 | // Attach module |
225 | 231 | if ( is_object( $info ) ) { |
— | — | @@ -694,6 +700,33 @@ |
695 | 701 | } |
696 | 702 | |
697 | 703 | /** |
| 704 | + * Convert an array of module names to a packed query string. |
| 705 | + * |
| 706 | + * For example, array( 'foo.bar', 'foo.baz', 'bar.baz', 'bar.quux' ) |
| 707 | + * becomes 'foo!bar,baz|bar!baz,quux' |
| 708 | + * The ! is for IE6 being stupid with extensions. |
| 709 | + * @param $modules array of module names (strings) |
| 710 | + * @return string Packed query string |
| 711 | + */ |
| 712 | + public static function makePackedModulesString( $modules ) { |
| 713 | + $groups = array(); // array( prefix => array( suffixes ) ) |
| 714 | + foreach ( $modules as $module ) { |
| 715 | + $pos = strrpos( $module, '.' ); |
| 716 | + $prefix = $pos === false ? '' : substr( $module, 0, $pos ); |
| 717 | + $suffix = $pos === false ? $module : substr( $module, $pos + 1 ); |
| 718 | + $groups[$prefix][] = $suffix; |
| 719 | + } |
| 720 | + |
| 721 | + $arr = array(); |
| 722 | + foreach ( $groups as $prefix => $suffixes ) { |
| 723 | + $p = $prefix === '' ? '' : $prefix . '.'; |
| 724 | + $arr[] = $p . implode( ',', $suffixes ); |
| 725 | + } |
| 726 | + $str = implode( '|', $arr ); |
| 727 | + return str_replace( ".", "!", $str ); # bug 28840 |
| 728 | + } |
| 729 | + |
| 730 | + /** |
698 | 731 | * Determine whether debug mode was requested |
699 | 732 | * Order of priority is 1) request param, 2) cookie, 3) $wg setting |
700 | 733 | * @return bool |
Property changes on: branches/REL1_17/phase3/includes/resourceloader/ResourceLoader.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
701 | 734 | Merged /trunk/phase3/includes/resourceloader/ResourceLoader.php:r82247,87203,87265,87494,87497,87711,87840,88076,89615 |
Index: branches/REL1_17/phase3/includes/resourceloader/ResourceLoaderContext.php |
— | — | @@ -51,7 +51,7 @@ |
52 | 52 | // Interpret request |
53 | 53 | // List of modules |
54 | 54 | $modules = $request->getVal( 'modules' ); |
55 | | - $this->modules = $modules ? explode( '|', $modules ) : array(); |
| 55 | + $this->modules = $modules ? self::expandModuleNames( $modules ) : array(); |
56 | 56 | // Various parameters |
57 | 57 | $this->skin = $request->getVal( 'skin' ); |
58 | 58 | $this->user = $request->getVal( 'user' ); |
— | — | @@ -63,6 +63,41 @@ |
64 | 64 | $this->skin = $wgDefaultSkin; |
65 | 65 | } |
66 | 66 | } |
| 67 | + |
| 68 | + /** |
| 69 | + * Expand a string of the form jquery.foo,bar|jquery.ui.baz,quux to |
| 70 | + * an array of module names like array( 'jquery.foo', 'jquery.bar', |
| 71 | + * 'jquery.ui.baz', 'jquery.ui.quux' ) Also translating ! to . |
| 72 | + * @param $modules String Packed module name list |
| 73 | + * @return array of module names |
| 74 | + */ |
| 75 | + public static function expandModuleNames( $modules ) { |
| 76 | + $retval = array(); |
| 77 | + $modules = str_replace( "!", ".", $modules ); # bug 28840 - IE is stupid. |
| 78 | + $exploded = explode( '|', $modules ); |
| 79 | + foreach ( $exploded as $group ) { |
| 80 | + if ( strpos( $group, ',' ) === false ) { |
| 81 | + // This is not a set of modules in foo.bar,baz notation |
| 82 | + // but a single module |
| 83 | + $retval[] = $group; |
| 84 | + } else { |
| 85 | + // This is a set of modules in foo.bar,baz notation |
| 86 | + $pos = strrpos( $group, '.' ); |
| 87 | + if ( $pos === false ) { |
| 88 | + // Prefixless modules, i.e. without dots |
| 89 | + $retval = explode( ',', $group ); |
| 90 | + } else { |
| 91 | + // We have a prefix and a bunch of suffixes |
| 92 | + $prefix = substr( $group, 0, $pos ); // 'foo' |
| 93 | + $suffixes = explode( ',', substr( $group, $pos + 1 ) ); // array( 'bar', 'baz' ) |
| 94 | + foreach ( $suffixes as $suffix ) { |
| 95 | + $retval[] = "$prefix.$suffix"; |
| 96 | + } |
| 97 | + } |
| 98 | + } |
| 99 | + } |
| 100 | + return $retval; |
| 101 | + } |
67 | 102 | |
68 | 103 | public function getResourceLoader() { |
69 | 104 | return $this->resourceLoader; |
Index: branches/REL1_17/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php |
— | — | @@ -33,7 +33,8 @@ |
34 | 34 | $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, |
35 | 35 | $wgVariantArticlePath, $wgActionPaths, $wgUseAjax, $wgVersion, |
36 | 36 | $wgEnableAPI, $wgEnableWriteAPI, $wgDBname, $wgEnableMWSuggest, |
37 | | - $wgSitename, $wgFileExtensions; |
| 37 | + $wgSitename, $wgFileExtensions, $wgExtensionAssetsPath, |
| 38 | + $wgResourceLoaderMaxQueryLength; |
38 | 39 | |
39 | 40 | // Pre-process information |
40 | 41 | $separatorTransTable = $wgContLang->separatorTransformTable(); |
— | — | @@ -77,6 +78,8 @@ |
78 | 79 | 'wgSiteName' => $wgSitename, |
79 | 80 | 'wgFileExtensions' => array_values( $wgFileExtensions ), |
80 | 81 | 'wgDBname' => $wgDBname, |
| 82 | + 'wgExtensionAssetsPath' => $wgExtensionAssetsPath, |
| 83 | + 'wgResourceLoaderMaxQueryLength' => $wgResourceLoaderMaxQueryLength, |
81 | 84 | ); |
82 | 85 | if ( $wgContLang->hasVariants() ) { |
83 | 86 | $vars['wgUserVariant'] = $wgContLang->getPreferredVariant(); |
Index: branches/REL1_17/phase3/includes/libs/CSSMin.php |
— | — | @@ -120,8 +120,9 @@ |
121 | 121 | self::URL_REGEX . '(?P<post>[^;]*)[\;]?/'; |
122 | 122 | $offset = 0; |
123 | 123 | while ( preg_match( $pattern, $source, $match, PREG_OFFSET_CAPTURE, $offset ) ) { |
124 | | - // Skip absolute URIs |
125 | | - if ( preg_match( '/^https?:\/\//', $match['file'][0] ) ) { |
| 124 | + // Skip fully-qualified URLs and data URIs |
| 125 | + $urlScheme = parse_url( $match['file'][0], PHP_URL_SCHEME ); |
| 126 | + if ( $urlScheme ) { |
126 | 127 | // Move the offset to the end of the match, leaving it alone |
127 | 128 | $offset = $match[0][1] + strlen( $match[0][0] ); |
128 | 129 | continue; |
Index: branches/REL1_17/phase3/includes/DefaultSettings.php |
— | — | @@ -2452,6 +2452,19 @@ |
2453 | 2453 | */ |
2454 | 2454 | $wgIncludeLegacyJavaScript = true; |
2455 | 2455 | |
| 2456 | +/** |
| 2457 | + * If set to a positive number, ResourceLoader will not generate URLs whose |
| 2458 | + * query string is more than this many characters long, and will instead use |
| 2459 | + * multiple requests with shorter query strings. This degrades performance, |
| 2460 | + * but may be needed if your web server has a low (less than, say 1024) |
| 2461 | + * query string length limit or a low value for suhosin.get.max_value_length |
| 2462 | + * that you can't increase. |
| 2463 | + * |
| 2464 | + * If set to a negative number, ResourceLoader will assume there is no query |
| 2465 | + * string length limit. |
| 2466 | + */ |
| 2467 | +$wgResourceLoaderMaxQueryLength = -1; |
| 2468 | + |
2456 | 2469 | /** @} */ # End of resource loader settings } |
2457 | 2470 | |
2458 | 2471 | |
Property changes on: branches/REL1_17/phase3/includes/DefaultSettings.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
2459 | 2472 | Merged /trunk/phase3/includes/DefaultSettings.php:r82247,87203,87265,87494,87497,87711,87840,88076,89615 |
Index: branches/REL1_17/phase3/resources/Resources.php |
— | — | @@ -14,45 +14,45 @@ |
15 | 15 | 'skins.vector' => array( |
16 | 16 | 'styles' => array( 'vector/screen.css' => array( 'media' => 'screen' ) ), |
17 | 17 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
18 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins" |
| 18 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
19 | 19 | ), |
20 | 20 | 'skins.monobook' => array( |
21 | 21 | 'styles' => array( |
22 | 22 | 'monobook/main.css' => array( 'media' => 'screen' ), |
23 | 23 | ), |
24 | 24 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
25 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins" |
| 25 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
26 | 26 | ), |
27 | 27 | 'skins.simple' => array( |
28 | 28 | 'styles' => array( 'simple/main.css' => array( 'media' => 'screen' ) ), |
29 | 29 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
30 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins" |
| 30 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
31 | 31 | ), |
32 | 32 | 'skins.chick' => array( |
33 | 33 | 'styles' => array( 'chick/main.css' => array( 'media' => 'screen,handheld' ) ), |
34 | 34 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
35 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins" |
| 35 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
36 | 36 | ), |
37 | 37 | 'skins.modern' => array( |
38 | 38 | 'styles' => array( 'modern/main.css' => array( 'media' => 'screen' ), |
39 | 39 | 'modern/print.css' => array( 'media' => 'print' ) ), |
40 | 40 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
41 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins" |
| 41 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
42 | 42 | ), |
43 | 43 | 'skins.cologneblue' => array( |
44 | 44 | 'styles' => array( 'common/cologneblue.css' => array( 'media' => 'screen' ) ), |
45 | 45 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
46 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins" |
| 46 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
47 | 47 | ), |
48 | 48 | 'skins.nostalgia' => array( |
49 | 49 | 'styles' => array( 'common/nostalgia.css' => array( 'media' => 'screen' ) ), |
50 | 50 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
51 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins" |
| 51 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
52 | 52 | ), |
53 | 53 | 'skins.standard' => array( |
54 | 54 | 'styles' => array( 'common/wikistandard.css' => array( 'media' => 'screen' ) ), |
55 | 55 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
56 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins" |
| 56 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
57 | 57 | ), |
58 | 58 | |
59 | 59 | /* jQuery */ |
— | — | @@ -447,7 +447,7 @@ |
448 | 448 | 'mediawiki.legacy.ajax' => array( |
449 | 449 | 'scripts' => 'common/ajax.js', |
450 | 450 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
451 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins", |
| 451 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
452 | 452 | 'messages' => array( |
453 | 453 | 'watch', 'unwatch', 'watching', 'unwatching', 'tooltip-ca-watch', |
454 | 454 | 'tooltip-ca-unwatch' |
— | — | @@ -455,25 +455,27 @@ |
456 | 456 | 'dependencies' => 'mediawiki.legacy.wikibits', |
457 | 457 | ), |
458 | 458 | 'mediawiki.legacy.ajaxwatch' => array( |
459 | | - 'scripts' => 'skins/common/ajaxwatch.js', |
| 459 | + 'scripts' => 'common/ajaxwatch.js', |
| 460 | + 'remoteBasePath' => $GLOBALS['wgStylePath'], |
| 461 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
460 | 462 | 'dependencies' => 'mediawiki.legacy.wikibits', |
461 | 463 | ), |
462 | 464 | 'mediawiki.legacy.block' => array( |
463 | 465 | 'scripts' => 'common/block.js', |
464 | 466 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
465 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins", |
| 467 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
466 | 468 | 'dependencies' => 'mediawiki.legacy.wikibits', |
467 | 469 | ), |
468 | 470 | 'mediawiki.legacy.commonPrint' => array( |
469 | 471 | 'styles' => array( 'common/commonPrint.css' => array( 'media' => 'print' ) ), |
470 | 472 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
471 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins", |
| 473 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
472 | 474 | ), |
473 | 475 | 'mediawiki.legacy.config' => array( |
474 | 476 | 'scripts' => 'common/config.js', |
475 | 477 | 'styles' => array( 'common/config.css', 'common/config-cc.css' ), |
476 | 478 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
477 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins", |
| 479 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
478 | 480 | 'dependencies' => 'mediawiki.legacy.wikibits', |
479 | 481 | ), |
480 | 482 | 'mediawiki.legacy.diff' => array( |
— | — | @@ -481,103 +483,105 @@ |
482 | 484 | 'styles' => 'common/diff.css', |
483 | 485 | 'group' => 'mediawiki.action.history', |
484 | 486 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
485 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins", |
| 487 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
486 | 488 | 'dependencies' => 'mediawiki.legacy.wikibits', |
487 | 489 | ), |
488 | 490 | 'mediawiki.legacy.edit' => array( |
489 | 491 | 'scripts' => 'common/edit.js', |
490 | 492 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
491 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins", |
| 493 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
492 | 494 | 'dependencies' => 'mediawiki.legacy.wikibits', |
493 | 495 | ), |
494 | 496 | 'mediawiki.legacy.enhancedchanges' => array( |
495 | | - 'scripts' => 'skins/common/enhancedchanges.js', |
| 497 | + 'scripts' => 'common/enhancedchanges.js', |
| 498 | + 'remoteBasePath' => $GLOBALS['wgStylePath'], |
| 499 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
496 | 500 | 'dependencies' => 'mediawiki.legacy.wikibits', |
497 | 501 | ), |
498 | 502 | 'mediawiki.legacy.history' => array( |
499 | 503 | 'scripts' => 'common/history.js', |
500 | 504 | 'group' => 'mediawiki.action.history', |
501 | 505 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
502 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins", |
| 506 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
503 | 507 | 'dependencies' => 'mediawiki.legacy.wikibits', |
504 | 508 | ), |
505 | 509 | 'mediawiki.legacy.htmlform' => array( |
506 | 510 | 'scripts' => 'common/htmlform.js', |
507 | 511 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
508 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins", |
| 512 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
509 | 513 | 'dependencies' => 'mediawiki.legacy.wikibits', |
510 | 514 | ), |
511 | 515 | 'mediawiki.legacy.IEFixes' => array( |
512 | 516 | 'scripts' => 'common/IEFixes.js', |
513 | 517 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
514 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins", |
| 518 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
515 | 519 | 'dependencies' => 'mediawiki.legacy.wikibits', |
516 | 520 | ), |
517 | 521 | 'mediawiki.legacy.metadata' => array( |
518 | 522 | 'scripts' => 'common/metadata.js', |
519 | 523 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
520 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins", |
| 524 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
521 | 525 | 'dependencies' => 'mediawiki.legacy.wikibits', |
522 | 526 | 'messages' => array( 'metadata-expand', 'metadata-collapse' ), |
523 | 527 | ), |
524 | 528 | 'mediawiki.legacy.mwsuggest' => array( |
525 | 529 | 'scripts' => 'common/mwsuggest.js', |
526 | 530 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
527 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins", |
| 531 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
528 | 532 | 'dependencies' => 'mediawiki.legacy.wikibits', |
529 | 533 | 'messages' => array( 'search-mwsuggest-enabled', 'search-mwsuggest-disabled' ), |
530 | 534 | ), |
531 | 535 | 'mediawiki.legacy.prefs' => array( |
532 | 536 | 'scripts' => 'common/prefs.js', |
533 | 537 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
534 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins", |
| 538 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
535 | 539 | 'dependencies' => array( 'mediawiki.legacy.wikibits', 'mediawiki.legacy.htmlform' ), |
536 | 540 | ), |
537 | 541 | 'mediawiki.legacy.preview' => array( |
538 | 542 | 'scripts' => 'common/preview.js', |
539 | 543 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
540 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins", |
| 544 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
541 | 545 | 'dependencies' => 'mediawiki.legacy.wikibits', |
542 | 546 | ), |
543 | 547 | 'mediawiki.legacy.protect' => array( |
544 | 548 | 'scripts' => 'common/protect.js', |
545 | 549 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
546 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins", |
| 550 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
547 | 551 | 'dependencies' => 'mediawiki.legacy.wikibits', |
548 | 552 | ), |
549 | 553 | 'mediawiki.legacy.search' => array( |
550 | 554 | 'scripts' => 'common/search.js', |
551 | 555 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
552 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins", |
| 556 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
553 | 557 | 'styles' => 'common/search.css', |
554 | 558 | 'dependencies' => 'mediawiki.legacy.wikibits', |
555 | 559 | ), |
556 | 560 | 'mediawiki.legacy.shared' => array( |
557 | 561 | 'styles' => array( 'common/shared.css' => array( 'media' => 'screen' ) ), |
558 | 562 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
559 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins" |
| 563 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
560 | 564 | ), |
561 | 565 | 'mediawiki.legacy.oldshared' => array( |
562 | 566 | 'styles' => array( 'common/oldshared.css' => array( 'media' => 'screen' ) ), |
563 | 567 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
564 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins" |
| 568 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
565 | 569 | ), |
566 | 570 | 'mediawiki.legacy.upload' => array( |
567 | 571 | 'scripts' => 'common/upload.js', |
568 | 572 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
569 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins", |
| 573 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
570 | 574 | 'dependencies' => 'mediawiki.legacy.wikibits', |
571 | 575 | ), |
572 | 576 | 'mediawiki.legacy.wikibits' => array( |
573 | 577 | 'scripts' => 'common/wikibits.js', |
574 | 578 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
575 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins", |
| 579 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
576 | 580 | 'dependencies' => 'mediawiki.language', |
577 | 581 | 'messages' => array( 'showtoc', 'hidetoc' ), |
578 | 582 | ), |
579 | 583 | 'mediawiki.legacy.wikiprintable' => array( |
580 | 584 | 'styles' => array( 'common/wikiprintable.css' => array( 'media' => 'print' ) ), |
581 | 585 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
582 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins" |
| 586 | + 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
583 | 587 | ), |
584 | 588 | ); |
Property changes on: branches/REL1_17/phase3/resources/Resources.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
585 | 589 | Merged /trunk/phase3/resources/Resources.php:r87711,87840,88076,89615 |
Index: branches/REL1_17/phase3/resources/mediawiki/mediawiki.js |
— | — | @@ -675,6 +675,20 @@ |
676 | 676 | } |
677 | 677 | return sorted; |
678 | 678 | } |
| 679 | + |
| 680 | + /** |
| 681 | + * Converts a module map of the form { foo: [ 'bar', 'baz' ], bar: [ 'baz, 'quux' ] } |
| 682 | + * to a query string of the form foo.bar,baz|bar.baz,quux |
| 683 | + */ |
| 684 | + function buildModulesString( moduleMap ) { |
| 685 | + var arr = []; |
| 686 | + for ( var prefix in moduleMap ) { |
| 687 | + var p = prefix === '' ? '' : prefix + '.'; |
| 688 | + arr.push( p + moduleMap[prefix].join( ',' ) ); |
| 689 | + } |
| 690 | + return arr.join( '|' ).replace( /\./g, '!' ); |
| 691 | + } |
| 692 | + |
679 | 693 | |
680 | 694 | /* Public Methods */ |
681 | 695 | |
— | — | @@ -728,9 +742,44 @@ |
729 | 743 | version = registry[groups[group][g]].version; |
730 | 744 | } |
731 | 745 | } |
732 | | - requests[requests.length] = $.extend( |
733 | | - { 'modules': groups[group].join( '|' ), 'version': formatVersionNumber( version ) }, base |
734 | | - ); |
| 746 | + var reqBase = $.extend( { 'version': formatVersionNumber( version ) }, base ); |
| 747 | + var reqBaseLength = $.param( reqBase ).length; |
| 748 | + var reqs = []; |
| 749 | + var limit = mw.config.get( 'wgResourceLoaderMaxQueryLength', -1 ); |
| 750 | + // We may need to split up the request to honor the query string length limit |
| 751 | + // So build it piece by piece |
| 752 | + var l = reqBaseLength + 9; // '&modules='.length == 9 |
| 753 | + var r = 0; |
| 754 | + reqs[0] = {}; // { prefix: [ suffixes ] } |
| 755 | + for ( var i = 0; i < groups[group].length; i++ ) { |
| 756 | + // Determine how many bytes this module would add to the query string |
| 757 | + var lastDotIndex = groups[group][i].lastIndexOf( '.' ); |
| 758 | + // Note that these substr() calls work even if lastDotIndex == -1 |
| 759 | + var prefix = groups[group][i].substr( 0, lastDotIndex ); |
| 760 | + var suffix = groups[group][i].substr( lastDotIndex + 1 ); |
| 761 | + var bytesAdded = prefix in reqs[r] ? |
| 762 | + suffix.length + 3 : // '%2C'.length == 3 |
| 763 | + groups[group][i].length + 3; // '%7C'.length == 3 |
| 764 | + |
| 765 | + // If the request would become too long, create a new one, |
| 766 | + // but don't create empty requests |
| 767 | + if ( limit > 0 && reqs[r] != {} && l + bytesAdded > limit ) { |
| 768 | + // This request would become too long, create a new one |
| 769 | + r++; |
| 770 | + reqs[r] = {}; |
| 771 | + l = reqBaseLength + 9; |
| 772 | + } |
| 773 | + if ( !( prefix in reqs[r] ) ) { |
| 774 | + reqs[r][prefix] = []; |
| 775 | + } |
| 776 | + reqs[r][prefix].push( suffix ); |
| 777 | + l += bytesAdded; |
| 778 | + } |
| 779 | + for ( var r = 0; r < reqs.length; r++ ) { |
| 780 | + requests[requests.length] = $.extend( |
| 781 | + { 'modules': buildModulesString( reqs[r] ) }, reqBase |
| 782 | + ); |
| 783 | + } |
735 | 784 | } |
736 | 785 | // Clear the batch - this MUST happen before we append the |
737 | 786 | // 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 |
738 | 787 | Merged /trunk/phase3/resources/mediawiki/mediawiki.js:r82247,87203,87265,87494,87497,87711,87840,88076,89615 |