1
0
Fork 0

Make sure the anti-aliased package contains the alias info from the correct alias

pull/606/merge
Jordi Boggiano 2012-04-24 11:16:25 +02:00
parent cc3d91f75c
commit 903facd64f
1 changed files with 17 additions and 18 deletions

View File

@ -127,11 +127,7 @@ class InstallationManager
*/ */
public function install(RepositoryInterface $repo, InstallOperation $operation) public function install(RepositoryInterface $repo, InstallOperation $operation)
{ {
$package = $operation->getPackage(); $package = $this->antiAlias($operation->getPackage());
if ($package instanceof AliasPackage) {
$package = $package->getAliasOf();
$package->setInstalledAsAlias(true);
}
$installer = $this->getInstaller($package->getType()); $installer = $this->getInstaller($package->getType());
$installer->install($repo, $package); $installer->install($repo, $package);
$this->notifyInstall($package); $this->notifyInstall($package);
@ -145,15 +141,8 @@ class InstallationManager
*/ */
public function update(RepositoryInterface $repo, UpdateOperation $operation) public function update(RepositoryInterface $repo, UpdateOperation $operation)
{ {
$initial = $operation->getInitialPackage(); $initial = $this->antiAlias($operation->getInitialPackage());
if ($initial instanceof AliasPackage) { $target = $this->antiAlias($operation->getTargetPackage());
$initial = $initial->getAliasOf();
}
$target = $operation->getTargetPackage();
if ($target instanceof AliasPackage) {
$target = $target->getAliasOf();
$target->setInstalledAsAlias(true);
}
$initialType = $initial->getType(); $initialType = $initial->getType();
$targetType = $target->getType(); $targetType = $target->getType();
@ -176,10 +165,7 @@ class InstallationManager
*/ */
public function uninstall(RepositoryInterface $repo, UninstallOperation $operation) public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
{ {
$package = $operation->getPackage(); $package = $this->antiAlias($operation->getPackage());
if ($package instanceof AliasPackage) {
$package = $package->getAliasOf();
}
$installer = $this->getInstaller($package->getType()); $installer = $this->getInstaller($package->getType());
$installer->uninstall($repo, $package); $installer->uninstall($repo, $package);
} }
@ -217,4 +203,17 @@ class InstallationManager
$package->getRepository()->notifyInstall($package); $package->getRepository()->notifyInstall($package);
} }
} }
private function antiAlias(PackageInterface $package)
{
if ($package instanceof AliasPackage) {
$alias = $package;
$package = $package->getAliasOf();
$package->setInstalledAsAlias(true);
$package->setAlias($alias->getVersion());
$package->setPrettyAlias($alias->getPrettyVersion());
}
return $package;
}
} }