diff --git a/code/__HELPERS/logging/_logging.dm b/code/__HELPERS/logging/_logging.dm index c9d5bb3cfbe..eb57ff7eda1 100644 --- a/code/__HELPERS/logging/_logging.dm +++ b/code/__HELPERS/logging/_logging.dm @@ -105,7 +105,7 @@ GLOBAL_LIST_INIT(testing_global_profiler, list("_PROFILE_NAME" = "Global")) SSdbcore.add_log_to_mass_insert_queue( format_table_name("game_log"), list( - "datetime" = SQLtime(), + "datetime" = ISOtime(), "round_id" = "[GLOB.round_id]", "ckey" = key_name(src), "loc" = loc_name(src), diff --git a/code/__HELPERS/time.dm b/code/__HELPERS/time.dm index 9c57f2334c8..ac3ff23b05e 100644 --- a/code/__HELPERS/time.dm +++ b/code/__HELPERS/time.dm @@ -28,7 +28,7 @@ SSticker.gametime_offset = CEILING(SSticker.gametime_offset, 3600) //returns timestamp in a sql and a not-quite-compliant ISO 8601 friendly format -/proc/SQLtime(timevar) +/proc/ISOtime(timevar) return time2text(timevar || world.timeofday, "YYYY-MM-DD hh:mm:ss") diff --git a/code/controllers/subsystem/blackbox.dm b/code/controllers/subsystem/blackbox.dm index b4a2bfe7526..8a4c9c45387 100644 --- a/code/controllers/subsystem/blackbox.dm +++ b/code/controllers/subsystem/blackbox.dm @@ -44,13 +44,17 @@ SUBSYSTEM_DEF(blackbox) return var/playercount = LAZYLEN(GLOB.player_list) var/admincount = GLOB.admins.len - var/datum/db_query/query_record_playercount = SSdbcore.NewQuery(/* NOVA EDIT CHANGE - MULTISERVER */{" + /* // NOVA EDIT CHANGE - MULTISERVER - ORIGINAL: + var/datum/db_query/query_record_playercount = SSdbcore.NewQuery({" + INSERT INTO [format_table_name("legacy_population")] (playercount, admincount, time, server_ip, server_port, round_id) + VALUES (:playercount, :admincount, NOW(), INET_ATON(:server_ip), :server_port, :round_id) + */ + var/datum/db_query/query_record_playercount = SSdbcore.NewQuery({" INSERT INTO [format_table_name("legacy_population")] (playercount, admincount, time, server_name, server_ip, server_port, round_id) - VALUES (:playercount, :admincount, :time, :server_name, INET_ATON(:server_ip), :server_port, :round_id) + VALUES (:playercount, :admincount, NOW(), :server_name, INET_ATON(:server_ip), :server_port, :round_id) "}, list( "playercount" = playercount, "admincount" = admincount, - "time" = SQLtime(), "server_name" = CONFIG_GET(string/serversqlname), // NOVA EDIT ADDITION - MULTISERVER "server_ip" = world.internet_address || "0", "server_port" = "[world.port]", @@ -299,7 +303,7 @@ Versioning var/datum/db_query/query_log_ahelp = SSdbcore.NewQuery({" INSERT INTO [format_table_name("ticket")] (ticket, action, message, recipient, sender, server_ip, server_port, round_id, timestamp, urgent) - VALUES (:ticket, :action, :message, :recipient, :sender, INET_ATON(:server_ip), :server_port, :round_id, :time, :urgent) + VALUES (:ticket, :action, :message, :recipient, :sender, INET_ATON(:server_ip), :server_port, :round_id, NOW(), :urgent) "}, list( "ticket" = ticket, "action" = action, @@ -309,7 +313,6 @@ Versioning "server_ip" = world.internet_address || "0", "server_port" = world.port, "round_id" = GLOB.round_id, - "time" = SQLtime(), "urgent" = urgent, )) query_log_ahelp.Execute() @@ -336,9 +339,14 @@ Versioning if(!SSdbcore.Connect()) return - var/datum/db_query/query_report_death = SSdbcore.NewQuery(/* NOVA EDIT CHANGE - MULTISERVER */{" +/* NOVA EDIT CHANGE - MULTISERVER - ORIGINAL: + var/datum/db_query/query_report_death = SSdbcore.NewQuery({" + INSERT INTO [format_table_name("death")] (pod, x_coord, y_coord, z_coord, mapname, server_ip, server_port, round_id, tod, job, special, name, byondkey, laname, lakey, bruteloss, fireloss, brainloss, oxyloss, toxloss, staminaloss, last_words, suicide) + VALUES (:pod, :x_coord, :y_coord, :z_coord, :map, INET_ATON(:internet_address), :port, :round_id, NOW(), :job, :special, :name, :key, :laname, :lakey, :brute, :fire, :brain, :oxy, :tox, :stamina, :last_words, :suicide) +*/ + var/datum/db_query/query_report_death = SSdbcore.NewQuery({" INSERT INTO [format_table_name("death")] (pod, x_coord, y_coord, z_coord, mapname, server_name, server_ip, server_port, round_id, tod, job, special, name, byondkey, laname, lakey, bruteloss, fireloss, brainloss, oxyloss, toxloss, staminaloss, last_words, suicide) - VALUES (:pod, :x_coord, :y_coord, :z_coord, :map, :server_name, INET_ATON(:internet_address), :port, :round_id, :time, :job, :special, :name, :key, :laname, :lakey, :brute, :fire, :brain, :oxy, :tox, :clone, :stamina, :last_words, :suicide) + VALUES (:pod, :x_coord, :y_coord, :z_coord, :map, :server_name, INET_ATON(:internet_address), :port, :round_id, NOW(), :job, :special, :name, :key, :laname, :lakey, :brute, :fire, :brain, :oxy, :tox, :clone, :stamina, :last_words, :suicide) "}, list( "name" = L.real_name, "key" = L.ckey, @@ -363,7 +371,6 @@ Versioning "internet_address" = world.internet_address || "0", "port" = "[world.port]", "round_id" = GLOB.round_id, - "time" = SQLtime(), )) if(query_report_death) query_report_death.Execute(async = TRUE) @@ -394,7 +401,7 @@ Versioning :message, :fine, :paid, - :timestamp + NOW() ) ON DUPLICATE KEY UPDATE paid = paid + VALUES(paid)"}, list( "server_ip" = world.internet_address || "0", @@ -408,7 +415,6 @@ Versioning "message" = message, "fine" = fine, "paid" = paid, - "timestamp" = SQLtime() )) if(query_report_citation) query_report_citation.Execute(async = TRUE) diff --git a/code/controllers/subsystem/ipintel.dm b/code/controllers/subsystem/ipintel.dm index f3d14b949dc..db397d51474 100644 --- a/code/controllers/subsystem/ipintel.dm +++ b/code/controllers/subsystem/ipintel.dm @@ -104,7 +104,9 @@ SUBSYSTEM_DEF(ipintel) if(intel.query_status != "success") return intel intel.result = data["result"] - intel.date = SQLtime() + if(istext(intel.result)) + intel.result = text2num(intel.result) + intel.date = ISOtime() intel.address = address cached_queries[address] = intel add_intel_to_database(intel) @@ -158,6 +160,8 @@ SUBSYSTEM_DEF(ipintel) var/datum/ip_intel/intel = new intel.query_status = "cached" intel.result = data["intel"] + if(istext(intel.result)) + intel.result = text2num(intel.result) intel.date = data["date"] intel.address = address return TRUE diff --git a/code/controllers/subsystem/time_track.dm b/code/controllers/subsystem/time_track.dm index ab6d5fb2ed5..aaaf5520e0f 100644 --- a/code/controllers/subsystem/time_track.dm +++ b/code/controllers/subsystem/time_track.dm @@ -123,7 +123,7 @@ SUBSYSTEM_DEF(time_track) send_maps_values += packet["value"] send_maps_values += packet["calls"] - SSblackbox.record_feedback("associative", "time_dilation_current", 1, list("[SQLtime()]" = list("current" = "[time_dilation_current]", "avg_fast" = "[time_dilation_avg_fast]", "avg" = "[time_dilation_avg]", "avg_slow" = "[time_dilation_avg_slow]"))) + SSblackbox.record_feedback("associative", "time_dilation_current", 1, list("[ISOtime()]" = list("current" = "[time_dilation_current]", "avg_fast" = "[time_dilation_avg_fast]", "avg" = "[time_dilation_avg]", "avg_slow" = "[time_dilation_avg_slow]"))) log_perf( list( world.time, diff --git a/code/modules/admin/permissionedit.dm b/code/modules/admin/permissionedit.dm index e92ab1729e2..e508a104739 100644 --- a/code/modules/admin/permissionedit.dm +++ b/code/modules/admin/permissionedit.dm @@ -249,8 +249,8 @@ ADMIN_VERB(edit_admin_permissions, R_PERMISSIONS, "Permissions Panel", "Edit adm qdel(query_add_admin) var/datum/db_query/query_add_admin_log = SSdbcore.NewQuery({" INSERT INTO [format_table_name("admin_log")] (datetime, round_id, adminckey, adminip, operation, target, log) - VALUES (:time, :round_id, :adminckey, INET_ATON(:adminip), 'add admin', :target, CONCAT('New admin added: ', :target)) - "}, list("time" = SQLtime(), "round_id" = "[GLOB.round_id]", "adminckey" = usr.ckey, "adminip" = usr.client.address, "target" = .)) + VALUES (NOW(), :round_id, :adminckey, INET_ATON(:adminip), 'add admin', :target, CONCAT('New admin added: ', :target)) + "}, list("round_id" = "[GLOB.round_id]", "adminckey" = usr.ckey, "adminip" = usr.client.address, "target" = .)) if(!query_add_admin_log.warn_execute()) qdel(query_add_admin_log) return FALSE @@ -275,8 +275,8 @@ ADMIN_VERB(edit_admin_permissions, R_PERMISSIONS, "Permissions Panel", "Edit adm qdel(query_add_rank) var/datum/db_query/query_add_rank_log = SSdbcore.NewQuery({" INSERT INTO [format_table_name("admin_log")] (datetime, round_id, adminckey, adminip, operation, target, log) - VALUES (:time, :round_id, :adminckey, INET_ATON(:adminip), 'remove admin', :admin_ckey, CONCAT('Admin removed: ', :admin_ckey)) - "}, list("time" = SQLtime(), "round_id" = "[GLOB.round_id]", "adminckey" = usr.ckey, "adminip" = usr.client.address, "admin_ckey" = admin_ckey)) + VALUES (NOW(), :round_id, :adminckey, INET_ATON(:adminip), 'remove admin', :admin_ckey, CONCAT('Admin removed: ', :admin_ckey)) + "}, list("round_id" = "[GLOB.round_id]", "adminckey" = usr.ckey, "adminip" = usr.client.address, "admin_ckey" = admin_ckey)) if(!query_add_rank_log.warn_execute()) qdel(query_add_rank_log) return @@ -423,8 +423,8 @@ ADMIN_VERB(edit_admin_permissions, R_PERMISSIONS, "Permissions Panel", "Edit adm qdel(query_add_rank) var/datum/db_query/query_add_rank_log = SSdbcore.NewQuery({" INSERT INTO [format_table_name("admin_log")] (datetime, round_id, adminckey, adminip, operation, target, log) - VALUES (:time, :round_id, :adminckey, INET_ATON(:adminip), 'add rank', :new_rank, CONCAT('New rank added: ', :new_rank)) - "}, list("time" = SQLtime(), "round_id" = "[GLOB.round_id]", "adminckey" = usr.ckey, "adminip" = usr.client.address, "new_rank" = custom_rank.name)) + VALUES (NOW(), :round_id, :adminckey, INET_ATON(:adminip), 'add rank', :new_rank, CONCAT('New rank added: ', :new_rank)) + "}, list("round_id" = "[GLOB.round_id]", "adminckey" = usr.ckey, "adminip" = usr.client.address, "new_rank" = custom_rank.name)) if(!query_add_rank_log.warn_execute()) qdel(query_add_rank_log) return @@ -440,8 +440,8 @@ ADMIN_VERB(edit_admin_permissions, R_PERMISSIONS, "Permissions Panel", "Edit adm qdel(query_change_rank) var/datum/db_query/query_change_rank_log = SSdbcore.NewQuery({" INSERT INTO [format_table_name("admin_log")] (datetime, round_id, adminckey, adminip, operation, target, log) - VALUES (:time, :round_id, :adminckey, INET_ATON(:adminip), 'change admin rank', :target, CONCAT('Rank of ', :target, ' changed from ', :old_rank, ' to ', :new_rank)) - "}, list("time" = SQLtime(), "round_id" = "[GLOB.round_id]", "adminckey" = usr.ckey, "adminip" = usr.client.address, "target" = admin_ckey, "old_rank" = old_rank, "new_rank" = joined_rank)) + VALUES (NOW(), :round_id, :adminckey, INET_ATON(:adminip), 'change admin rank', :target, CONCAT('Rank of ', :target, ' changed from ', :old_rank, ' to ', :new_rank)) + "}, list("round_id" = "[GLOB.round_id]", "adminckey" = usr.ckey, "adminip" = usr.client.address, "target" = admin_ckey, "old_rank" = old_rank, "new_rank" = joined_rank)) if(!query_change_rank_log.warn_execute()) qdel(query_change_rank_log) return @@ -539,8 +539,8 @@ ADMIN_VERB(edit_admin_permissions, R_PERMISSIONS, "Permissions Panel", "Edit adm qdel(query_add_rank) var/datum/db_query/query_add_rank_log = SSdbcore.NewQuery({" INSERT INTO [format_table_name("admin_log")] (datetime, round_id, adminckey, adminip, operation, target, log) - VALUES (:time, :round_id, :adminckey, INET_ATON(:adminip), 'remove rank', :admin_rank, CONCAT('Rank removed: ', :admin_rank)) - "}, list("time" = SQLtime(), "round_id" = "[GLOB.round_id]", "adminckey" = usr.ckey, "adminip" = usr.client.address, "admin_rank" = admin_rank)) + VALUES (NOW(), :round_id, :adminckey, INET_ATON(:adminip), 'remove rank', :admin_rank, CONCAT('Rank removed: ', :admin_rank)) + "}, list("round_id" = "[GLOB.round_id]", "adminckey" = usr.ckey, "adminip" = usr.client.address, "admin_rank" = admin_rank)) if(!query_add_rank_log.warn_execute()) qdel(query_add_rank_log) return diff --git a/code/modules/admin/sql_ban_system.dm b/code/modules/admin/sql_ban_system.dm index bd7b117f14c..2e829862b81 100644 --- a/code/modules/admin/sql_ban_system.dm +++ b/code/modules/admin/sql_ban_system.dm @@ -869,7 +869,7 @@ return var/kn = key_name(usr) var/kna = key_name_admin(usr) - var/change_message = "[usr.client.key] unbanned [target] from [role] on [SQLtime()] during round #[GLOB.round_id]