mirror of
https://github.com/composer/composer
synced 2025-05-10 09:02:59 +00:00
Implement update mirrors/nothing/lock as its own installer mode
These special commands no longer (ab)use the partial update mechanism but rather create a special install request for all current lock file contents and later override any modified code references to the originals. This leads to up to date remote metadata but no other changes.
This commit is contained in:
parent
eaae360ce6
commit
6925005ac9
10 changed files with 104 additions and 57 deletions
|
@ -121,6 +121,19 @@ EOT
|
|||
}
|
||||
}
|
||||
|
||||
// the arguments lock/nothing/mirrors are not package names but trigger a mirror update instead
|
||||
// they are further mutually exclusive with listing actual package names
|
||||
$filteredPackages = array_filter($packages, function ($package) {
|
||||
return !in_array($package, array('lock', 'nothing', 'mirrors'), true);
|
||||
});
|
||||
$updateMirrors = $input->getOption('lock') || count($filteredPackages) != count($packages);
|
||||
$packages = $filteredPackages;
|
||||
|
||||
if ($updateMirrors && !empty($packages)) {
|
||||
$io->writeError('<error>You cannot simultaneously update only a selection of packages and regenerate the lock file metadata.</error>');
|
||||
return -1;
|
||||
}
|
||||
|
||||
$commandEvent = new CommandEvent(PluginEvents::COMMAND, 'update', $input, $output);
|
||||
$composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
|
||||
|
||||
|
@ -146,7 +159,8 @@ EOT
|
|||
->setClassMapAuthoritative($authoritative)
|
||||
->setApcuAutoloader($apcu)
|
||||
->setUpdate(true)
|
||||
->setUpdateWhitelist($input->getOption('lock') ? array('lock') : $packages)
|
||||
->setUpdateMirrors($updateMirrors)
|
||||
->setUpdateWhitelist($packages)
|
||||
->setWhitelistTransitiveDependencies($input->getOption('with-dependencies'))
|
||||
->setWhitelistAllDependencies($input->getOption('with-all-dependencies'))
|
||||
->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue