From: Brice Maron Date: Thu, 13 Dec 2012 19:37:23 +0000 (+0000) Subject: Try connection with specified db when postgres does not work X-Git-Tag: v6.0.0alpha2~633^2~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=edc255421c6b11be90b11d513ab92cac9fd09e1a;p=nextcloud-server.git Try connection with specified db when postgres does not work Conflicts: lib/setup.php --- diff --git a/lib/setup.php b/lib/setup.php index 71a2d13937e..0db565c6a66 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -320,7 +320,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 DatabaseSetupException($l->t('PostgreSQL username and/or password not valid')); + // Try if we can't connect with the specified DB name + $e_dbname = addslashes($dbname); + $connection_string = "host='$e_host' dbname='$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