diff --git a/src/Composer/Command/BaseCommand.php b/src/Composer/Command/BaseCommand.php index ed318e079589..b6b1439de5af 100644 --- a/src/Composer/Command/BaseCommand.php +++ b/src/Composer/Command/BaseCommand.php @@ -223,6 +223,15 @@ protected function initialize(InputInterface $input, OutputInterface $output) // initialize a plugin-enabled Composer instance, either local or global $disablePlugins = $input->hasParameterOption('--no-plugins'); $disableScripts = $input->hasParameterOption('--no-scripts'); + + $application = parent::getApplication(); + if ($application instanceof Application && $application->getDisablePluginsByDefault()) { + $disablePlugins = true; + } + if ($application instanceof Application && $application->getDisableScriptsByDefault()) { + $disableScripts = true; + } + if ($this instanceof SelfUpdateCommand) { $disablePlugins = true; $disableScripts = true; diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index a74a6c69d3cf..b747ea021a2e 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -659,6 +659,16 @@ public function getInitialWorkingDirectory() return $this->initialWorkingDirectory; } + public function getDisablePluginsByDefault(): bool + { + return $this->disablePluginsByDefault; + } + + public function getDisableScriptsByDefault(): bool + { + return $this->disableScriptsByDefault; + } + /** * @return 'prompt'|bool */