Actually tack the values on

This commit is contained in:
AffectedArc07
2021-10-13 18:26:41 +01:00
parent 980f21b4f4
commit 7dc3d906d1
8 changed files with 24 additions and 22 deletions
+2
View File
@@ -25,6 +25,8 @@ ALTER TABLE `legacy_population`
ADD COLUMN `server_id` VARCHAR(50) NULL DEFAULT NULL AFTER `admincount`;
# Notes already has a column for this
ALTER TABLE `notes`
CHANGE COLUMN `server` `server` VARCHAR(50) NULL COLLATE 'utf8mb4_general_ci' AFTER `edits`;
ALTER TABLE `round`
ADD COLUMN `server_id` VARCHAR(50) NULL DEFAULT NULL AFTER `station_name`;
+3 -2
View File
@@ -2061,11 +2061,12 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
/proc/log_connection(ckey, ip, cid, connection_type)
ASSERT(connection_type in list(CONNECTION_TYPE_ESTABLISHED, CONNECTION_TYPE_DROPPED_IPINTEL, CONNECTION_TYPE_DROPPED_BANNED, CONNECTION_TYPE_DROPPED_INVALID))
var/datum/db_query/query_accesslog = SSdbcore.NewQuery("INSERT INTO connection_log (`datetime`, `ckey`, `ip`, `computerid`, `result`) VALUES(Now(), :ckey, :ip, :cid, :result)", list(
var/datum/db_query/query_accesslog = SSdbcore.NewQuery("INSERT INTO connection_log (`datetime`, `ckey`, `ip`, `computerid`, `result`, `server_id`) VALUES(Now(), :ckey, :ip, :cid, :result, :server_id)", list(
"ckey" = ckey,
"ip" = "[ip ? ip : ""]", // This is important. NULL is not the same as "", and if you directly open the `.dmb` file, you get a NULL IP.
"cid" = cid,
"result" = connection_type
"result" = connection_type,
"server_id" = GLOB.configuration.system.instance_id
))
query_accesslog.warn_execute()
qdel(query_accesslog)
+4 -3
View File
@@ -287,8 +287,8 @@ SUBSYSTEM_DEF(blackbox)
lakey = L.lastattackerckey
var/datum/db_query/deathquery = SSdbcore.NewQuery({"
INSERT INTO death (name, byondkey, job, special, pod, tod, laname, lakey, gender, bruteloss, fireloss, brainloss, oxyloss, coord)
VALUES (:name, :key, :job, :special, :pod, NOW(), :laname, :lakey, :gender, :bruteloss, :fireloss, :brainloss, :oxyloss, :coord)"},
INSERT INTO death (name, byondkey, job, special, pod, tod, laname, lakey, gender, bruteloss, fireloss, brainloss, oxyloss, coord, server_id)
VALUES (:name, :key, :job, :special, :pod, NOW(), :laname, :lakey, :gender, :bruteloss, :fireloss, :brainloss, :oxyloss, :coord, :server_id)"},
list(
"name" = L.real_name,
"key" = L.key,
@@ -302,7 +302,8 @@ SUBSYSTEM_DEF(blackbox)
"fireloss" = L.getFireLoss(),
"brainloss" = L.getBrainLoss(),
"oxyloss" = L.getOxyLoss(),
"coord" = "[L.x], [L.y], [L.z]"
"coord" = "[L.x], [L.y], [L.z]",
"server_id" = GLOB.configuration.system.instance_id
)
)
deathquery.warn_execute()
+2 -2
View File
@@ -160,8 +160,8 @@ SUBSYSTEM_DEF(dbcore)
if(!IsConnected())
return
var/datum/db_query/query_round_initialize = SSdbcore.NewQuery(
"INSERT INTO round (initialize_datetime, server_ip, server_port) VALUES (Now(), INET_ATON(:internet_address), :port)",
list("internet_address" = world.internet_address || "0", "port" = "[world.port]")
"INSERT INTO round (initialize_datetime, server_ip, server_port, server_id) VALUES (Now(), INET_ATON(:internet_address), :port, :server_id)",
list("internet_address" = world.internet_address || "0", "port" = "[world.port]", "server_id" = GLOB.configuration.system.instance_id)
)
query_round_initialize.Execute(async = FALSE)
GLOB.round_id = "[query_round_initialize.last_insert_id]"
+3 -2
View File
@@ -18,10 +18,11 @@ SUBSYSTEM_DEF(statistics)
return
else
var/datum/db_query/statquery = SSdbcore.NewQuery(
"INSERT INTO legacy_population (playercount, admincount, time) VALUES (:playercount, :admincount, NOW())",
"INSERT INTO legacy_population (playercount, admincount, time, server_id) VALUES (:playercount, :admincount, NOW(), :server_id)",
list(
"playercount" = length(GLOB.clients),
"admincount" = length(GLOB.admins)
"admincount" = length(GLOB.admins),
"server_id" = GLOB.configuration.system.instance_id
)
)
statquery.warn_execute()
+4 -3
View File
@@ -146,8 +146,8 @@
qdel(adm_query)
var/datum/db_query/query_insert = SSdbcore.NewQuery({"
INSERT INTO ban (`id`,`bantime`,`serverip`,`bantype`,`reason`,`job`,`duration`,`rounds`,`expiration_time`,`ckey`,`computerid`,`ip`,`a_ckey`,`a_computerid`,`a_ip`,`who`,`adminwho`,`edits`,`unbanned`,`unbanned_datetime`,`unbanned_ckey`,`unbanned_computerid`,`unbanned_ip`,`ban_round_id`,`unbanned_round_id`)
VALUES (null, Now(), :serverip, :bantype_str, :reason, :job, :duration, :rounds, Now() + INTERVAL :duration MINUTE, :ckey, :computerid, :ip, :a_ckey, :a_computerid, :a_ip, :who, :adminwho, '', null, null, null, null, null, :roundid, null)
INSERT INTO ban (`id`,`bantime`,`serverip`,`bantype`,`reason`,`job`,`duration`,`rounds`,`expiration_time`,`ckey`,`computerid`,`ip`,`a_ckey`,`a_computerid`,`a_ip`,`who`,`adminwho`,`edits`,`unbanned`,`unbanned_datetime`,`unbanned_ckey`,`unbanned_computerid`,`unbanned_ip`,`ban_round_id`,`unbanned_round_id`, `server_id`)
VALUES (null, Now(), :serverip, :bantype_str, :reason, :job, :duration, :rounds, Now() + INTERVAL :duration MINUTE, :ckey, :computerid, :ip, :a_ckey, :a_computerid, :a_ip, :who, :adminwho, '', null, null, null, null, null, :roundid, null, :server_id)
"}, list(
// Get ready for parameters
"serverip" = serverip,
@@ -164,7 +164,8 @@
"a_ip" = a_ip,
"who" = who,
"adminwho" = adminwho,
"roundid" = GLOB.round_id
"roundid" = GLOB.round_id,
"server_id" = GLOB.configuration.system.instance_id
))
if(!query_insert.warn_execute())
qdel(query_insert)
+2 -7
View File
@@ -1,5 +1,4 @@
// Do not attemtp to remove the blank string from the server arg. It will break DB saving.
/proc/add_note(target_ckey, notetext, timestamp, adminckey, logged = 1, server = "", checkrights = 1, show_after = TRUE, automated = FALSE)
/proc/add_note(target_ckey, notetext, timestamp, adminckey, logged = 1, checkrights = 1, show_after = TRUE, automated = FALSE)
if(checkrights && !check_rights(R_ADMIN|R_MOD))
return
if(!SSdbcore.IsConnected())
@@ -53,10 +52,6 @@
else if(usr && (usr.ckey == ckey(adminckey))) // Don't ckeyize special note sources
adminckey = ckey(adminckey)
if(!server)
if(GLOB.configuration.general.server_name)
server = GLOB.configuration.general.server_name
// Force cast this to 1/0 incase someone tries to feed bad data
automated = !!automated
@@ -67,7 +62,7 @@
"targetckey" = target_ckey,
"notetext" = notetext,
"adminkey" = adminckey,
"server" = server,
"server" = GLOB.configuration.system.instance_id,
"crewnum" = crew_number,
"roundid" = GLOB.round_id,
"automated" = automated
+4 -3
View File
@@ -16,15 +16,16 @@
return
var/datum/db_query/log_query = SSdbcore.NewQuery({"
INSERT INTO karma (spendername, spenderkey, receivername, receiverkey, receiverrole, receiverspecial, spenderip, time)
VALUES (:sname, :skey, :rname, :rkey, :rrole, :rspecial, :sip, Now())"}, list(
INSERT INTO karma (spendername, spenderkey, receivername, receiverkey, receiverrole, receiverspecial, spenderip, time, server_id)
VALUES (:sname, :skey, :rname, :rkey, :rrole, :rspecial, :sip, Now(), :server_id)"}, list(
"sname" = spender.name,
"skey" = spender.ckey,
"rname" = receiver.name,
"rkey" = receiver.ckey,
"rrole" = receiverrole,
"rspecial" = receiverspecial,
"sip" = spender.client.address
"sip" = spender.client.address,
"server_id" = GLOB.configuration.system.instance_id
))
if(!log_query.warn_execute())