mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-06-06 23:04:21 +00:00
- Implemented dashboard audit logging with InsertAuditLog, GetRecentAuditLogs, GetAuditLogsByIP, and CleanupOldAuditLogs methods. - Created dashboard configuration management with GetDashboardConfig and SetDashboardConfig methods. - Added new tables for dashboard_audit_log and dashboard_config in both MySQL and SQLite migrations. - Updated CMakeLists to include Crow and ASIO for dashboard server functionality. - Enhanced existing database classes to support new dashboard features, including character, play key, and property management. - Added new methods for retrieving and managing play keys, properties, and pet names. - Updated TestSQLDatabase to include stubs for new dashboard-related methods. - Modified shared and dashboard configuration files for new settings.
22 lines
820 B
C++
22 lines
820 B
C++
#include "MySQLDatabase.h"
|
|
|
|
void MySQLDatabase::InsertSlashCommandUsage(const LWOOBJID characterId, const std::string_view command) {
|
|
ExecuteInsert("INSERT INTO command_log (character_id, command) VALUES (?, ?);", characterId, command);
|
|
}
|
|
|
|
std::vector<ICommandLog::Entry> MySQLDatabase::GetCommandLogs(uint32_t limit) {
|
|
std::vector<ICommandLog::Entry> logs;
|
|
auto res = ExecuteSelect("SELECT id, character_id, command FROM command_log ORDER BY id DESC LIMIT ?;", limit);
|
|
|
|
while (res->next()) {
|
|
ICommandLog::Entry entry;
|
|
entry.timestamp = 0; // Timestamp column doesn't exist in command_log table
|
|
entry.characterId = res->getInt64("character_id");
|
|
entry.command = res->getString("command").c_str();
|
|
entry.arguments = ""; // Arguments not currently stored in DB
|
|
logs.push_back(entry);
|
|
}
|
|
|
|
return logs;
|
|
}
|