$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);
}
/**
- * Run a command
+ * Run a command.
*
* @param string $command
* @param array $parameters Parameters to this command (usually 'force' => true)
}
/**
- * Check if the database already exists
+ * Check if the database already exists.
*
- * @return boolean
+ * @return bool
*/
private function isDatabasePresent()
{
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;
}
}