mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 14:39:58 +01:00
[MIRROR] Moves as many db related date/time operations to the db side to avoid byond bugs with dates and times. (#27694)
* Moves as many db related date/time operations to the db side to avoid byond bugs with dates and times. * Update blackbox.dm * SQLtime to ISOtime --------- Co-authored-by: Kyle Spier-Swenson <kyleshome@gmail.com> Co-authored-by: SpaceLoveSs13 <68121607+SpaceLoveSs13@users.noreply.github.com>
This commit is contained in:
co-authored by
Kyle Spier-Swenson
SpaceLoveSs13
parent
bc4980eb4c
commit
8e17d80198
@@ -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(/* SKYRAT EDIT CHANGE - MULTISERVER */{"
|
||||
/* // SKYRAT 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), // SKYRAT 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(/* SKYRAT EDIT CHANGE - MULTISERVER */{"
|
||||
/* SKYRAT 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)
|
||||
|
||||
@@ -106,7 +106,7 @@ SUBSYSTEM_DEF(ipintel)
|
||||
intel.result = data["result"]
|
||||
if(istext(intel.result))
|
||||
intel.result = text2num(intel.result)
|
||||
intel.date = SQLtime()
|
||||
intel.date = ISOtime()
|
||||
intel.address = address
|
||||
cached_queries[address] = intel
|
||||
add_intel_to_database(intel)
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user