diff --git a/docker/phraseanet/setup/init-test-install.sh b/docker/phraseanet/setup/init-test-install.sh
index 3bb0696794..a63e210887 100755
--- a/docker/phraseanet/setup/init-test-install.sh
+++ b/docker/phraseanet/setup/init-test-install.sh
@@ -28,7 +28,7 @@ sleep 10
--lazaret-path=$PHRASEANET_LAZARET_DIR \
--caption-path=$PHRASEANET_CAPTION_DIR \
--worker-tmp-files=$PHRASEANET_WORKER_TMP \
- --data-path=/var/alchemy/Phraseanet/datas -y
+ --data-path=/var/alchemy/Phraseanet/datas -f
done
/var/alchemy/Phraseanet/bin/setup system:config set workers.queue.worker-queue.registry alchemy_worker.queue_registry
diff --git a/lib/Alchemy/Phrasea/Command/Setup/Install.php b/lib/Alchemy/Phrasea/Command/Setup/Install.php
index ab67337d57..863b77c600 100644
--- a/lib/Alchemy/Phrasea/Command/Setup/Install.php
+++ b/lib/Alchemy/Phrasea/Command/Setup/Install.php
@@ -61,6 +61,7 @@ public function __construct($name, $structureTemplate)
->addOption('scheduler-locks-path', null, InputOption::VALUE_OPTIONAL, 'Path to scheduler-locks repository', __DIR__ . '/../../../../../tmp/locks')
->addOption('worker-tmp-files', null, InputOption::VALUE_OPTIONAL, 'Path to worker-tmp-files repository', __DIR__ . '/../../../../../tmp')
->addOption('yes', 'y', InputOption::VALUE_NONE, 'Answer yes to all questions')
+ ->addOption('force', 'f', InputOption::VALUE_NONE, 'force to continue installation')
->setHelp("Phraseanet can only be installed on 64 bits PHP.");
;
@@ -93,32 +94,9 @@ protected function doExecute(InputInterface $input, OutputInterface $output)
/** @var DialogHelper $dialog */
$dialog = $this->getHelperSet()->get('dialog');
- $output->writeln("
- ,-._.-._.-._.-._.-.
- `-. ,-'
- .----------------------------------------------. | |
-| | | |
-| Hello ! | | |
-| | | |
-| You are on your way to install Phraseanet, | ,';\".________.-.
-| You will need access to 2 MySQL databases. | ;';_' )]
-| | ; `-|
-| `. `T- |
- `----------------------------------------------._ \ | |
- `-; | |
- |..________..-|
- /\/ |________..|
- ,'`./ >,( |
- \_.-|_/,-/ ii | |
- `.\"' `-/ .-\"\"\"|| |
- /`^\"-; | ||____|
- / / `.__/ | ||
- / | ||
- | ||
-"
- );
-
- if (!$input->getOption('yes') && !$input->getOption('appbox')) {
+ $output->writeln(" --- You are on your way to install Phraseanet, You will need access to 2 MySQL databases. --- ");
+
+ if (!$input->getOption('yes') && !$input->getOption('force') && !$input->getOption('appbox')) {
$continue = $dialog->askConfirmation($output, 'Do you have these two DB handy ? (N/y)', false);
if (!$continue) {
@@ -130,16 +108,30 @@ protected function doExecute(InputInterface $input, OutputInterface $output)
$serverName = $this->getServerName($input, $output, $dialog);
+ /** @var Connection $abConn */
$abConn = $this->getABConn($input, $output, $dialog, $serverName);
if(!$abConn) {
return 1; // no ab is fatal
}
+ if (!$input->getOption('force') && $abConn->getSchemaManager()->tablesExist(['users'])) {
+ $output->writeln("(*) Database table already exist in appbox! installation abort");
+
+ return 1;
+ }
+
list($dbConn, $templateName) = $this->getDBConn($input, $output, $abConn, $dialog);
+
+ if (!$input->getOption('force') && $dbConn->getSchemaManager()->tablesExist(['record'])) {
+ $output->writeln("(*) Database table already exist in databox! installation abort");
+
+ return 1;
+ }
+
list($email, $password) = $this->getCredentials($input, $output, $dialog);
$dataPath = $this->getDataPath($input, $output, $dialog);
- if (! $input->getOption('yes')) {
+ if (!$input->getOption('yes') && !$input->getOption('force')) {
$output->writeln("--- ElasticSearch connection settings ---");
}
@@ -154,7 +146,7 @@ protected function doExecute(InputInterface $input, OutputInterface $output)
$output->writeln('');
- if (!$input->getOption('yes')) {
+ if (!$input->getOption('yes') && !$input->getOption('force')) {
$continue = $dialog->askConfirmation($output, "Phraseanet is going to be installed, continue ? (N/y)", false);
if (!$continue) {
@@ -341,7 +333,7 @@ private function getDataPath(InputInterface $input, OutputInterface $output, Dia
{
$dataPath = $input->getOption('data-path');
- if (!$input->getOption('yes')) {
+ if (!$input->getOption('yes') && !$input->getOption('force')) {
$continue = $dialog->askConfirmation($output, 'Would you like to change default data-path ? (N/y)', false);
if ($continue) {
@@ -362,7 +354,7 @@ private function getServerName(InputInterface $input, OutputInterface $output, D
{
$serverName = $input->getOption('server-name');
- if (!$serverName && !$input->getOption('yes')) {
+ if (!$serverName && !$input->getOption('yes') && !$input->getOption('force')) {
do {
$serverName = $dialog->ask($output, 'Please provide the server name : ', null);
} while (!$serverName);
@@ -380,7 +372,7 @@ private function getESHost(InputInterface $input, OutputInterface $output, Dialo
$host = $input->getOption('es-host');
$port = (int) $input->getOption('es-port');
- if (! $input->getOption('yes')) {
+ if (! $input->getOption('yes') && !$input->getOption('force')) {
while (! $host) {
$host = $dialog->ask($output, 'ElasticSearch server host : ', null);
};
@@ -397,7 +389,7 @@ private function getESIndexName(InputInterface $input, OutputInterface $output,
{
$index = $input->getOption('es-index');
- if (! $input->getOption('yes')) {
+ if (!$input->getOption('yes') && !$input->getOption('force')) {
$index = $dialog->ask($output, 'ElasticSearch server index name (blank to autogenerate) : ', null);
}