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)
{
$package = $operation->getPackage();
if ($package instanceof AliasPackage) {
$package = $package->getAliasOf();
$package->setInstalledAsAlias(true);
}
$package = $this->antiAlias($operation->getPackage());
$installer = $this->getInstaller($package->getType());
$installer->install($repo, $package);
$this->notifyInstall($package);
@ -145,15 +141,8 @@ class InstallationManager
*/
public function update(RepositoryInterface $repo, UpdateOperation $operation)
{
$initial = $operation->getInitialPackage();
if ($initial instanceof AliasPackage) {
$initial = $initial->getAliasOf();
}
$target = $operation->getTargetPackage();
if ($target instanceof AliasPackage) {
$target = $target->getAliasOf();
$target->setInstalledAsAlias(true);
}
$initial = $this->antiAlias($operation->getInitialPackage());
$target = $this->antiAlias($operation->getTargetPackage());
$initialType = $initial->getType();
$targetType = $target->getType();
@ -176,10 +165,7 @@ class InstallationManager
*/
public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
{
$package = $operation->getPackage();
if ($package instanceof AliasPackage) {
$package = $package->getAliasOf();
}
$package = $this->antiAlias($operation->getPackage());
$installer = $this->getInstaller($package->getType());
$installer->uninstall($repo, $package);
}
@ -217,4 +203,17 @@ class InstallationManager
$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;
}
}