From bcd5521ceab233034e4c290e26ecf110a92d2526 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Sun, 21 Oct 2018 15:36:25 +0300 Subject: [PATCH] Fix host options --- DatabasePdoPgsql.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DatabasePdoPgsql.php b/DatabasePdoPgsql.php index 98c636d..6c5b990 100644 --- a/DatabasePdoPgsql.php +++ b/DatabasePdoPgsql.php @@ -3,7 +3,7 @@ /** * PDO/PostgreSQL wrapper with (mostly) DatabaseMySQL interface :) * Select builder is inspired by MediaWiki's one. - * Version: 2018-10-09 + * Version: 2018-10-21 * (c) Vitaliy Filippov, 2015-2018 */ @@ -87,7 +87,7 @@ class DatabasePdoPgsql implements Database 'init' => array(), ); $options += $defOpts; - if ($options['socket']) + if ($options['socket'] && !$options['host']) { $options['host'] = 'localhost'; } @@ -110,7 +110,7 @@ class DatabasePdoPgsql implements Database function connect() { $str = "pgsql:port=".intval($this->port); - $str .= ";host='".($this->socket !== NULL ? $this->socket : $this->host)."';dbname='".$this->dbname."'"; + $str .= ";host='".($this->host == 'localhost' && $this->socket !== NULL ? $this->socket : $this->host)."';dbname='".$this->dbname."'"; try { $this->link = new PDO($str, $this->username, $this->password, array(