1
0
Fork 0

Add COMPOSER_MEMORY_LIMIT env var to force a given memory_limit, fixes #6931

pull/6969/merge
Jordi Boggiano 2018-01-04 10:49:41 +01:00
parent 5cd0fef7ff
commit 882b82d542
2 changed files with 8 additions and 0 deletions

View File

@ -45,6 +45,10 @@ if (function_exists('ini_set')) {
if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1536) {
@ini_set('memory_limit', '1536M');
}
// Set user defined memory limit
if ($memoryLimit = getenv('COMPOSER_MEMORY_LIMIT')) {
@ini_set('memory_limit', $memoryLimit);
}
unset($memoryInBytes, $memoryLimit);
}

View File

@ -909,6 +909,10 @@ If set to 1, this env disables the warning about running commands as root/super
It also disables automatic clearing of sudo sessions, so you should really only set this
if you use Composer as super user at all times like in docker containers.
### COMPOSER_MEMORY_LIMIT
If set, the value is used as php's memory_limit.
### COMPOSER_MIRROR_PATH_REPOS
If set to 1, this env changes the default path repository strategy to `mirror` instead