r87494 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87493‎ | r87494 | r87495 >
Date:11:52, 5 May 2011
Author:catrope
Status:ok
Tags:
Comment:
For bug 28738, have the installer check for the Suhosin GET variable length limit and set $wgResourceLoaderMaxQueryLength correspondingly in LocalSettings.php . Of course this only works for new installs, no idea if this can be handled cleanly for upgrades
Modified paths:
  • /trunk/phase3/includes/installer/Installer.i18n.php (modified) (history)
  • /trunk/phase3/includes/installer/Installer.php (modified) (history)
  • /trunk/phase3/includes/installer/LocalSettingsGenerator.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/installer/Installer.php
@@ -103,7 +103,8 @@
104104 'envCheckExtension',
105105 'envCheckShellLocale',
106106 'envCheckUploadsDirectory',
107 - 'envCheckLibicu'
 107+ 'envCheckLibicu',
 108+ 'envCheckSuhosinMaxValueLength',
108109 );
109110
110111 /**
@@ -141,6 +142,7 @@
142143 'wgUseInstantCommons',
143144 'wgUpgradeKey',
144145 'wgDefaultSkin',
 146+ 'wgResourceLoaderMaxQueryLength',
145147 );
146148
147149 /**
@@ -966,6 +968,21 @@
967969 $this->showMessage( 'config-uploads-not-safe', $dir );
968970 }
969971 }
 972+
 973+ /**
 974+ * Checks if suhosin.get.max_value_length is set, and if so, sets
 975+ * $wgResourceLoaderMaxQueryLength to that value in the generated
 976+ * LocalSettings file
 977+ */
 978+ protected function envCheckSuhosinMaxValueLength() {
 979+ $maxValueLength = ini_get( 'suhosin.get.max_value_length' );
 980+ if ( $maxValueLength > 0 ) {
 981+ $this->showMessage( 'config-suhosin-max-value-length', $maxValueLength );
 982+ } else {
 983+ $maxValueLength = -1;
 984+ }
 985+ $this->setVar( 'wgResourceLoaderMaxQueryLength', $maxValueLength );
 986+ }
970987
971988 /**
972989 * Convert a hex string representing a Unicode code point to that code point.
Index: trunk/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.
Index: trunk/phase3/includes/installer/LocalSettingsGenerator.php
@@ -46,7 +46,7 @@
4747 'wgRightsText', 'wgRightsCode', 'wgMainCacheType', 'wgEnableUploads',
4848 'wgMainCacheType', '_MemCachedServers', 'wgDBserver', 'wgDBuser',
4949 'wgDBpassword', 'wgUseInstantCommons', 'wgUpgradeKey', 'wgDefaultSkin',
50 - 'wgMetaNamespace'
 50+ 'wgMetaNamespace', 'wgResourceLoaderMaxQueryLength'
5151 ),
5252 $db->getGlobalNames()
5353 );
@@ -307,6 +307,12 @@
308308
309309 # Path to the GNU diff3 utility. Used for conflict resolution.
310310 \$wgDiff3 = \"{$this->values['wgDiff3']}\";
 311+
 312+# Query string length limit for ResourceLoader. You should only set this if
 313+# your web server has a query string length limit (then set it to that limit),
 314+# or if you have suhosin.get.max_value_length set in php.ini (then set it to
 315+# that value)
 316+\$wgResourceLoaderMaxQueryLength = {$this->values['wgResourceLoaderMaxQueryLength']};
311317 ";
312318 }
313319

Follow-up revisions

RevisionCommit summaryAuthorDate
r87497Per bug 28738 comment 4, pack ResourceLoader URLs by encoding foo.bar|foo.baz...catrope13:46, 5 May 2011
r896761.17: MFT r82247, r87203, r87265, r87494, r87497, r87711, r87840, r88076, r89615catrope19:09, 7 June 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r87203(bug 28738) Implement request splitting in mw.loader so ResourceLoader reques...catrope18:41, 1 May 2011

Status & tagging log