r74841 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74840‎ | r74841 | r74842 >
Date:17:30, 16 October 2010
Author:demon
Status:ok (Comments)
Tags:
Comment:
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 ;-)
Modified paths:
  • /trunk/phase3/maintenance/Maintenance.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/Maintenance.php
@@ -351,6 +351,7 @@
352352 $this->addOption( 'conf', 'Location of LocalSettings.php, if not default', false, true );
353353 $this->addOption( 'wiki', 'For specifying the wiki ID', false, true );
354354 $this->addOption( 'globals', 'Output globals at the end of processing for debugging' );
 355+ $this->addOption( 'memory-limit', 'Set a specific memory limit for the script' );
355356 // If we support a DB, show the options
356357 if ( $this->getDbType() > 0 ) {
357358 $this->addOption( 'dbuser', 'The DB user to use for this script', false, true );
@@ -461,10 +462,13 @@
462463 /**
463464 * Normally we disable the memory_limit when running admin scripts.
464465 * Some scripts may wish to actually set a limit, however, to avoid
465 - * blowing up unexpectedly.
 466+ * blowing up unexpectedly. We also support a --memory-limit option,
 467+ * to allow sysadmins to explicitly set one if they'd prefer to override
 468+ * defaults (or for people using Suhosin which yells at you for trying
 469+ * to disable the limits)
466470 */
467471 public function memoryLimit() {
468 - return -1;
 472+ return $this->getOption( 'memory-limit', -1 );
469473 }
470474
471475 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r74843Followup r74841, RELEASE-NOTESdemon18:01, 16 October 2010
r74849Follow-up r74841:...maxsem18:33, 16 October 2010

Comments

#Comment by Brion VIBBER (talk | contribs)   22:52, 16 October 2010

r74849 fixes some issues with this but also adds an oddity that passing --memory-limit=0 doesn't alter the memory limit.

Status & tagging log