Check whether remove command successfully removed the target packages, fixes #6998
parent
7ea6d5d2e7
commit
9ca7457698
|
@ -209,9 +209,9 @@ EOT
|
||||||
'require' => $rootPackage->getRequires(),
|
'require' => $rootPackage->getRequires(),
|
||||||
'require-dev' => $rootPackage->getDevRequires(),
|
'require-dev' => $rootPackage->getDevRequires(),
|
||||||
);
|
);
|
||||||
foreach ($toRemove as $type => $packages) {
|
foreach ($toRemove as $type => $names) {
|
||||||
foreach ($packages as $package) {
|
foreach ($names as $name) {
|
||||||
unset($links[$type][$package]);
|
unset($links[$type][$name]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$rootPackage->setRequires($links['require']);
|
$rootPackage->setRequires($links['require']);
|
||||||
|
@ -266,6 +266,15 @@ EOT
|
||||||
file_put_contents($jsonFile->getPath(), $composerBackup);
|
file_put_contents($jsonFile->getPath(), $composerBackup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$dryRun) {
|
||||||
|
foreach ($packages as $package) {
|
||||||
|
if ($composer->getRepositoryManager()->getLocalRepository()->findPackages($package)) {
|
||||||
|
$io->writeError('<error>Removal failed, '.$package.' is still present, it may be required by another package. See `composer why '.$package.'`.</error>');
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $status;
|
return $status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue