1
0
Fork 0

Allow setting default transport strategy for path repositories

This change allows setting COMPOSER_MIRROR_PATH_REPOS to 1
in the environment to set the default strategy to 'mirror'.

This allows using 'mirror' during deployments while still symlinking
on a development machine. The default is still overwritten by the
options on the repository configuration.
pull/5665/head
Rens Admiraal 2016-09-11 14:13:54 +02:00
parent f0f932fca4
commit a294af3f16
2 changed files with 11 additions and 0 deletions

View File

@ -868,4 +868,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 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. if you use Composer as super user at all times like in docker containers.
### COMPOSER_MIRROR_PATH_REPOS
If set to 1, this env changes the default path repository strategy to `mirror` instead
of `symlink`. As it is the default strategy being set it can still be overwritten by
repository options.
← [Libraries](02-libraries.md) | [Schema](04-schema.md) → ← [Libraries](02-libraries.md) | [Schema](04-schema.md) →

View File

@ -59,6 +59,11 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
$currentStrategy = self::STRATEGY_SYMLINK; $currentStrategy = self::STRATEGY_SYMLINK;
$allowedStrategies = array(self::STRATEGY_SYMLINK, self::STRATEGY_MIRROR); $allowedStrategies = array(self::STRATEGY_SYMLINK, self::STRATEGY_MIRROR);
$mirrorPathRepos = getenv('COMPOSER_MIRROR_PATH_REPOS');
if (true === (bool)$mirrorPathRepos) {
$currentStrategy = self::STRATEGY_MIRROR;
}
if (true === $transportOptions['symlink']) { if (true === $transportOptions['symlink']) {
$currentStrategy = self::STRATEGY_SYMLINK; $currentStrategy = self::STRATEGY_SYMLINK;
$allowedStrategies = array(self::STRATEGY_SYMLINK); $allowedStrategies = array(self::STRATEGY_SYMLINK);