From 0d38b7b4595bb69421639856f2a8fe221e3d8e57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Niedzielski?= Date: Fri, 6 Oct 2023 13:03:16 +0200 Subject: [PATCH] [PoC] Added ability for installer to interact with user --- .../Command/InstallPlatformCommand.php | 3 +++ .../RepositoryInstaller/Installer/DbBasedInstaller.php | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php b/src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php index 542c6702ca..5540e52ec9 100644 --- a/src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php +++ b/src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php @@ -96,6 +96,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int } $installer->setOutput($output); + if ($input->isInteractive()) { + $installer->setInput($input); + } $installer->importSchema(); $installer->importData(); diff --git a/src/bundle/RepositoryInstaller/Installer/DbBasedInstaller.php b/src/bundle/RepositoryInstaller/Installer/DbBasedInstaller.php index 5c343563e4..cd7366eefc 100644 --- a/src/bundle/RepositoryInstaller/Installer/DbBasedInstaller.php +++ b/src/bundle/RepositoryInstaller/Installer/DbBasedInstaller.php @@ -8,6 +8,7 @@ use Doctrine\DBAL\Connection; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; +use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Filesystem\Filesystem; class DbBasedInstaller @@ -18,6 +19,8 @@ class DbBasedInstaller /** @var \Symfony\Component\Console\Output\OutputInterface */ protected $output; + protected ?InputInterface $input = null; + /** @var string */ protected $baseDataDir; @@ -36,6 +39,11 @@ public function setOutput($output) $this->output = $output; } + public function setInput(InputInterface $input): void + { + $this->input = $input; + } + /** * Copy and override configuration file. *