From fe1e02dab9581d9ba3c9d8371e85072a959c8bce Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 29 May 2020 23:55:53 +0200 Subject: 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 --- app/Models/DatabaseDAO.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/Models/DatabaseDAO.php') diff --git a/app/Models/DatabaseDAO.php b/app/Models/DatabaseDAO.php index cfb150ab1..2e0ee25a0 100644 --- a/app/Models/DatabaseDAO.php +++ b/app/Models/DatabaseDAO.php @@ -21,7 +21,7 @@ class FreshRSS_DatabaseDAO extends Minz_ModelPdo { try { $sql = sprintf($SQL_CREATE_DB, empty($db['base']) ? '' : $db['base']); return $this->pdo->exec($sql) !== false; - } catch (PDOException $e) { + } catch (Exception $e) { $_SESSION['bd_error'] = $e->getMessage(); syslog(LOG_DEBUG, __method__ . ' warning: ' . $e->getMessage()); return false; @@ -34,7 +34,7 @@ class FreshRSS_DatabaseDAO extends Minz_ModelPdo { $stm = $this->pdo->query($sql); $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0); return $res != false; - } catch (PDOException $e) { + } catch (Exception $e) { $_SESSION['bd_error'] = $e->getMessage(); syslog(LOG_DEBUG, __method__ . ' warning: ' . $e->getMessage()); return false; -- cgit v1.2.3