From: Jan Zerebecki Date: Thu, 26 Feb 2015 16:51:13 +0000 (+0100) Subject: Change default of $wgResourceLoaderMaxQueryLength to 2000 X-Git-Tag: 1.31.0-rc.0~11957^2 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=cbce504c3d3235c132d859f62ed9fc9d2f33a243;p=lhc%2Fweb%2Fwiklou.git Change default of $wgResourceLoaderMaxQueryLength to 2000 The lowest commonly supported length is a bit over 2000. That is the limit of Internet Explorer. For discussion of the IE limit see http://blogs.msdn.com/b/ieinternals/archive/2014/08/13/url-length-limits-in-internet-explorer.aspx . Some servers only support 4k. Having it unlimited does not work when running qunit jenkins test jobs of the Wikibase extension or when running its qunit tests in vagrant, because it hits the nginx limit. This also adds a mw.track call for when the request split happens. Bug: T90453 Change-Id: Ic416def846f361425c46f7bd1022ed85fa8ac85e --- diff --git a/includes/Setup.php b/includes/Setup.php index 6939f9561c..e4b29f0ce6 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -362,10 +362,15 @@ if ( $wgMetaNamespace === false ) { $wgMetaNamespace = str_replace( ' ', '_', $wgSitename ); } -// Default value is either the suhosin limit or -1 for unlimited +// Default value is 2000 or the suhosin limit if it is between 1 and 2000 if ( $wgResourceLoaderMaxQueryLength === false ) { - $maxValueLength = ini_get( 'suhosin.get.max_value_length' ); - $wgResourceLoaderMaxQueryLength = $maxValueLength > 0 ? $maxValueLength : -1; + $suhosinMaxValueLength = (int) ini_get( 'suhosin.get.max_value_length' ); + if ( $suhosinMaxValueLength > 0 && $suhosinMaxValueLength < 2000 ) { + $wgResourceLoaderMaxQueryLength = $suhosinMaxValueLength; + } else { + $wgResourceLoaderMaxQueryLength = 2000; + } + unset($suhosinMaxValueLength); } /** diff --git a/resources/src/mediawiki/mediawiki.js b/resources/src/mediawiki/mediawiki.js index 2e78c1c7cd..f03c7c6791 100644 --- a/resources/src/mediawiki/mediawiki.js +++ b/resources/src/mediawiki/mediawiki.js @@ -1537,7 +1537,7 @@ }; // Split module batch by source and by group. splits = {}; - maxQueryLength = mw.config.get( 'wgResourceLoaderMaxQueryLength', -1 ); + maxQueryLength = mw.config.get( 'wgResourceLoaderMaxQueryLength', 2000 ); // Appends a list of modules from the queue to the batch for ( q = 0; q < queue.length; q += 1 ) { @@ -1674,6 +1674,7 @@ moduleMap = {}; async = true; l = currReqBaseLength + 9; + mw.track( 'resourceloader.splitRequest', { maxQueryLength: maxQueryLength } ); } if ( !hasOwn.call( moduleMap, prefix ) ) { moduleMap[prefix] = [];