From 64b18f75b96700bbbc58ff2e8f10fc3db6da9f73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20S=CC=8Ckoda?= Date: Sun, 30 Mar 2014 10:06:39 +0800 Subject: [PATCH] MDL-44862 always add dbport to dbsocket in pg driver This should hopefully resolve problems when using sockets connection to pg servers running on non-standard ports. --- lib/dml/pgsql_native_moodle_database.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/dml/pgsql_native_moodle_database.php b/lib/dml/pgsql_native_moodle_database.php index 2a820ab2957..53d4cd3c094 100644 --- a/lib/dml/pgsql_native_moodle_database.php +++ b/lib/dml/pgsql_native_moodle_database.php @@ -144,6 +144,10 @@ class pgsql_native_moodle_database extends moodle_database { $connection = "user='$this->dbuser' password='$pass' dbname='$this->dbname'"; if (strpos($this->dboptions['dbsocket'], '/') !== false) { $connection = $connection." host='".$this->dboptions['dbsocket']."'"; + if (!empty($this->dboptions['dbport'])) { + // Somehow non-standard port is important for sockets - see MDL-44862. + $connection = $connection." port ='".$this->dboptions['dbport']."'"; + } } } else { $this->dboptions['dbsocket'] = '';