Fixes db connection issues

main
Yasen Pramatarov 2025-04-14 18:07:15 +03:00
parent e96480807c
commit 45181c11c5
2 changed files with 10 additions and 2 deletions

View File

@ -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();
}
} }
/** /**

View File

@ -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();
} }