1
0
Fork 0

Fix automatic disabling of plugins when running non-interactive as root

pull/11829/head
Jordi Boggiano 2024-01-26 17:39:30 +01:00
parent b1bd22f37c
commit 7048ff3808
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
2 changed files with 19 additions and 0 deletions

View File

@ -223,6 +223,15 @@ abstract class BaseCommand extends Command
// initialize a plugin-enabled Composer instance, either local or global // initialize a plugin-enabled Composer instance, either local or global
$disablePlugins = $input->hasParameterOption('--no-plugins'); $disablePlugins = $input->hasParameterOption('--no-plugins');
$disableScripts = $input->hasParameterOption('--no-scripts'); $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) { if ($this instanceof SelfUpdateCommand) {
$disablePlugins = true; $disablePlugins = true;
$disableScripts = true; $disableScripts = true;

View File

@ -657,6 +657,16 @@ class Application extends BaseApplication
return $this->initialWorkingDirectory; return $this->initialWorkingDirectory;
} }
public function getDisablePluginsByDefault(): bool
{
return $this->disablePluginsByDefault;
}
public function getDisableScriptsByDefault(): bool
{
return $this->disableScriptsByDefault;
}
/** /**
* @return 'prompt'|bool * @return 'prompt'|bool
*/ */