Try connection with specified db when postgres does not work

Conflicts:

	lib/setup.php
This commit is contained in:
Brice Maron 2012-12-13 19:37:23 +00:00 committed by Morris Jobke
parent a39ecd5ea9
commit edc255421c
1 changed files with 7 additions and 1 deletions

View File

@ -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