aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/setup
diff options
context:
space:
mode:
authoreduardo <eduardo@vnexu.net>2014-01-04 19:23:25 -0200
committereduardo <eduardo@vnexu.net>2014-01-04 19:23:25 -0200
commitd258ade35e0fe80d347b4ac661f25c9224fb87cc (patch)
tree275df0d44320f29764d228192fd18551e604a21a /lib/private/setup
parentaaa48576eec42388bc923a60aeb9c92ef2ff9ca4 (diff)
downloadnextcloud-server-d258ade35e0fe80d347b4ac661f25c9224fb87cc.tar.gz
nextcloud-server-d258ade35e0fe80d347b4ac661f25c9224fb87cc.zip
Fix PostgreSQL port configuration on install
Diffstat (limited to 'lib/private/setup')
-rw-r--r--lib/private/setup/postgresql.php22
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/private/setup/postgresql.php b/lib/private/setup/postgresql.php
index 89d328ada19..b5e3d5f8970 100644
--- a/lib/private/setup/postgresql.php
+++ b/lib/private/setup/postgresql.php
@@ -10,13 +10,21 @@ class PostgreSQL extends AbstractDatabase {
$e_user = addslashes($this->dbuser);
$e_password = addslashes($this->dbpassword);
+ // Eduardo: 04/01/2013
+ // Fix database with port connection
+ if(strpos($e_host, ':')) {
+ list($e_host, $port)=explode(':', $e_host, 2);
+ } else {
+ $port=false;
+ }
+
//check if the database user has admin rights
- $connection_string = "host='$e_host' dbname=postgres user='$e_user' password='$e_password'";
+ $connection_string = "host='$e_host' dbname=postgres user='$e_user' port='$port' password='$e_password'";
$connection = @pg_connect($connection_string);
if(!$connection) {
// Try if we can connect to the DB with the specified name
$e_dbname = addslashes($this->dbname);
- $connection_string = "host='$e_host' dbname='$e_dbname' user='$e_user' password='$e_password'";
+ $connection_string = "host='$e_host' dbname='$e_dbname' user='$e_user' port='$port' password='$e_password'";
$connection = @pg_connect($connection_string);
if(!$connection)
@@ -63,7 +71,15 @@ class PostgreSQL extends AbstractDatabase {
$e_user = addslashes($this->dbuser);
$e_password = addslashes($this->dbpassword);
- $connection_string = "host='$e_host' dbname='$e_dbname' user='$e_user' password='$e_password'";
+ // Eduardo: 04/01/2013
+ // Fix database with port connection
+ if(strpos($e_host, ':')) {
+ list($e_host, $port)=explode(':', $e_host, 2);
+ } else {
+ $port=false;
+ }
+
+ $connection_string = "host='$e_host' dbname='$e_dbname' user='$e_user' port='$port' password='$e_password'";
$connection = @pg_connect($connection_string);
if(!$connection) {
throw new \DatabaseSetupException($this->trans->t('PostgreSQL username and/or password not valid'),