Skip to content

Commit

Permalink
IBX-7769 added safety check to ibexa:install command when tables in d…
Browse files Browse the repository at this point in the history
…atabase exists
  • Loading branch information
papcio122 committed Feb 16, 2024
1 parent 855d3fd commit ec8d40d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\BufferedOutput;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Process\PhpExecutableFinder;
use Symfony\Component\Process\Process;

Expand Down Expand Up @@ -84,6 +85,16 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$this->checkParameters();
$this->checkCreateDatabase($output);

$schemaManager = $this->connection->getSchemaManager();
if (!empty($schemaManager->listTables())) {
$helper = $this->getHelper('question');
$question = new ConfirmationQuestion('Running this command will delete current data in database. Continue?');

if (!$helper->ask($input, $output, $question)) {

Check failure on line 93 in src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php

View workflow job for this annotation

GitHub Actions / Unit tests & SQLite integration tests (8.1)

Call to an undefined method Symfony\Component\Console\Helper\HelperInterface::ask().

Check failure on line 93 in src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php

View workflow job for this annotation

GitHub Actions / Unit tests & SQLite integration tests (7.4)

Call to an undefined method Symfony\Component\Console\Helper\HelperInterface::ask().

Check failure on line 93 in src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php

View workflow job for this annotation

GitHub Actions / Unit tests & SQLite integration tests (8.0)

Call to an undefined method Symfony\Component\Console\Helper\HelperInterface::ask().
return 0;
}
}

$type = $input->getArgument('type');
$siteaccess = $input->getOption('siteaccess');
$installer = $this->getInstaller($type);
Expand Down

0 comments on commit ec8d40d

Please sign in to comment.