Add custom port to userdata.inc.php

This commit is contained in:
xWuZaa
2015-05-07 19:58:48 +02:00
parent ec77e47cd6
commit bd5647351e

View File

@@ -236,12 +236,14 @@ class Database {
$password = $sql_root[self::$_dbserver]['password']; $password = $sql_root[self::$_dbserver]['password'];
$host = $sql_root[self::$_dbserver]['host']; $host = $sql_root[self::$_dbserver]['host'];
$socket = isset($sql_root[self::$_dbserver]['socket']) ? $sql_root[self::$_dbserver]['socket'] : null; $socket = isset($sql_root[self::$_dbserver]['socket']) ? $sql_root[self::$_dbserver]['socket'] : null;
$port = isset($sql_root[self::$_dbserver]['port']) ? $sql_root[self::$_dbserver]['port'] : '3306';
} else { } else {
$caption = 'localhost'; $caption = 'localhost';
$user = $sql["user"]; $user = $sql["user"];
$password = $sql["password"]; $password = $sql["password"];
$host = $sql["host"]; $host = $sql["host"];
$socket = isset($sql['socket']) ? $sql['socket'] : null; $socket = isset($sql['socket']) ? $sql['socket'] : null;
$port = isset($sql['port']) ? $sql['port'] : '3306';
} }
// save sql-access-data if needed // save sql-access-data if needed
@@ -250,6 +252,7 @@ class Database {
'user' => $user, 'user' => $user,
'passwd' => $password, 'passwd' => $password,
'host' => $host, 'host' => $host,
'port' => $port,
'socket' => $socket, 'socket' => $socket,
'db' => $sql["db"], 'db' => $sql["db"],
'caption' => $caption 'caption' => $caption
@@ -271,6 +274,7 @@ class Database {
$dbconf["dsn"]['unix_socket'] = makeCorrectFile($socket); $dbconf["dsn"]['unix_socket'] = makeCorrectFile($socket);
} else { } else {
$dbconf["dsn"]['host'] = $host; $dbconf["dsn"]['host'] = $host;
$dbconf["dsn"]['port'] = $port;
} }
self::$_dbname = $sql["db"]; self::$_dbname = $sql["db"];