Index: trunk/phase3/maintenance/Maintenance.php |
— | — | @@ -351,7 +351,7 @@ |
352 | 352 | $this->addOption( 'conf', 'Location of LocalSettings.php, if not default', false, true ); |
353 | 353 | $this->addOption( 'wiki', 'For specifying the wiki ID', false, true ); |
354 | 354 | $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, -1 for no limit or "default" to avoid changing it' ); |
| 355 | + $this->addOption( 'memory-limit', 'Set a specific memory limit for the script, "max" for no limit or "default" to avoid changing it' ); |
356 | 356 | // If we support a DB, show the options |
357 | 357 | if ( $this->getDbType() > 0 ) { |
358 | 358 | $this->addOption( 'dbuser', 'The DB user to use for this script', false, true ); |
— | — | @@ -469,16 +469,22 @@ |
470 | 470 | * to disable the limits) |
471 | 471 | */ |
472 | 472 | public function memoryLimit() { |
473 | | - return $this->getOption( 'memory-limit', -1 ); |
| 473 | + $limit = $this->getOption( 'memory-limit', 'max' ); |
| 474 | + $limit = trim( $limit, "\" '" ); // trim quotes in case someone misunderstood |
| 475 | + return $limit; |
474 | 476 | } |
475 | 477 | |
476 | 478 | /** |
477 | 479 | * Adjusts PHP's memory limit to better suit our needs, if needed. |
478 | 480 | */ |
479 | 481 | protected function adjustMemoryLimit() { |
480 | | - if ( $this->memoryLimit() != 'default' ) { |
481 | | - ini_set( 'memory_limit', $this->memoryLimit() ); |
| 482 | + $limit = $this->memoryLimit(); |
| 483 | + if ( $limit == 'max' ) { |
| 484 | + $limit = -1; // no memory limit |
482 | 485 | } |
| 486 | + if ( $limit != 'default' ) { |
| 487 | + ini_set( 'memory_limit', $limit ); |
| 488 | + } |
483 | 489 | } |
484 | 490 | |
485 | 491 | /** |