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;
|
$this->registeredPlugins[$package->getName()] = $installer;
|
||||||
} elseif (class_exists($class)) {
|
} elseif (class_exists($class)) {
|
||||||
$plugin = new $class();
|
$plugin = new $class();
|
||||||
$this->addPlugin($plugin, $isGlobalPlugin);
|
$this->addPlugin($plugin, $isGlobalPlugin, $package);
|
||||||
$this->registeredPlugins[$package->getName()] = $plugin;
|
$this->registeredPlugins[$package->getName()] = $plugin;
|
||||||
} elseif ($failOnMissingClasses) {
|
} elseif ($failOnMissingClasses) {
|
||||||
throw new \UnexpectedValueException('Plugin '.$package->getName().' could not be initialized, class not found: '.$class);
|
throw new \UnexpectedValueException('Plugin '.$package->getName().' could not be initialized, class not found: '.$class);
|
||||||
|
@ -320,10 +320,18 @@ class PluginManager
|
||||||
* to do it.
|
* 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;
|
$this->plugins[] = $plugin;
|
||||||
$plugin->activate($this->composer, $this->io);
|
$plugin->activate($this->composer, $this->io);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue