1
0
Fork 0

Allow overriding self-update target file with envvar COMPOSER_SELF_UPDATE_TARGET

Useful if Composer is provided on a read-only filesystems, to allow
self-update to work with a different destination
pull/8151/head
Nils Adermann 2019-05-19 20:52:53 +02:00
parent de8368af45
commit faa7c5eea2
1 changed files with 4 additions and 0 deletions

View File

@ -351,6 +351,10 @@ TAGSPUBKEY
@copy($localFilename, $backupTarget); @copy($localFilename, $backupTarget);
} }
if ($targetFilename = getenv('COMPOSER_SELF_UPDATE_TARGET')) {
$localFilename = realpath($targetFilename) ?: $targetFilename;
}
rename($newFilename, $localFilename); rename($newFilename, $localFilename);
return null; return null;