X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FCommand%2FInstallCommand.php;h=491c67f9fc99533c7e49ec7cd12cc6a7a883adea;hb=9e07dc982c92eb35ab82dffaab9c4a0b54ad7364;hp=a528c3098275a6ec59a22d60a61acbfccfa994d5;hpb=0bf99bb144561525a34a50315b95efd6f543fe35;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index a528c309..491c67f9 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -198,6 +198,7 @@ class InstallCommand extends ContainerAwareCommand $config = new Config($user); $config->setTheme($this->getContainer()->getParameter('theme')); $config->setItemsPerPage($this->getContainer()->getParameter('items_on_page')); + $config->setRssLimit($this->getContainer()->getParameter('rss_limit')); $config->setLanguage($this->getContainer()->getParameter('language')); $em->persist($config); @@ -224,7 +225,7 @@ class InstallCommand extends ContainerAwareCommand } /** - * Run a command + * Run a command. * * @param string $command * @param array $parameters Parameters to this command (usually 'force' => true) @@ -265,9 +266,9 @@ class InstallCommand extends ContainerAwareCommand } /** - * Check if the database already exists + * Check if the database already exists. * - * @return boolean + * @return bool */ private function isDatabasePresent() { @@ -283,18 +284,30 @@ 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()); } /** - * Check if the schema is already created + * Check if the schema is already created. + * If we found at least oen table, it means the schema exists. * - * @return boolean + * @return bool */ private function isSchemaPresent() { $schemaManager = $this->getContainer()->get('doctrine')->getManager()->getConnection()->getSchemaManager(); - return $schemaManager->tablesExist(array('entry')); + return count($schemaManager->listTableNames()) > 0 ? true : false; } }