From d258ade35e0fe80d347b4ac661f25c9224fb87cc Mon Sep 17 00:00:00 2001 From: eduardo Date: Sat, 4 Jan 2014 19:23:25 -0200 Subject: [PATCH 1/4] Fix PostgreSQL port configuration on install --- lib/private/setup/postgresql.php | 22 +++++++++++++++++++--- 1 file 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'), From 569851fa0ea5367d84c411cdb8a6f8fafff695da Mon Sep 17 00:00:00 2001 From: eduardo Date: Sun, 5 Jan 2014 12:38:54 -0200 Subject: [PATCH 2/4] Add tabs to conformance with owncloud code standards --- lib/private/setup/postgresql.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/private/setup/postgresql.php b/lib/private/setup/postgresql.php index b5e3d5f8970..dc1df115d93 100644 --- a/lib/private/setup/postgresql.php +++ b/lib/private/setup/postgresql.php @@ -10,8 +10,8 @@ class PostgreSQL extends AbstractDatabase { $e_user = addslashes($this->dbuser); $e_password = addslashes($this->dbpassword); - // Eduardo: 04/01/2013 - // Fix database with port connection + // Eduardo: 04/01/2013 + // Fix database with port connection if(strpos($e_host, ':')) { list($e_host, $port)=explode(':', $e_host, 2); } else { @@ -71,8 +71,8 @@ class PostgreSQL extends AbstractDatabase { $e_user = addslashes($this->dbuser); $e_password = addslashes($this->dbpassword); - // Eduardo: 04/01/2013 - // Fix database with port connection + // Eduardo: 04/01/2013 + // Fix database with port connection if(strpos($e_host, ':')) { list($e_host, $port)=explode(':', $e_host, 2); } else { From 938ece1a3fda68102f9ce2a02dddff882b1da6ff Mon Sep 17 00:00:00 2001 From: eduardo Date: Wed, 8 Jan 2014 00:15:08 -0200 Subject: [PATCH 3/4] Remove name from code --- lib/private/setup/postgresql.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/private/setup/postgresql.php b/lib/private/setup/postgresql.php index dc1df115d93..6065cee80c8 100644 --- a/lib/private/setup/postgresql.php +++ b/lib/private/setup/postgresql.php @@ -10,7 +10,6 @@ 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); @@ -71,7 +70,6 @@ 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); From 428d2b6e0fcc687e6cca7c73263eacf7d460192f Mon Sep 17 00:00:00 2001 From: eduardo Date: Wed, 8 Jan 2014 00:16:37 -0200 Subject: [PATCH 4/4] Remove unused spaces --- lib/private/setup/postgresql.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/private/setup/postgresql.php b/lib/private/setup/postgresql.php index 6065cee80c8..4d0c9b52a4d 100644 --- a/lib/private/setup/postgresql.php +++ b/lib/private/setup/postgresql.php @@ -23,7 +23,7 @@ class PostgreSQL extends AbstractDatabase { 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' port='$port' 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) @@ -77,7 +77,7 @@ class PostgreSQL extends AbstractDatabase { $port=false; } - $connection_string = "host='$e_host' dbname='$e_dbname' user='$e_user' port='$port' 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) { throw new \DatabaseSetupException($this->trans->t('PostgreSQL username and/or password not valid'),