Skip to content

Commit bc6657b

Browse files
committed
Update DB to allow for a new optional port and sock.
1 parent cc7c779 commit bc6657b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

server/core/API.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function getDB() {
8686

8787
function connect() {
8888
$this->db = new \core\DB();
89-
$this->db->connect(DB_HOST, DB_USER_NAME, DB_PASSWORD, DB_NAME);
89+
$this->db->connect(DB_HOST, DB_USER_NAME, DB_PASSWORD, DB_NAME, DB_PORT, DB_SOCK);
9090
}
9191

9292
function result($data, $time=null) {

server/core/DB.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ class DB {
2323

2424
private $_isConnected;
2525

26-
function connect($host, $username, $password, $dbName) {
26+
function connect($host, $username, $password, $dbName, $dbPort = null, $dbSock = null) {
2727
mysqli_report(MYSQLI_REPORT_STRICT);
2828

2929
$this->_inTransaction = false;
3030
$this->_isConnected = false;
3131

3232
try {
33-
$this->mysqli = new \mysqli($host, $username, $password, $dbName);
33+
$this->mysqli = new \mysqli($host, $username, $password, $dbName, $dbPort, $dbSock);
3434
} catch (\Exception $e) {
3535
throw new \core\APIError(\core\ErrorCodes::MYSQL_CONNECTION_ERR, "MySQL connection error {$e}");
3636
}

0 commit comments

Comments
 (0)