mirror of
https://github.com/composer/composer
synced 2025-05-11 01:22:54 +00:00
Load plugins before purging packages, fixes #3557
This commit is contained in:
parent
0c87048fed
commit
2b16a73659
3 changed files with 13 additions and 9 deletions
|
@ -190,10 +190,11 @@ class PluginManager
|
|||
* instead for BC
|
||||
*
|
||||
* @param PackageInterface $package
|
||||
* @param bool $failOnMissingClasses By default this silently skips plugins that can not be found, but if set to true it fails with an exception
|
||||
*
|
||||
* @throws \UnexpectedValueException
|
||||
*/
|
||||
public function registerPackage(PackageInterface $package)
|
||||
public function registerPackage(PackageInterface $package, $failOnMissingClasses = false)
|
||||
{
|
||||
$oldInstallerPlugin = ($package->getType() === 'composer-installer');
|
||||
|
||||
|
@ -242,10 +243,12 @@ class PluginManager
|
|||
if ($oldInstallerPlugin) {
|
||||
$installer = new $class($this->io, $this->composer);
|
||||
$this->composer->getInstallationManager()->addInstaller($installer);
|
||||
} else {
|
||||
} elseif (class_exists($class)) {
|
||||
$plugin = new $class();
|
||||
$this->addPlugin($plugin);
|
||||
$this->registeredPlugins[] = $package->getName();
|
||||
} elseif ($failOnMissingClasses) {
|
||||
throw new \UnexpectedValueException('Plugin '.$package->getName().' could not be initialized, class not found: '.$class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue