r89676 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89675‎ | r89676 | r89677 >
Date:19:09, 7 June 2011
Author:catrope
Status:ok (Comments)
Tags:
Comment:
Modified paths:
  • /branches/REL1_17/phase3/includes/DefaultSettings.php (modified) (history)
  • /branches/REL1_17/phase3/includes/OutputPage.php (modified) (history)
  • /branches/REL1_17/phase3/includes/installer/Installer.i18n.php (modified) (history)
  • /branches/REL1_17/phase3/includes/installer/Installer.php (modified) (history)
  • /branches/REL1_17/phase3/includes/installer/LocalSettingsGenerator.php (modified) (history)
  • /branches/REL1_17/phase3/includes/libs/CSSMin.php (modified) (history)
  • /branches/REL1_17/phase3/includes/resourceloader/ResourceLoader.php (modified) (history)
  • /branches/REL1_17/phase3/includes/resourceloader/ResourceLoaderContext.php (modified) (history)
  • /branches/REL1_17/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php (modified) (history)
  • /branches/REL1_17/phase3/resources/Resources.php (modified) (history)
  • /branches/REL1_17/phase3/resources/mediawiki/mediawiki.js (modified) (history)

Diff [purge]

Index: branches/REL1_17/phase3/includes/OutputPage.php
@@ -2338,7 +2338,6 @@
23392339 $wgResourceLoaderInlinePrivateModules, $wgRequest;
23402340 // Lazy-load ResourceLoader
23412341 // 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
23432342 $baseQuery = array(
23442343 'lang' => $wgLang->getCode(),
23452344 'debug' => ResourceLoader::inDebugMode() ? 'true' : 'false',
@@ -2407,7 +2406,7 @@
24082407 continue;
24092408 }
24102409
2411 - $query['modules'] = implode( '|', array_keys( $modules ) );
 2410+ $query['modules'] = ResourceLoader::makePackedModulesString( array_keys( $modules ) );
24122411
24132412 // Support inlining of private modules if configured as such
24142413 if ( $group === 'private' && $wgResourceLoaderInlinePrivateModules ) {
@@ -2442,6 +2441,9 @@
24432442 ksort( $query );
24442443
24452444 $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 .= '&*';
24462448 if ( $useESI && $wgResourceLoaderUseESI ) {
24472449 $esi = Xml::element( 'esi:include', array( 'src' => $url ) );
24482450 if ( $only == 'styles' ) {
@@ -2452,9 +2454,9 @@
24532455 } else {
24542456 // Automatically select style/script elements
24552457 if ( $only === 'styles' ) {
2456 - $links .= Html::linkedStyle( wfAppendQuery( $wgLoadScript, $query ) ) . "\n";
 2458+ $links .= Html::linkedStyle( $url ) . "\n";
24572459 } else {
2458 - $links .= Html::linkedScript( wfAppendQuery( $wgLoadScript, $query ) ) . "\n";
 2460+ $links .= Html::linkedScript( $url ) . "\n";
24592461 }
24602462 }
24612463 }
Property changes on: branches/REL1_17/phase3/includes/OutputPage.php
___________________________________________________________________
Modified: svn:mergeinfo
24622464 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 @@
103103 'envCheckExtension',
104104 'envCheckShellLocale',
105105 'envCheckUploadsDirectory',
106 - 'envCheckLibicu'
 106+ 'envCheckLibicu',
 107+ 'envCheckSuhosinMaxValueLength',
107108 );
108109
109110 /**
@@ -140,6 +141,7 @@
141142 'wgUseInstantCommons',
142143 'wgUpgradeKey',
143144 'wgDefaultSkin',
 145+ 'wgResourceLoaderMaxQueryLength',
144146 );
145147
146148 /**
@@ -959,6 +961,21 @@
960962 $this->showMessage( 'config-uploads-not-safe', $dir );
961963 }
962964 }
 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+ }
963980
964981 /**
965982 * 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
966983 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 @@
156156 'config-using531' => 'MediaWiki cannot be used with PHP $1 due to a bug involving reference parameters to <code>__call()</code>.
157157 Upgrade to PHP 5.3.2 or higher, or downgrade to PHP 5.3.0 to resolve this.
158158 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 .",
159160 'config-db-type' => 'Database type:',
160161 'config-db-host' => 'Database host:',
161162 '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
162163 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 @@
4848 'wgRightsText', 'wgRightsCode', 'wgMainCacheType', 'wgEnableUploads',
4949 'wgMainCacheType', '_MemCachedServers', 'wgDBserver', 'wgDBuser',
5050 'wgDBpassword', 'wgUseInstantCommons', 'wgUpgradeKey', 'wgDefaultSkin',
51 - 'wgMetaNamespace'
 51+ 'wgMetaNamespace', 'wgResourceLoaderMaxQueryLength'
5252 ),
5353 $db->getGlobalNames()
5454 );
@@ -336,7 +336,14 @@
337337 # Path to the GNU diff3 utility. Used for conflict resolution.
338338 \$wgDiff3 = \"{$this->values['wgDiff3']}\";
339339
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+";
341348 }
342349
343350 }
Index: branches/REL1_17/phase3/includes/resourceloader/ResourceLoader.php
@@ -195,6 +195,7 @@
196196 * this may also be a ResourceLoaderModule object. Optional when using
197197 * multiple-registration calling style.
198198 * @throws MWException: If a duplicate module registration is attempted
 199+ * @throws MWException: If a module name contains illegal characters (pipes or commas)
199200 * @throws MWException: If something other than a ResourceLoaderModule is being registered
200201 * @return Boolean: False if there were any errors, in which case one or more modules were not
201202 * registered
@@ -219,6 +220,11 @@
220221 'Another module has already been registered as ' . $name
221222 );
222223 }
 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+ }
223229
224230 // Attach module
225231 if ( is_object( $info ) ) {
@@ -694,6 +700,33 @@
695701 }
696702
697703 /**
 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+ /**
698731 * Determine whether debug mode was requested
699732 * Order of priority is 1) request param, 2) cookie, 3) $wg setting
700733 * @return bool
Property changes on: branches/REL1_17/phase3/includes/resourceloader/ResourceLoader.php
___________________________________________________________________
Modified: svn:mergeinfo
701734 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 @@
5252 // Interpret request
5353 // List of modules
5454 $modules = $request->getVal( 'modules' );
55 - $this->modules = $modules ? explode( '|', $modules ) : array();
 55+ $this->modules = $modules ? self::expandModuleNames( $modules ) : array();
5656 // Various parameters
5757 $this->skin = $request->getVal( 'skin' );
5858 $this->user = $request->getVal( 'user' );
@@ -63,6 +63,41 @@
6464 $this->skin = $wgDefaultSkin;
6565 }
6666 }
 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+ }
67102
68103 public function getResourceLoader() {
69104 return $this->resourceLoader;
Index: branches/REL1_17/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php
@@ -33,7 +33,8 @@
3434 $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang,
3535 $wgVariantArticlePath, $wgActionPaths, $wgUseAjax, $wgVersion,
3636 $wgEnableAPI, $wgEnableWriteAPI, $wgDBname, $wgEnableMWSuggest,
37 - $wgSitename, $wgFileExtensions;
 37+ $wgSitename, $wgFileExtensions, $wgExtensionAssetsPath,
 38+ $wgResourceLoaderMaxQueryLength;
3839
3940 // Pre-process information
4041 $separatorTransTable = $wgContLang->separatorTransformTable();
@@ -77,6 +78,8 @@
7879 'wgSiteName' => $wgSitename,
7980 'wgFileExtensions' => array_values( $wgFileExtensions ),
8081 'wgDBname' => $wgDBname,
 82+ 'wgExtensionAssetsPath' => $wgExtensionAssetsPath,
 83+ 'wgResourceLoaderMaxQueryLength' => $wgResourceLoaderMaxQueryLength,
8184 );
8285 if ( $wgContLang->hasVariants() ) {
8386 $vars['wgUserVariant'] = $wgContLang->getPreferredVariant();
Index: branches/REL1_17/phase3/includes/libs/CSSMin.php
@@ -120,8 +120,9 @@
121121 self::URL_REGEX . '(?P<post>[^;]*)[\;]?/';
122122 $offset = 0;
123123 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 ) {
126127 // Move the offset to the end of the match, leaving it alone
127128 $offset = $match[0][1] + strlen( $match[0][0] );
128129 continue;
Index: branches/REL1_17/phase3/includes/DefaultSettings.php
@@ -2452,6 +2452,19 @@
24532453 */
24542454 $wgIncludeLegacyJavaScript = true;
24552455
 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+
24562469 /** @} */ # End of resource loader settings }
24572470
24582471
Property changes on: branches/REL1_17/phase3/includes/DefaultSettings.php
___________________________________________________________________
Modified: svn:mergeinfo
24592472 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 @@
1515 'skins.vector' => array(
1616 'styles' => array( 'vector/screen.css' => array( 'media' => 'screen' ) ),
1717 'remoteBasePath' => $GLOBALS['wgStylePath'],
18 - 'localBasePath' => "{$GLOBALS['IP']}/skins"
 18+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
1919 ),
2020 'skins.monobook' => array(
2121 'styles' => array(
2222 'monobook/main.css' => array( 'media' => 'screen' ),
2323 ),
2424 'remoteBasePath' => $GLOBALS['wgStylePath'],
25 - 'localBasePath' => "{$GLOBALS['IP']}/skins"
 25+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
2626 ),
2727 'skins.simple' => array(
2828 'styles' => array( 'simple/main.css' => array( 'media' => 'screen' ) ),
2929 'remoteBasePath' => $GLOBALS['wgStylePath'],
30 - 'localBasePath' => "{$GLOBALS['IP']}/skins"
 30+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
3131 ),
3232 'skins.chick' => array(
3333 'styles' => array( 'chick/main.css' => array( 'media' => 'screen,handheld' ) ),
3434 'remoteBasePath' => $GLOBALS['wgStylePath'],
35 - 'localBasePath' => "{$GLOBALS['IP']}/skins"
 35+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
3636 ),
3737 'skins.modern' => array(
3838 'styles' => array( 'modern/main.css' => array( 'media' => 'screen' ),
3939 'modern/print.css' => array( 'media' => 'print' ) ),
4040 'remoteBasePath' => $GLOBALS['wgStylePath'],
41 - 'localBasePath' => "{$GLOBALS['IP']}/skins"
 41+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
4242 ),
4343 'skins.cologneblue' => array(
4444 'styles' => array( 'common/cologneblue.css' => array( 'media' => 'screen' ) ),
4545 'remoteBasePath' => $GLOBALS['wgStylePath'],
46 - 'localBasePath' => "{$GLOBALS['IP']}/skins"
 46+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
4747 ),
4848 'skins.nostalgia' => array(
4949 'styles' => array( 'common/nostalgia.css' => array( 'media' => 'screen' ) ),
5050 'remoteBasePath' => $GLOBALS['wgStylePath'],
51 - 'localBasePath' => "{$GLOBALS['IP']}/skins"
 51+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
5252 ),
5353 'skins.standard' => array(
5454 'styles' => array( 'common/wikistandard.css' => array( 'media' => 'screen' ) ),
5555 'remoteBasePath' => $GLOBALS['wgStylePath'],
56 - 'localBasePath' => "{$GLOBALS['IP']}/skins"
 56+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
5757 ),
5858
5959 /* jQuery */
@@ -447,7 +447,7 @@
448448 'mediawiki.legacy.ajax' => array(
449449 'scripts' => 'common/ajax.js',
450450 'remoteBasePath' => $GLOBALS['wgStylePath'],
451 - 'localBasePath' => "{$GLOBALS['IP']}/skins",
 451+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
452452 'messages' => array(
453453 'watch', 'unwatch', 'watching', 'unwatching', 'tooltip-ca-watch',
454454 'tooltip-ca-unwatch'
@@ -455,25 +455,27 @@
456456 'dependencies' => 'mediawiki.legacy.wikibits',
457457 ),
458458 'mediawiki.legacy.ajaxwatch' => array(
459 - 'scripts' => 'skins/common/ajaxwatch.js',
 459+ 'scripts' => 'common/ajaxwatch.js',
 460+ 'remoteBasePath' => $GLOBALS['wgStylePath'],
 461+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
460462 'dependencies' => 'mediawiki.legacy.wikibits',
461463 ),
462464 'mediawiki.legacy.block' => array(
463465 'scripts' => 'common/block.js',
464466 'remoteBasePath' => $GLOBALS['wgStylePath'],
465 - 'localBasePath' => "{$GLOBALS['IP']}/skins",
 467+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
466468 'dependencies' => 'mediawiki.legacy.wikibits',
467469 ),
468470 'mediawiki.legacy.commonPrint' => array(
469471 'styles' => array( 'common/commonPrint.css' => array( 'media' => 'print' ) ),
470472 'remoteBasePath' => $GLOBALS['wgStylePath'],
471 - 'localBasePath' => "{$GLOBALS['IP']}/skins",
 473+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
472474 ),
473475 'mediawiki.legacy.config' => array(
474476 'scripts' => 'common/config.js',
475477 'styles' => array( 'common/config.css', 'common/config-cc.css' ),
476478 'remoteBasePath' => $GLOBALS['wgStylePath'],
477 - 'localBasePath' => "{$GLOBALS['IP']}/skins",
 479+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
478480 'dependencies' => 'mediawiki.legacy.wikibits',
479481 ),
480482 'mediawiki.legacy.diff' => array(
@@ -481,103 +483,105 @@
482484 'styles' => 'common/diff.css',
483485 'group' => 'mediawiki.action.history',
484486 'remoteBasePath' => $GLOBALS['wgStylePath'],
485 - 'localBasePath' => "{$GLOBALS['IP']}/skins",
 487+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
486488 'dependencies' => 'mediawiki.legacy.wikibits',
487489 ),
488490 'mediawiki.legacy.edit' => array(
489491 'scripts' => 'common/edit.js',
490492 'remoteBasePath' => $GLOBALS['wgStylePath'],
491 - 'localBasePath' => "{$GLOBALS['IP']}/skins",
 493+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
492494 'dependencies' => 'mediawiki.legacy.wikibits',
493495 ),
494496 'mediawiki.legacy.enhancedchanges' => array(
495 - 'scripts' => 'skins/common/enhancedchanges.js',
 497+ 'scripts' => 'common/enhancedchanges.js',
 498+ 'remoteBasePath' => $GLOBALS['wgStylePath'],
 499+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
496500 'dependencies' => 'mediawiki.legacy.wikibits',
497501 ),
498502 'mediawiki.legacy.history' => array(
499503 'scripts' => 'common/history.js',
500504 'group' => 'mediawiki.action.history',
501505 'remoteBasePath' => $GLOBALS['wgStylePath'],
502 - 'localBasePath' => "{$GLOBALS['IP']}/skins",
 506+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
503507 'dependencies' => 'mediawiki.legacy.wikibits',
504508 ),
505509 'mediawiki.legacy.htmlform' => array(
506510 'scripts' => 'common/htmlform.js',
507511 'remoteBasePath' => $GLOBALS['wgStylePath'],
508 - 'localBasePath' => "{$GLOBALS['IP']}/skins",
 512+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
509513 'dependencies' => 'mediawiki.legacy.wikibits',
510514 ),
511515 'mediawiki.legacy.IEFixes' => array(
512516 'scripts' => 'common/IEFixes.js',
513517 'remoteBasePath' => $GLOBALS['wgStylePath'],
514 - 'localBasePath' => "{$GLOBALS['IP']}/skins",
 518+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
515519 'dependencies' => 'mediawiki.legacy.wikibits',
516520 ),
517521 'mediawiki.legacy.metadata' => array(
518522 'scripts' => 'common/metadata.js',
519523 'remoteBasePath' => $GLOBALS['wgStylePath'],
520 - 'localBasePath' => "{$GLOBALS['IP']}/skins",
 524+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
521525 'dependencies' => 'mediawiki.legacy.wikibits',
522526 'messages' => array( 'metadata-expand', 'metadata-collapse' ),
523527 ),
524528 'mediawiki.legacy.mwsuggest' => array(
525529 'scripts' => 'common/mwsuggest.js',
526530 'remoteBasePath' => $GLOBALS['wgStylePath'],
527 - 'localBasePath' => "{$GLOBALS['IP']}/skins",
 531+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
528532 'dependencies' => 'mediawiki.legacy.wikibits',
529533 'messages' => array( 'search-mwsuggest-enabled', 'search-mwsuggest-disabled' ),
530534 ),
531535 'mediawiki.legacy.prefs' => array(
532536 'scripts' => 'common/prefs.js',
533537 'remoteBasePath' => $GLOBALS['wgStylePath'],
534 - 'localBasePath' => "{$GLOBALS['IP']}/skins",
 538+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
535539 'dependencies' => array( 'mediawiki.legacy.wikibits', 'mediawiki.legacy.htmlform' ),
536540 ),
537541 'mediawiki.legacy.preview' => array(
538542 'scripts' => 'common/preview.js',
539543 'remoteBasePath' => $GLOBALS['wgStylePath'],
540 - 'localBasePath' => "{$GLOBALS['IP']}/skins",
 544+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
541545 'dependencies' => 'mediawiki.legacy.wikibits',
542546 ),
543547 'mediawiki.legacy.protect' => array(
544548 'scripts' => 'common/protect.js',
545549 'remoteBasePath' => $GLOBALS['wgStylePath'],
546 - 'localBasePath' => "{$GLOBALS['IP']}/skins",
 550+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
547551 'dependencies' => 'mediawiki.legacy.wikibits',
548552 ),
549553 'mediawiki.legacy.search' => array(
550554 'scripts' => 'common/search.js',
551555 'remoteBasePath' => $GLOBALS['wgStylePath'],
552 - 'localBasePath' => "{$GLOBALS['IP']}/skins",
 556+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
553557 'styles' => 'common/search.css',
554558 'dependencies' => 'mediawiki.legacy.wikibits',
555559 ),
556560 'mediawiki.legacy.shared' => array(
557561 'styles' => array( 'common/shared.css' => array( 'media' => 'screen' ) ),
558562 'remoteBasePath' => $GLOBALS['wgStylePath'],
559 - 'localBasePath' => "{$GLOBALS['IP']}/skins"
 563+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
560564 ),
561565 'mediawiki.legacy.oldshared' => array(
562566 'styles' => array( 'common/oldshared.css' => array( 'media' => 'screen' ) ),
563567 'remoteBasePath' => $GLOBALS['wgStylePath'],
564 - 'localBasePath' => "{$GLOBALS['IP']}/skins"
 568+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
565569 ),
566570 'mediawiki.legacy.upload' => array(
567571 'scripts' => 'common/upload.js',
568572 'remoteBasePath' => $GLOBALS['wgStylePath'],
569 - 'localBasePath' => "{$GLOBALS['IP']}/skins",
 573+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
570574 'dependencies' => 'mediawiki.legacy.wikibits',
571575 ),
572576 'mediawiki.legacy.wikibits' => array(
573577 'scripts' => 'common/wikibits.js',
574578 'remoteBasePath' => $GLOBALS['wgStylePath'],
575 - 'localBasePath' => "{$GLOBALS['IP']}/skins",
 579+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
576580 'dependencies' => 'mediawiki.language',
577581 'messages' => array( 'showtoc', 'hidetoc' ),
578582 ),
579583 'mediawiki.legacy.wikiprintable' => array(
580584 'styles' => array( 'common/wikiprintable.css' => array( 'media' => 'print' ) ),
581585 'remoteBasePath' => $GLOBALS['wgStylePath'],
582 - 'localBasePath' => "{$GLOBALS['IP']}/skins"
 586+ 'localBasePath' => $GLOBALS['wgStyleDirectory'],
583587 ),
584588 );
Property changes on: branches/REL1_17/phase3/resources/Resources.php
___________________________________________________________________
Modified: svn:mergeinfo
585589 Merged /trunk/phase3/resources/Resources.php:r87711,87840,88076,89615
Index: branches/REL1_17/phase3/resources/mediawiki/mediawiki.js
@@ -675,6 +675,20 @@
676676 }
677677 return sorted;
678678 }
 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+
679693
680694 /* Public Methods */
681695
@@ -728,9 +742,44 @@
729743 version = registry[groups[group][g]].version;
730744 }
731745 }
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+ }
735784 }
736785 // Clear the batch - this MUST happen before we append the
737786 // 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
738787 Merged /trunk/phase3/resources/mediawiki/mediawiki.js:r82247,87203,87265,87494,87497,87711,87840,88076,89615

Follow-up revisions

RevisionCommit summaryAuthorDate
r89720* Added release notes for REL1_17 changes up to and including r89676....tstarling06:08, 8 June 2011
r897271.17: Back out r87711 per CR on r89676catrope12:09, 8 June 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r82247Expose $wgExtensionAssetsPath in JScatrope14:28, 16 February 2011
r87203(bug 28738) Implement request splitting in mw.loader so ResourceLoader reques...catrope18:41, 1 May 2011
r87265Fix r87203: don't use a for..in loop on an arraycatrope17:57, 2 May 2011
r87494For bug 28738, have the installer check for the Suhosin GET variable length l...catrope11:52, 5 May 2011
r87497Per bug 28738 comment 4, pack ResourceLoader URLs by encoding foo.bar|foo.baz...catrope13:46, 5 May 2011
r87711(bug 28840) Commit patch by bawolff that encodes dots in ResourceLoader modul...catrope13:10, 9 May 2011
r87840* (bug 25262) Fix for minification of hardcoded data: URIs in CSS...brion20:14, 10 May 2011
r88076Fix bug in r87497, reported in CR: &modules=foo,bar,baz would look for '.foo'...catrope13:34, 14 May 2011
r89615(bug 25124) Resource loader should respect $wgStyleDirectory...krinkle22:08, 6 June 2011

Comments

#Comment by Tim Starling (talk | contribs)   06:01, 8 June 2011

Did you mean to backport r87711? I thought we weren't going to use it.

#Comment by Catrope (talk | contribs)   12:04, 8 June 2011

Subsequent backported revisions undo the changes in r87711. However, r87711 wasn't cleanly reverted in one rev IIRC, so I decided to merge r87711 too to avoid conflicts. I could've probably kept it out of the list in the commit summary, consider that a copypaste mistake.

#Comment by Catrope (talk | contribs)   12:05, 8 June 2011

Crap, looks like I haven't done this correctly. Fixing.

#Comment by Catrope (talk | contribs)   12:09, 8 June 2011

Fixed in r89727

Status & tagging log