Remove allow-plugin config on remove (#10615)

main
Christopher Hertel 2 years ago committed by GitHub
parent c3a41b944e
commit 3a1e07f3cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -234,6 +234,18 @@ EOT
$commandEvent = new CommandEvent(PluginEvents::COMMAND, 'remove', $input, $output);
$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'));
$install = Installer::create($io, $composer);

Loading…
Cancel
Save