diff options
author | Brice Maron <brice@bmaron.net> | 2012-12-13 19:37:23 +0000 |
---|---|---|
committer | Morris Jobke <morris.jobke@gmail.com> | 2013-06-12 14:36:07 +0200 |
commit | edc255421c6b11be90b11d513ab92cac9fd09e1a (patch) | |
tree | 37a9bb995d29636f4d14e1706bc8c11cbe8ccaac /lib/setup.php | |
parent | a39ecd5ea977f18fac9c7c3683a7988434f6b95f (diff) | |
download | nextcloud-server-edc255421c6b11be90b11d513ab92cac9fd09e1a.tar.gz nextcloud-server-edc255421c6b11be90b11d513ab92cac9fd09e1a.zip |
Try connection with specified db when postgres does not work
Conflicts:
lib/setup.php
Diffstat (limited to 'lib/setup.php')
-rw-r--r-- | lib/setup.php | 8 |
1 files changed, 7 insertions, 1 deletions
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 |