diff options
| author | 2016-09-05 21:09:15 +0200 | |
|---|---|---|
| committer | 2016-09-05 21:09:15 +0200 | |
| commit | 0564f5e1c4d85d34ec14a493dfa529fb724878d1 (patch) | |
| tree | c71c791f3e2701f16c9a53d5e32c218eac7a867c /lib/Minz/ModelPdo.php | |
| parent | 03211453704e90c85d5da3a9ef0553e49886de59 (diff) | |
Support custom MySQL ports
https://github.com/FreshRSS/FreshRSS/issues/1241
Diffstat (limited to 'lib/Minz/ModelPdo.php')
| -rw-r--r-- | lib/Minz/ModelPdo.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Minz/ModelPdo.php b/lib/Minz/ModelPdo.php index 845aecaae..f82045df9 100644 --- a/lib/Minz/ModelPdo.php +++ b/lib/Minz/ModelPdo.php @@ -53,13 +53,17 @@ class Minz_ModelPdo { self::$sharedCurrentUser = $currentUser; $driver_options = isset($conf->db['pdo_options']) && is_array($conf->db['pdo_options']) ? $conf->db['pdo_options'] : array(); + $dbServer = parse_url('db://' . $db['host']); try { $type = $db['type']; if ($type === 'mysql') { - $string = 'mysql:host=' . $db['host'] + $string = 'mysql:host=' . $dbServer['host'] . ';dbname=' . $db['base'] . ';charset=utf8mb4'; + if (!empty($dbServer['port'])) { + $string .= ';port=' . $dbServer['port']; + } $driver_options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET NAMES utf8mb4'; $this->prefix = $db['prefix'] . $currentUser . '_'; } elseif ($type === 'sqlite') { |
