From 732c2ad8971f427ec196acfac53dad034cefdef4 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Sun, 22 Feb 2015 17:18:54 +0100 Subject: [PATCH] sqlite doesn't support getListDatabasesSQL --- app/config/parameters.yml.dist | 2 +- src/Wallabag/CoreBundle/Command/InstallCommand.php | 11 +++++++++++ .../CoreBundle/Tests/Command/InstallCommandTest.php | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index 258a585f..44969750 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist @@ -6,7 +6,7 @@ parameters: database_name: symfony database_user: root database_password: ~ - database_path: "%kernel.root_dir%/../data/db/poche.sqlite" + database_path: "%kernel.root_dir%/../data/db/wallabag.sqlite" mailer_transport: smtp mailer_host: 127.0.0.1 diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index a528c309..ac7583ea 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -283,6 +283,17 @@ class InstallCommand extends ContainerAwareCommand throw $exception; } + // custom verification for sqlite, since `getListDatabasesSQL` doesn't work for sqlite + if ('sqlite' == $schemaManager->getDatabasePlatform()->getName()) { + $params = $this->getContainer()->get('doctrine.dbal.default_connection')->getParams(); + + if (isset($params['path']) && file_exists($params['path'])) { + return true; + } + + return false; + } + return in_array($databaseName, $schemaManager->listDatabases()); } diff --git a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php index 6bcc9707..a091d66f 100644 --- a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php +++ b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php @@ -50,7 +50,7 @@ class InstallCommandTest extends WallabagTestCase $tester = new CommandTester($command); $tester->execute(array( - 'command' => $command->getName() + 'command' => $command->getName(), )); $this->assertContains('Step 1 of 4. Checking system requirements.', $tester->getDisplay()); -- 2.41.0