Fixed issue with DB_PORT not applying (#710)

This commit is contained in:
Roman Kelesidis 2023-05-23 14:34:20 +07:00 committed by GitHub
commit 95d280175a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -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'),

View file

@ -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']);