mirror of
https://github.com/wallabag/wallabag.git
synced 2024-10-31 22:28:54 +00:00
Fix installer when database not exists
This commit is contained in:
parent
911e0238b7
commit
2c688daf2a
1 changed files with 5 additions and 4 deletions
|
@ -372,24 +372,25 @@ class InstallCommand extends Command
|
||||||
private function isDatabasePresent()
|
private function isDatabasePresent()
|
||||||
{
|
{
|
||||||
$connection = $this->entityManager->getConnection();
|
$connection = $this->entityManager->getConnection();
|
||||||
$databaseName = $connection->getDatabase();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$schemaManager = $connection->getSchemaManager();
|
$databaseName = $connection->getDatabase();
|
||||||
} catch (\Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
// mysql & sqlite
|
// mysql & sqlite
|
||||||
if (false !== strpos($exception->getMessage(), sprintf("Unknown database '%s'", $databaseName))) {
|
if (false !== strpos($exception->getMessage(), 'Unknown database')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// pgsql
|
// pgsql
|
||||||
if (false !== strpos($exception->getMessage(), sprintf('database "%s" does not exist', $databaseName))) {
|
if (false !== strpos($exception->getMessage(), 'does not exist')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw $exception;
|
throw $exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$schemaManager = $connection->getSchemaManager();
|
||||||
|
|
||||||
// custom verification for sqlite, since `getListDatabasesSQL` doesn't work for sqlite
|
// custom verification for sqlite, since `getListDatabasesSQL` doesn't work for sqlite
|
||||||
if ('sqlite' === $schemaManager->getDatabasePlatform()->getName()) {
|
if ('sqlite' === $schemaManager->getDatabasePlatform()->getName()) {
|
||||||
$params = $connection->getParams();
|
$params = $connection->getParams();
|
||||||
|
|
Loading…
Reference in a new issue