Add mariadb driver support

This commit is contained in:
ruan 2022-09-28 19:11:09 +02:00
parent efa7f17364
commit 6ef64fefde
2 changed files with 11 additions and 9 deletions

View File

@ -12,9 +12,18 @@ class Database {
}
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 = "";
if ($cfg->driver === "pgsql") {
if (strtolower($driver) === "mariadb") {
$driver = "mysql";
} elseif ($driver === "pgsql") {
Database::$TRUE = "B'1'";
Database::$FALSE = "B'0'";
}
@ -27,13 +36,6 @@ class Database {
$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 === "") {
redirect("error/unconfigured.php");
}

View File

@ -17,7 +17,7 @@ class Settings {
// If you set a table prefix in config.yml, set it here as well
$this->table_prefix = "litebans_";
// Supported drivers: mysql, pgsql
// Supported drivers: mysql, mariadb, pgsql
$this->driver = 'mysql';
// Server name, shown on the main page and on the header