From: Chad Horohoe Date: Sat, 16 Oct 2010 17:30:34 +0000 (+0000) Subject: Allow overriding default memory limits in maintenance scripts (which is usually to... X-Git-Tag: 1.31.0-rc.0~34480 X-Git-Url: http://git.cyclocoop.org/ecrire?a=commitdiff_plain;h=2f293bd0cd5abee6e9aa33f6cc65c83a5519ad04;p=lhc%2Fweb%2Fwiklou.git Allow overriding default memory limits in maintenance scripts (which is usually to disable it). Helpful for people on Suhosin which yells at you for trying to disable the limit ;-) --- diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index 84c1535ecd..969b5cc963 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -351,6 +351,7 @@ abstract class Maintenance { $this->addOption( 'conf', 'Location of LocalSettings.php, if not default', false, true ); $this->addOption( 'wiki', 'For specifying the wiki ID', false, true ); $this->addOption( 'globals', 'Output globals at the end of processing for debugging' ); + $this->addOption( 'memory-limit', 'Set a specific memory limit for the script' ); // If we support a DB, show the options if ( $this->getDbType() > 0 ) { $this->addOption( 'dbuser', 'The DB user to use for this script', false, true ); @@ -461,10 +462,13 @@ abstract class Maintenance { /** * Normally we disable the memory_limit when running admin scripts. * Some scripts may wish to actually set a limit, however, to avoid - * blowing up unexpectedly. + * blowing up unexpectedly. We also support a --memory-limit option, + * to allow sysadmins to explicitly set one if they'd prefer to override + * defaults (or for people using Suhosin which yells at you for trying + * to disable the limits) */ public function memoryLimit() { - return -1; + return $this->getOption( 'memory-limit', -1 ); } /**