aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Command/InstallCommand.php
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-04-10 15:34:32 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-04-10 15:34:32 +0200
commit69c21157baa16ac838d408607856dd653da919d8 (patch)
tree63b19ff0abe92a73ab8156409870297dbfdef274 /src/Wallabag/CoreBundle/Command/InstallCommand.php
parent615fc1d237a5b6f6ee1b9a1f7cea31f0738dae02 (diff)
downloadwallabag-69c21157baa16ac838d408607856dd653da919d8.tar.gz
wallabag-69c21157baa16ac838d408607856dd653da919d8.tar.zst
wallabag-69c21157baa16ac838d408607856dd653da919d8.zip
Force server version to avoid connexion error
When installing a new project with MySQL, if the database doesn't exist before installation will fail because DBAL will try to get the server version by querying it. And since this query is done using the default database connexion and since the database doesn't exist, DBAL can't connect to the server.
Diffstat (limited to 'src/Wallabag/CoreBundle/Command/InstallCommand.php')
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index c5a5a519..2e4a59df 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -455,7 +455,13 @@ class InstallCommand extends ContainerAwareCommand
455 return false; 455 return false;
456 } 456 }
457 457
458 return in_array($databaseName, $schemaManager->listDatabases()); 458 try {
459 return in_array($databaseName, $schemaManager->listDatabases());
460 } catch (\Doctrine\DBAL\Exception\ConnectionException $e) {
461 // it means we weren't able to get database list, assume the database doesn't exist
462
463 return false;
464 }
459 } 465 }
460 466
461 /** 467 /**