aboutsummaryrefslogtreecommitdiff
path: root/lib/lib_install.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2020-05-29 23:55:53 +0200
committerGravatar GitHub <noreply@github.com> 2020-05-29 23:55:53 +0200
commitfe1e02dab9581d9ba3c9d8371e85072a959c8bce (patch)
treeabad300f5ea5269e9f6dd915be962feca4847832 /lib/lib_install.php
parent19b94b648bf9e8dbc79ccc1765a295660a85e1f8 (diff)
Fix PostgreSQL database auto-create with limited rights (#3013)
* Fix PostgreSQL database auto-create with limited rights #fix https://github.com/FreshRSS/FreshRSS/issues/3009 Install would fail if the user is not even allowed to connect to the default `postgres` database. * Confused by custom Minz_PDOConnectionException
Diffstat (limited to 'lib/lib_install.php')
-rw-r--r--lib/lib_install.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/lib_install.php b/lib/lib_install.php
index 29dbc7b67..411938059 100644
--- a/lib/lib_install.php
+++ b/lib/lib_install.php
@@ -94,13 +94,19 @@ function initDb() {
//For first connection, use default database for PostgreSQL, empty database for MySQL / MariaDB:
$db['base'] = $db['type'] === 'pgsql' ? 'postgres' : '';
$conf->db = $db;
- //First connection without database name to create the database
- $databaseDAO = FreshRSS_Factory::createDatabaseDAO();
+ try {
+ //First connection without database name to create the database
+ $databaseDAO = FreshRSS_Factory::createDatabaseDAO();
+ } catch (Exception $ex) {
+ $databaseDAO = null;
+ }
//Restore final database parameters for auto-creation and for future connections
$db['base'] = $dbBase;
$conf->db = $db;
- //Perfom database auto-creation
- $databaseDAO->create();
+ if ($databaseDAO != null) {
+ //Perfom database auto-creation
+ $databaseDAO->create();
+ }
}
//New connection with the database name