From 33e1ed607426251e3696b7162e8e640b31eed422 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Fri, 4 Oct 2013 07:54:22 +0200 Subject: [PATCH] Try connection with specified db when postgres does not work --- lib/setup.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/setup.php b/lib/setup.php index 5d5ef77899f..2a43f7b4475 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -328,7 +328,13 @@ class OC_Setup { $connection_string = "host='$e_host' dbname=postgres user='$e_user' password='$e_password'"; $connection = @pg_connect($connection_string); if(!$connection) { - throw new Exception($l->t('PostgreSQL username and/or password not valid')); + // Try if we can connect to the DB with the specified name + $e_dbname = addslashes($dbname); + $connection_string = "host='$e_host' dbname='$e_dbname' user='$e_user' password='$e_password'"; + $connection = @pg_connect($connection_string); + + if(!$connection) + throw new DatabaseSetupException($l->t('PostgreSQL username and/or password not valid')); } $e_user = pg_escape_string($dbuser); //check for roles creation rights in postgresql -- 2.39.5