1
0
Fork 0

Extract package purging in a method and fix variable overriding

pull/454/merge
Jordi Boggiano 2012-03-15 01:49:29 +01:00
parent a02940cafb
commit a5edc9e357
1 changed files with 10 additions and 5 deletions

View File

@ -94,11 +94,7 @@ class Factory
$im = $this->createInstallationManager($rm, $dm, $vendorDir, $binDir, $io);
// purge packages if they have been deleted on the filesystem
foreach ($rm->getLocalRepository()->getPackages() as $package) {
if (!$im->isPackageInstalled($package)) {
$rm->getLocalRepository()->removePackage($package);
}
}
$this->purgePackages($rm, $im);
// init locker
$lockFile = substr($composerFile, -5) === '.json' ? substr($composerFile, 0, -4).'lock' : $composerFile . '.lock';
@ -187,6 +183,15 @@ class Factory
return $im;
}
protected function purgePackages(Repository\RepositoryManager $rm, Installer\InstallationManager $im)
{
foreach ($rm->getLocalRepository()->getPackages() as $package) {
if (!$im->isPackageInstalled($package)) {
$rm->getLocalRepository()->removePackage($package);
}
}
}
static public function create(IOInterface $io, $composerFile = null)
{
$factory = new static();