From d139b067018e0a0a087e61a2023456560474d5df Mon Sep 17 00:00:00 2001 From: skodak Date: Tue, 4 Nov 2008 21:55:39 +0000 Subject: [PATCH] MDL-17020 pgsql: new port dboption --- lib/dml/pgsql_native_moodle_database.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/dml/pgsql_native_moodle_database.php b/lib/dml/pgsql_native_moodle_database.php index c662ef87a5..f13fbce555 100644 --- a/lib/dml/pgsql_native_moodle_database.php +++ b/lib/dml/pgsql_native_moodle_database.php @@ -92,7 +92,12 @@ class pgsql_native_moodle_database extends moodle_database { if (empty($this->dboptions['forcetcp']) and ($this->dbhost === 'localhost' or $this->dbhost === '127.0.0.1')) { $connection = "user='$this->dbuser' password='$pass' dbname='$this->dbname'"; } else { - $connection = "host='$this->dbhost' user='$this->dbuser' password='$pass' dbname='$this->dbname'"; + if (empty($this->dboptions['dbport'])) { + $port = 5432; + } else { + $port = $this->dboptions['dbport']; + } + $connection = "host='$this->dbhost' port='$port' user='$this->dbuser' password='$pass' dbname='$this->dbname'"; } if (empty($this->dboptions['dbpersit'])) { @@ -190,7 +195,7 @@ class pgsql_native_moodle_database extends moodle_database { $this->query_start($sql, null, SQL_QUERY_AUX); $result = pg_query($this->pgsql, $sql); $this->query_end($result); - + if ($result) { while ($row = pg_fetch_row($result)) { $tablename = reset($row); -- 2.39.5