From 6e798079cac679f9bcab4c81a7f2156c0ead841e Mon Sep 17 00:00:00 2001 From: Filip Iulian Pacurar Date: Sat, 23 Feb 2019 00:40:47 +0200 Subject: [PATCH] Defer plugin installs from october:install until October is installed (#4156) Fixes #4155. Credit to @filipac. --- modules/system/console/OctoberInstall.php | 29 +++++++++++++---------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/modules/system/console/OctoberInstall.php b/modules/system/console/OctoberInstall.php index 415cae64d..204b71d4e 100644 --- a/modules/system/console/OctoberInstall.php +++ b/modules/system/console/OctoberInstall.php @@ -71,16 +71,27 @@ class OctoberInstall extends Command $this->setupAdminUser(); $this->setupCommonValues(); + $chosenToInstall = []; + if ($this->confirm('Configure advanced options?', false)) { $this->setupEncryptionKey(); $this->setupAdvancedValues(); - $this->askToInstallPlugins(); + $chosenToInstall = $this->askToInstallPlugins(); } else { $this->setupEncryptionKey(true); } $this->setupMigrateDatabase(); + + foreach ($chosenToInstall as $pluginCode) { + $this->output->writeln('Installing plugin ' . $pluginCode . ''); + $this->callSilent('plugin:install', [ + 'name' => $pluginCode + ]); + $this->output->writeln('' . $pluginCode . ' installed successfully.'); + } + $this->displayOutro(); } @@ -120,20 +131,14 @@ class OctoberInstall extends Command } protected function askToInstallPlugins() { + $chosenToInstall = []; if ($this->confirm('Install the October.Drivers plugin?', false)) { - $this->output->writeln('Installing plugin October.Drivers'); - $this->callSilent('plugin:install', [ - 'name' => 'October.Drivers' - ]); - $this->output->writeln('October.Drivers installed successfully.'); + $chosenToInstall[] = 'October.Drivers'; } - if($this->confirm('Install the Rainlab.Builder plugin?', false)) { - $this->output->writeln('Installing plugin Rainlab.Builder'); - $this->callSilent('plugin:install', [ - 'name' => 'Rainlab.Builder' - ]); - $this->output->writeln('Rainlab.Builder installed successfully.'); + if ($this->confirm('Install the Rainlab.Builder plugin?', false)) { + $chosenToInstall[] = 'Rainlab.Builder'; } + return $chosenToInstall; } //