diff options
author | Morris Jobke <morris.jobke@gmail.com> | 2013-06-14 02:50:01 -0700 |
---|---|---|
committer | Morris Jobke <morris.jobke@gmail.com> | 2013-06-14 02:50:01 -0700 |
commit | 8d62bb3aabb51ae0203541aa322e0f191542023d (patch) | |
tree | eafb7c8c9c71b48de08448561b8b7f2e1c7abc2d /lib | |
parent | 27f7ef49e49285ee8a2a0a078fdbe625815fc848 (diff) | |
parent | 7093b0829f5f603e8ff1de7d5130130d34b6be9a (diff) | |
download | nextcloud-server-8d62bb3aabb51ae0203541aa322e0f191542023d.tar.gz nextcloud-server-8d62bb3aabb51ae0203541aa322e0f191542023d.zip |
Merge pull request #3684 from owncloud/pg_install_db_master
Try connection with specified db when postgres does not work
Diffstat (limited to 'lib')
-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..1cbc83eed9a 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 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 |