1
0
Fork 0

Fix removal of packages installed in custom path with custom installers not overriding uninstall, fixes #2232

pull/2232/merge
Jordi Boggiano 2015-11-19 16:35:33 +00:00
parent 4071b09091
commit d98b134dc3
1 changed files with 25 additions and 8 deletions

View File

@ -140,17 +140,34 @@ class LibraryInstaller implements InstallerInterface
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getInstallPath(PackageInterface $package) public function getInstallPath(PackageInterface $package)
{
$targetDir = $package->getTargetDir();
return $this->getPackageBasePath($package) . ($targetDir ? '/'.$targetDir : '');
}
protected function getPackageBasePath(PackageInterface $package)
{ {
$this->initializeVendorDir(); $this->initializeVendorDir();
return ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName(); $basePath = ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
$targetDir = $package->getTargetDir();
return $basePath . ($targetDir ? '/'.$targetDir : '');
}
/**
* Returns the base path of the package without target-dir path
*
* It is used for BC as getInstallPath tends to be overriden by
* installer plugins but not getPackageBasePath
*
* @param PackageInterface $package
* @return string
*/
protected function getPackageBasePath(PackageInterface $package)
{
$installPath = $this->getInstallPath($package);
$targetDir = $package->getTargetDir();
if ($targetDir) {
return preg_replace('{/*'.str_replace('/', '/+', preg_quote($targetDir)).'/?$}', '', $installPath);
}
return $installPath;
} }
protected function installCode(PackageInterface $package) protected function installCode(PackageInterface $package)