diff options
-rw-r--r-- | config/ampache.cfg.php.dist | 6 | ||||
-rwxr-xr-x | docs/CHANGELOG.md | 1 | ||||
-rw-r--r-- | lib/class/dba.class.php | 9 |
3 files changed, 14 insertions, 2 deletions
diff --git a/config/ampache.cfg.php.dist b/config/ampache.cfg.php.dist index ac9b6dc2..ff05b6f5 100644 --- a/config/ampache.cfg.php.dist +++ b/config/ampache.cfg.php.dist @@ -26,10 +26,14 @@ config_version = 12 ; Session and Login Variables # ;############################## -; Hostname of your Database +; Hostname of your database ; DEFAULT: localhost database_hostname = localhost +; Port to use when connecting to your database +; DEFAULT: none +; database_port = 3306 + ; Name of your ampache database ; DEFAULT: ampache database_name = ampache diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index f4dd5eb4..9aaf117b 100755 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -3,6 +3,7 @@ CHANGELOG 3.6-FUTURE ---------- +- Added support for nonstandard database ports - Updated getID3 to 1.9.5 - Improved the performance of stream playlist creation (reported by AkbarSerad) - Fixed "Pure Random" / Random URLs (reported by mafe) diff --git a/lib/class/dba.class.php b/lib/class/dba.class.php index 8cbc6f55..f611751f 100644 --- a/lib/class/dba.class.php +++ b/lib/class/dba.class.php @@ -231,9 +231,16 @@ class Dba { $username = Config::get('database_username'); $hostname = Config::get('database_hostname'); $password = Config::get('database_password'); + $port = Config::get('database_port'); + + // Build the data source name + $dsn = 'mysql:host=' . $hostname ?: 'localhost'; + if ($port) { + $dsn .= ';port=' . intval($port); + } try { - $dbh = new PDO('mysql:host=' . $hostname, $username, $password); + $dbh = new PDO($dsn, $username, $password); } catch (PDOException $e) { debug_event('Dba', 'Connection failed: ' . $e->getMessage(), 1); |