Add source package name to debug info when enabling plugins
parent
3b89a9c3b4
commit
63c086c208
|
@ -229,7 +229,7 @@ class PluginManager
|
|||
$this->registeredPlugins[$package->getName()] = $installer;
|
||||
} elseif (class_exists($class)) {
|
||||
$plugin = new $class();
|
||||
$this->addPlugin($plugin, $isGlobalPlugin);
|
||||
$this->addPlugin($plugin, $isGlobalPlugin, $package);
|
||||
$this->registeredPlugins[$package->getName()] = $plugin;
|
||||
} elseif ($failOnMissingClasses) {
|
||||
throw new \UnexpectedValueException('Plugin '.$package->getName().' could not be initialized, class not found: '.$class);
|
||||
|
@ -319,11 +319,19 @@ class PluginManager
|
|||
* programmatically and want to register a plugin class directly this is a valid way
|
||||
* to do it.
|
||||
*
|
||||
* @param PluginInterface $plugin plugin instance
|
||||
* @param PluginInterface $plugin plugin instance
|
||||
* @param ?PackageInterface $sourcePackage Package from which the plugin comes from
|
||||
*/
|
||||
public function addPlugin(PluginInterface $plugin, $isGlobalPlugin = false)
|
||||
public function addPlugin(PluginInterface $plugin, $isGlobalPlugin = false, PackageInterface $sourcePackage = null)
|
||||
{
|
||||
$this->io->writeError('Loading plugin '.get_class($plugin).($isGlobalPlugin ? ' (installed globally)' : ''), true, IOInterface::DEBUG);
|
||||
$details = array();
|
||||
if ($sourcePackage) {
|
||||
$details[] = 'from '.$sourcePackage->getName();
|
||||
}
|
||||
if ($isGlobalPlugin) {
|
||||
$details[] = 'installed globally';
|
||||
}
|
||||
$this->io->writeError('Loading plugin '.get_class($plugin).($details ? ' ('.implode(', ', $details).')' : ''), true, IOInterface::DEBUG);
|
||||
$this->plugins[] = $plugin;
|
||||
$plugin->activate($this->composer, $this->io);
|
||||
|
||||
|
|
Loading…
Reference in New Issue