From 95d280175acdf3e4588c6640baf2c1096421e3f4 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Tue, 23 May 2023 14:34:20 +0700 Subject: [PATCH] Fixed issue with DB_PORT not applying (#710) --- library/config.php | 1 + src/Legacy/SqlDb.php | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/library/config.php b/library/config.php index 44a484ae7..dd182e61d 100644 --- a/library/config.php +++ b/library/config.php @@ -31,6 +31,7 @@ $bb_cfg['db'] = [ 'db' => [ // Don't change the settings here!!! Go to .env file env('DB_HOST', 'localhost'), + env('DB_PORT', 3306), env('DB_DATABASE', 'torrentpier'), env('DB_USERNAME', 'root'), env('DB_PASSWORD'), diff --git a/src/Legacy/SqlDb.php b/src/Legacy/SqlDb.php index 9ceb9e17d..3dd0349b1 100644 --- a/src/Legacy/SqlDb.php +++ b/src/Legacy/SqlDb.php @@ -19,7 +19,7 @@ use TorrentPier\Dev; class SqlDb { public $cfg = []; - public $cfg_keys = ['dbhost', 'dbname', 'dbuser', 'dbpasswd', 'charset', 'persist']; + public $cfg_keys = ['dbhost', 'dbport', 'dbname', 'dbuser', 'dbpasswd', 'charset', 'persist']; private $link; public $result; public $db_server = ''; @@ -97,11 +97,11 @@ class SqlDb */ public function connect() { - $this->cur_query = $this->dbg_enabled ? "connect to: {$this->cfg['dbhost']}" : 'connect'; + $this->cur_query = $this->dbg_enabled ? "connect to: {$this->cfg['dbhost']}:{$this->cfg['dbport']}" : 'connect'; $this->debug('start'); $p = ((bool)$this->cfg['persist']) ? 'p:' : ''; - $this->link = mysqli_connect($p . $this->cfg['dbhost'], $this->cfg['dbuser'], $this->cfg['dbpasswd'], $this->cfg['dbname']); + $this->link = mysqli_connect($p . $this->cfg['dbhost'], $this->cfg['dbuser'], $this->cfg['dbpasswd'], $this->cfg['dbname'], $this->cfg['dbport']); $this->selected_db = $this->cfg['dbname']; register_shutdown_function([&$this, 'close']);