1
0
Fork 0

Process remove ops first, fixes #2874

pull/2888/head
Jordi Boggiano 2014-04-07 11:10:26 +02:00
parent a931faaa34
commit 3c0edd8c7f
1 changed files with 21 additions and 0 deletions

View File

@ -481,6 +481,7 @@ class Installer
}
$operations = $this->movePluginsToFront($operations);
$operations = $this->moveUninstallsToFront($operations);
foreach ($operations as $operation) {
// collect suggestions
@ -591,6 +592,26 @@ class Installer
return array_merge($installerOps, $operations);
}
/**
* Removals of packages should be executed before installations in
* case two packages resolve to the same path (due to custom installers)
*
* @param OperationInterface[] $operations
* @return OperationInterface[] reordered operation list
*/
private function moveUninstallsToFront(array $operations)
{
$uninstOps = array();
foreach ($operations as $idx => $op) {
if ($op instanceof UninstallOperation) {
$uninstOps[] = $op;
unset($operations[$idx]);
}
}
return array_merge($uninstOps, $operations);
}
private function createPool($withDevReqs)
{
$minimumStability = $this->package->getMinimumStability();