mirror of
https://gitlab.com/ruany/litebans-php.git
synced 2025-05-23 08:29:06 +00:00
Add mariadb driver support
This commit is contained in:
parent
efa7f17364
commit
6ef64fefde
@ -12,9 +12,18 @@ class Database {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function connect(Settings $cfg, $verify = true) {
|
function connect(Settings $cfg, $verify = true) {
|
||||||
|
$driver = $cfg->driver;
|
||||||
|
$host = $cfg->host;
|
||||||
|
$port = $cfg->port;
|
||||||
|
$database = $cfg->database;
|
||||||
|
$username = $cfg->username;
|
||||||
|
$password = $cfg->password;
|
||||||
|
$this->verify = $verify;
|
||||||
$this->active_query = "";
|
$this->active_query = "";
|
||||||
|
|
||||||
if ($cfg->driver === "pgsql") {
|
if (strtolower($driver) === "mariadb") {
|
||||||
|
$driver = "mysql";
|
||||||
|
} elseif ($driver === "pgsql") {
|
||||||
Database::$TRUE = "B'1'";
|
Database::$TRUE = "B'1'";
|
||||||
Database::$FALSE = "B'0'";
|
Database::$FALSE = "B'0'";
|
||||||
}
|
}
|
||||||
@ -27,13 +36,6 @@ class Database {
|
|||||||
$this->active_query = self::append_query($this->active_query, "silent=" . Database::$FALSE);
|
$this->active_query = self::append_query($this->active_query, "silent=" . Database::$FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->verify = $verify;
|
|
||||||
$driver = $cfg->driver;
|
|
||||||
$host = $cfg->host;
|
|
||||||
$port = $cfg->port;
|
|
||||||
$database = $cfg->database;
|
|
||||||
$username = $cfg->username;
|
|
||||||
$password = $cfg->password;
|
|
||||||
if ($username === "" && $password === "") {
|
if ($username === "" && $password === "") {
|
||||||
redirect("error/unconfigured.php");
|
redirect("error/unconfigured.php");
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ class Settings {
|
|||||||
// If you set a table prefix in config.yml, set it here as well
|
// If you set a table prefix in config.yml, set it here as well
|
||||||
$this->table_prefix = "litebans_";
|
$this->table_prefix = "litebans_";
|
||||||
|
|
||||||
// Supported drivers: mysql, pgsql
|
// Supported drivers: mysql, mariadb, pgsql
|
||||||
$this->driver = 'mysql';
|
$this->driver = 'mysql';
|
||||||
|
|
||||||
// Server name, shown on the main page and on the header
|
// Server name, shown on the main page and on the header
|
||||||
|
Loading…
x
Reference in New Issue
Block a user