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
main
Nils Adermann 5 years ago
parent de8368af45
commit faa7c5eea2

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

Loading…
Cancel
Save