Fix removal of packages installed in custom path with custom installers not overriding uninstall, fixes #2232
parent
4071b09091
commit
d98b134dc3
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue