Explorar el Código

1888 postgresql unix socket workaround (#1889)

* Workaround to enable postgres unix socket instead of tcp

* Support Unix sockets for MySQL and PostgreSQL
Bartłomiej Cieszkowski hace 7 años
padre
commit
0ffc006a7e
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      lib/Minz/ModelPdo.php

+ 2 - 2
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'];
 					}