1
0
Fork 0

Avoid adding duplicate aliases

pull/642/head
Jordi Boggiano 2012-04-27 18:42:34 +02:00
parent 41bd845c54
commit 66dc17bf39
1 changed files with 9 additions and 1 deletions

View File

@ -90,11 +90,19 @@ class Locker
foreach ($lockedPackages as $info) {
$resolvedVersion = !empty($info['alias']) ? $info['alias'] : $info['version'];
// try to find the package in the local repo (best match)
$package = $repo->findPackage($info['package'], $resolvedVersion);
// try to find the package in any repo
if (!$package) {
$package = $this->repositoryManager->findPackage($info['package'], $resolvedVersion);
}
// try to find the package in any repo (second pass without alias + rebuild alias since it disappeared)
if (!$package && !empty($info['alias'])) {
$package = $this->repositoryManager->findPackage($info['package'], $info['version']);
if ($package && !empty($info['alias'])) {
if ($package) {
$alias = new AliasPackage($package, $info['alias'], $info['alias']);
$package->getRepository()->addPackage($alias);
$package = $alias;