From 3f700f57a7ed1127fef62520e63c06b00e04b432 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 15 Jan 2023 10:01:11 -0500 Subject: [PATCH] Admin command usages logged to database. --- src/engine/db/handlers/dbAccountHandler.java | 12 ++++++++++++ src/engine/gameManager/DevCmdManager.java | 1 + 2 files changed, 13 insertions(+) diff --git a/src/engine/db/handlers/dbAccountHandler.java b/src/engine/db/handlers/dbAccountHandler.java index 5829d9a2..35ed3533 100644 --- a/src/engine/db/handlers/dbAccountHandler.java +++ b/src/engine/db/handlers/dbAccountHandler.java @@ -47,11 +47,23 @@ public class dbAccountHandler extends dbHandlerBase { return ac; } + public void WRITE_ADMIN_LOG(String adminName, String logEntry) { + + prepareCallable("INSERT INTO dyn_admin_log(`DateTime`, `Account`, `Event`)" + + " VALUES (?, ?, ?)"); + setTimeStamp(1, System.currentTimeMillis()); + setString(2, adminName); + setString(3, logEntry); + executeUpdate(); + + } + public void SET_TRASH(String machineID) { prepareCallable("INSERT INTO dyn_trash(`machineID`, `count`)" + " VALUES (?, 1) ON DUPLICATE KEY UPDATE `count` = `count` + 1;"); + setTimeStamp(4, System.currentTimeMillis()); setString(1, machineID); executeUpdate(); diff --git a/src/engine/gameManager/DevCmdManager.java b/src/engine/gameManager/DevCmdManager.java index 6152e0d6..e1883650 100644 --- a/src/engine/gameManager/DevCmdManager.java +++ b/src/engine/gameManager/DevCmdManager.java @@ -204,6 +204,7 @@ public enum DevCmdManager { + ") '"; logString += cmd + ' ' + argString + '\''; Logger.info( logString); + DbManager.AccountQueries.WRITE_ADMIN_LOG(pcName, cmd + " " + argString); // execute command; try {