1
0
Fork 0

Fix project aliases being redownloaded since they had no version

pull/558/head
Jordi Boggiano 2012-04-10 11:55:34 +02:00
parent 983de81b1d
commit 9da7fbbf37
3 changed files with 11 additions and 4 deletions

View File

@ -139,9 +139,13 @@ class Installer
}
foreach ($aliases as $alias) {
foreach ($this->repositoryManager->findPackages($alias['package'], $alias['version']) as $package) {
$package->setAlias($alias['alias_normalized']);
$package->setPrettyAlias($alias['alias']);
$package->getRepository()->addPackage(new AliasPackage($package, $alias['alias_normalized'], $alias['alias']));
}
foreach ($this->repositoryManager->getLocalRepository()->findPackages($alias['package'], $alias['version']) as $package) {
$package->setAlias($alias['alias_normalized']);
$package->setPrettyAlias($alias['alias']);
$this->repositoryManager->getLocalRepository()->addPackage(new AliasPackage($package, $alias['alias_normalized'], $alias['alias']));
$this->repositoryManager->getLocalRepository()->removePackage($package);
}

View File

@ -102,9 +102,9 @@ class ArrayRepository implements RepositoryInterface
}
}
protected function createAliasPackage(PackageInterface $package)
protected function createAliasPackage(PackageInterface $package, $alias = null, $prettyAlias = null)
{
return new AliasPackage($package, $package->getAlias(), $package->getPrettyAlias());
return new AliasPackage($package, $alias ?: $package->getAlias(), $prettyAlias ?: $package->getPrettyAlias());
}
/**

View File

@ -59,8 +59,11 @@ class FilesystemRepository extends ArrayRepository implements WritableRepository
// package was installed as alias, so we only add the alias
if ($this instanceof InstalledRepositoryInterface && !empty($packageData['installed-as-alias'])) {
$alias = $packageData['installed-as-alias'];
$package->setAlias($alias);
$package->setPrettyAlias($alias);
$package->setInstalledAsAlias(true);
$this->addPackage($this->createAliasPackage($package));
$this->addPackage($this->createAliasPackage($package, $alias, $alias));
} else {
// only add regular package - if it's not an installed repo the alias will be created on the fly
$this->addPackage($package);
@ -78,7 +81,7 @@ class FilesystemRepository extends ArrayRepository implements WritableRepository
foreach ($this->getPackages() as $package) {
$data = $dumper->dump($package);
if ($this instanceof InstalledRepositoryInterface && $package->isInstalledAsAlias()) {
$data['installed-as-alias'] = true;
$data['installed-as-alias'] = $package->getAlias();
}
$packages[] = $data;
}