Местонахождение sqlite-базы тянется из конфига.

This commit is contained in:
lopar
2021-02-01 01:42:34 +02:00
parent c2c0317f00
commit 6a96c7de3c
2 changed files with 4 additions and 2 deletions

View File

@@ -2,6 +2,7 @@
namespace Battles;
use Config;
use SQLite3;
class GameLogs
@@ -16,7 +17,7 @@ class GameLogs
*/
public static function addBankLog(int $senderId, int $receiverId, int $amount, string $type, string $text)
{
$db = new SQLite3('databases/logs.sqlite');
$db = new SQLite3(Config::$db_sqlite);
$row = $db->prepare("INSERT INTO bank_logs (sender_id, receiver_id, amount, type, text) VALUES (?, ?, ?, ?, ?)");
$row->bindParam(1, $senderId, SQLITE3_INTEGER);
$row->bindParam(2, $receiverId, SQLITE3_INTEGER);
@@ -42,7 +43,7 @@ class GameLogs
if (empty($type)) {
$type = "system";
}
$db = new SQLite3('databases/logs.sqlite');
$db = new SQLite3(Config::$db_sqlite);
$row = $db->prepare("INSERT INTO users_logs (user_id, author_id, type, text) VALUES (?,?,?,?)");
$row->bindParam(1, $userId, SQLITE3_INTEGER);
$row->bindParam(2, $authorId, SQLITE3_INTEGER);