From 2f293bd0cd5abee6e9aa33f6cc65c83a5519ad04 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Sat, 16 Oct 2010 17:30:34 +0000 Subject: [PATCH 1/1] 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 ;-) --- maintenance/Maintenance.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 ); } /** -- 2.20.1