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

This commit is contained in:
Roan Kattouw 2011-05-05 11:52:23 +00:00
parent d35a42d8c1
commit 648bed9f83
3 changed files with 26 additions and 2 deletions

View 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.

View 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.

View 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']};
";
}