Skip to content

Commit d3e1abf

Browse files
committed
Models/Logger: Change manual query to query builder
1 parent a8ebbb8 commit d3e1abf

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

application/models/Logger_model.php

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,18 @@ public function getLogCount()
5151

5252
public function createLogDb($module, $user, $type, $event, $message, $status, $custom, $ip): void
5353
{
54-
$this->db->query("INSERT INTO `logs` (`module`, `user_id`, `type`, `event`, `message`, `status`, `custom`, `ip`, `time`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", array($module, $user, $type, $event, $message, $status, $custom, $ip, time()));
54+
$this->db->table('logs')
55+
->insert([
56+
'module' => $module,
57+
'user_id' => $user,
58+
'type' => $type,
59+
'event' => $event,
60+
'message' => $message,
61+
'status' => $status,
62+
'custom' => $custom,
63+
'ip' => $ip,
64+
'time' => time(),
65+
]);
5566
}
5667

5768
public function getGMLogsDb(string $logType = "", int $offset = 0, int $limit = 0): ?array
@@ -79,6 +90,15 @@ public function getGMLogsDb(string $logType = "", int $offset = 0, int $limit =
7990

8091
public function createGMLogDb($action, $gm_id, $affected, $ip, $type, $realmId): void
8192
{
82-
$this->db->query("INSERT INTO `gm_log` (`action`, `gm_id`, `affected`, `ip`, `type`, `realm`, `time`) VALUES (?, ?, ?, ?, ?, ?, ?)", array($action, $gm_id, $affected, $ip, $type, $realmId, time()));
93+
$this->db->table('gm_log')
94+
->insert([
95+
'action' => $action,
96+
'gm_id' => $gm_id,
97+
'affected' => $affected,
98+
'ip' => $ip,
99+
'type' => $type,
100+
'realm' => $realmId,
101+
'time' => time(),
102+
]);
83103
}
84104
}

0 commit comments

Comments
 (0)