Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-03-12 21:52:47 +0400
committerVincent Petry <pvince81@owncloud.com>2014-03-12 21:52:47 +0400
commitb2ac8755ced9e72a14715c44349f60bfa3f2c3bb (patch)
treedb9538a71c4cd73171ed0fbd2fe4b898f5909848 /lib
parent5fcfb2ef84d21691545d946fd2f244889dedab0a (diff)
parent428d2b6e0fcc687e6cca7c73263eacf7d460192f (diff)
Merge pull request #6632 from eduardosan/master
Fix PostgreSQL port configuration on install
Diffstat (limited to 'lib')
-rw-r--r--lib/private/setup/postgresql.php20
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/private/setup/postgresql.php b/lib/private/setup/postgresql.php
index 89d328ada19..4d0c9b52a4d 100644
--- a/lib/private/setup/postgresql.php
+++ b/lib/private/setup/postgresql.php
@@ -10,13 +10,20 @@ class PostgreSQL extends AbstractDatabase {
$e_user = addslashes($this->dbuser);
$e_password = addslashes($this->dbpassword);
+ // 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 +70,14 @@ 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'";
+ // 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'),