Fix host options
parent
0042f199e7
commit
bcd5521cea
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue