For bug 28738, have the installer check for the Suhosin GET variable length limit...
authorRoan Kattouw <catrope@users.mediawiki.org>
Thu, 5 May 2011 11:52:23 +0000 (11:52 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Thu, 5 May 2011 11:52:23 +0000 (11:52 +0000)
includes/installer/Installer.i18n.php
includes/installer/Installer.php
includes/installer/LocalSettingsGenerator.php

index 3904e42..b21f71c 100644 (file)
@@ -155,6 +155,7 @@ Installation aborted.',
        '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.
index 58ce470..f8de893 100644 (file)
@@ -103,7 +103,8 @@ abstract class Installer {
                'envCheckExtension',
                'envCheckShellLocale',
                'envCheckUploadsDirectory',
-               'envCheckLibicu'
+               'envCheckLibicu',
+               'envCheckSuhosinMaxValueLength',
        );
 
        /**
@@ -141,6 +142,7 @@ abstract class Installer {
                'wgUseInstantCommons',
                'wgUpgradeKey',
                'wgDefaultSkin',
+               'wgResourceLoaderMaxQueryLength',
        );
 
        /**
@@ -966,6 +968,21 @@ abstract class Installer {
                        $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.
index db74a28..94c84e3 100644 (file)
@@ -46,7 +46,7 @@ class LocalSettingsGenerator {
                                'wgRightsText', 'wgRightsCode', 'wgMainCacheType', 'wgEnableUploads',
                                'wgMainCacheType', '_MemCachedServers', 'wgDBserver', 'wgDBuser',
                                'wgDBpassword', 'wgUseInstantCommons', 'wgUpgradeKey', 'wgDefaultSkin',
-                               'wgMetaNamespace'
+                               'wgMetaNamespace', 'wgResourceLoaderMaxQueryLength'
                        ),
                        $db->getGlobalNames()
                );
@@ -307,6 +307,12 @@ if ( !defined( 'MEDIAWIKI' ) ) {
 
 # Path to the GNU diff3 utility. Used for conflict resolution.
 \$wgDiff3 = \"{$this->values['wgDiff3']}\";
+
+# 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']};
 ";
        }