1
0
Fork 0

Remove allow-plugin config on remove (#10615)

pull/11010/head
Christopher Hertel 2022-03-15 15:30:07 +01:00 committed by GitHub
parent c3a41b944e
commit 3a1e07f3cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -234,6 +234,18 @@ EOT
$commandEvent = new CommandEvent(PluginEvents::COMMAND, 'remove', $input, $output); $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'remove', $input, $output);
$composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent); $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
$allowPlugins = $composer->getConfig()->get('allow-plugins');
$removedPlugins = array_intersect(array_keys($allowPlugins), $packages);
if (!$dryRun && count($removedPlugins) !== 0) {
if (count($allowPlugins) === count($removedPlugins)) {
$json->removeConfigSetting('allow-plugins');
} else {
foreach ($removedPlugins as $plugin) {
$json->removeConfigSetting('allow-plugins.'.$plugin);
}
}
}
$composer->getInstallationManager()->setOutputProgress(!$input->getOption('no-progress')); $composer->getInstallationManager()->setOutputProgress(!$input->getOption('no-progress'));
$install = Installer::create($io, $composer); $install = Installer::create($io, $composer);