diff options
| author | 2018-05-26 23:13:14 +0200 | |
|---|---|---|
| committer | 2018-05-26 23:13:14 +0200 | |
| commit | 0ffc006a7edcf36853c7133c9adba3c095b923cf (patch) | |
| tree | 7068fc00b61a548f23b753163ec20d9b6e993cc1 /lib/Minz/ModelPdo.php | |
| parent | 4ff6613989a8f1ee2959b4d31466205f00aaec52 (diff) | |
1888 postgresql unix socket workaround (#1889)
* Workaround to enable postgres unix socket instead of tcp
* Support Unix sockets for MySQL and PostgreSQL
Diffstat (limited to 'lib/Minz/ModelPdo.php')
| -rw-r--r-- | lib/Minz/ModelPdo.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Minz/ModelPdo.php b/lib/Minz/ModelPdo.php index 6928a2857..733982c14 100644 --- a/lib/Minz/ModelPdo.php +++ b/lib/Minz/ModelPdo.php @@ -58,7 +58,7 @@ class Minz_ModelPdo { try { switch ($db['type']) { case 'mysql': - $string = 'mysql:host=' . $dbServer['host'] . ';dbname=' . $db['base'] . ';charset=utf8mb4'; + $string = 'mysql:host=' . (empty($dbServer['host']) ? $db['host'] : $dbServer['host']) . ';dbname=' . $db['base'] . ';charset=utf8mb4'; if (!empty($dbServer['port'])) { $string .= ';port=' . $dbServer['port']; } @@ -73,7 +73,7 @@ class Minz_ModelPdo { $this->bd->exec('PRAGMA foreign_keys = ON;'); break; case 'pgsql': - $string = 'pgsql:host=' . $dbServer['host'] . ';dbname=' . $db['base']; + $string = 'pgsql:host=' . (empty($dbServer['host']) ? $db['host'] : $dbServer['host']) . ';dbname=' . $db['base']; if (!empty($dbServer['port'])) { $string .= ';port=' . $dbServer['port']; } |
