]> source.dussan.org Git - nextcloud-server.git/commitdiff
Try connection with specified db when postgres does not work
authorBrice Maron <brice@bmaron.net>
Thu, 13 Dec 2012 19:37:23 +0000 (19:37 +0000)
committerMorris Jobke <morris.jobke@gmail.com>
Wed, 12 Jun 2013 12:36:07 +0000 (14:36 +0200)
Conflicts:

lib/setup.php

lib/setup.php

index 71a2d13937e70e1af668a30f1f2ec8cbd7d9026f..0db565c6a66ba81ec68a816af0d22cc6963f001f 100644 (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