Fixes db connection issues
parent
e96480807c
commit
45181c11c5
|
@ -18,7 +18,11 @@ class Log {
|
||||||
* @param object $database The database object to initialize the connection.
|
* @param object $database The database object to initialize the connection.
|
||||||
*/
|
*/
|
||||||
public function __construct($database) {
|
public function __construct($database) {
|
||||||
$this->db = $database->getConnection();
|
if ($database instanceof PDO) {
|
||||||
|
$this->db = $database;
|
||||||
|
} else {
|
||||||
|
$this->db = $database->getConnection();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,7 +23,11 @@ class RateLimiter {
|
||||||
];
|
];
|
||||||
|
|
||||||
public function __construct($database) {
|
public function __construct($database) {
|
||||||
$this->db = $database->getConnection();
|
if ($database instanceof PDO) {
|
||||||
|
$this->db = $database;
|
||||||
|
} else {
|
||||||
|
$this->db = $database->getConnection();
|
||||||
|
}
|
||||||
$this->log = new Log($database);
|
$this->log = new Log($database);
|
||||||
$this->createTablesIfNotExist();
|
$this->createTablesIfNotExist();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue