From 598fea785e6ba68e10c1f224186e508e6082bb24 Mon Sep 17 00:00:00 2001 From: Tkdrg Date: Fri, 27 Nov 2015 21:56:59 -0300 Subject: [PATCH] Jobban cleanup & performance improvements Clients now cache their jobbans to save on DB queries. Legacy jobbans and "new" (savefile) jobbans have been removed. These are old cruft that has been unused for years, and since we require a DB for notes anyway we might as well just get rid of the legacy stuff. I considered removing legacy bans as well, but I was unsure if that would go way beyond the scope of this PR (my main goal here is making jobban_isbanned not awful). Also note that this was basically untested, as I do not have a test database. Any help testing this would be much appreciated. --- README.md | 7 +- code/modules/admin/admin.dm | 21 -- code/modules/admin/admin_verbs.dm | 13 -- code/modules/admin/banjob.dm | 127 +++-------- code/modules/admin/newbanjob.dm | 276 ------------------------ code/modules/admin/topic.dm | 38 ---- code/modules/admin/verbs/diagnostics.dm | 23 -- code/modules/admin/verbs/mapping.dm | 3 - code/modules/client/client defines.dm | 1 + code/world.dm | 3 - tgstation.dme | 1 - 11 files changed, 31 insertions(+), 482 deletions(-) delete mode 100644 code/modules/admin/newbanjob.dm diff --git a/README.md b/README.md index 8f2d270db37..d7e17e395b8 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,8 @@ where the admin rank must be properly capitalised. Finally, to start the server, run Dream Daemon and enter the path to your compiled tgstation.dmb file. Make sure to set the port to the one you specified in the config.txt, and set the Security box to 'Safe'. Then press GO -and the server should start up and be ready to join. +and the server should start up and be ready to join. It is also recommended that +you set up the SQL backend (see below). ###HOSTING ON LINUX We use BYGEX for some of our text replacement related code. Unfortunately, we @@ -112,9 +113,7 @@ To enable an away mission open fileList.txt in the _maps/RandomZLevels directory ##SQL SETUP -The SQL backend for the library and stats tracking requires a -MySQL server. Your server details go in /config/dbconfig.txt, and the SQL -schema is in /SQL/tgstation_schema.sql and /SQL/tgstation_schema_prefix.sql depending on if you want table prefixes. More detailed setup instructions are located here: http://www.tgstation13.org/wiki/Downloading_the_source_code#Setting_up_the_database +The SQL backend requires a MySQL server. SQL is required for the library, stats tracking, admin notes, and job-only bans, among other features, mostly related to server administration. Your server details go in /config/dbconfig.txt, and the SQL schema is in /SQL/tgstation_schema.sql and /SQL/tgstation_schema_prefix.sql depending on if you want table prefixes. More detailed setup instructions are located here: http://www.tgstation13.org/wiki/Downloading_the_source_code#Setting_up_the_database ##IRC BOT SETUP diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 642e7003c2b..47ec6ac32b3 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -380,19 +380,6 @@ var/global/floorIsLava = 0 onclose(usr, "admincaster_main") - -/datum/admins/proc/Jobbans() - if(!check_rights(R_BAN)) return - - var/dat = "Job Bans!
" - for(var/t in jobban_keylist) - var/r = t - if( findtext(r,"##") ) - r = copytext( r, 1, findtext(r,"##") )//removes the description - dat += text("") - dat += "
[t] (unban)
" - usr << browse(dat, "window=ban;size=400x400") - /datum/admins/proc/Game() if(!check_rights(0)) return @@ -695,14 +682,6 @@ var/global/floorIsLava = 0 message_admins("[key_name_admin(usr)] toggled guests game entering [guests_allowed?"":"dis"]allowed.") feedback_add_details("admin_verb","TGU") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! -/client/proc/unjobban_panel() - set name = "Unjobban Panel" - set category = "Admin" - if (src.holder) - src.holder.unjobbanpanel() - feedback_add_details("admin_verb","UJBP") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! - return - /datum/admins/proc/output_ai_laws() var/ai_number = 0 for(var/mob/living/silicon/S in mob_list) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 4a7d2553f84..894d847646b 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -64,8 +64,6 @@ var/list/admin_verbs_admin = list( ) var/list/admin_verbs_ban = list( /client/proc/unban_panel, - /client/proc/jobbans, - /client/proc/unjobban_panel, /client/proc/DB_ban_panel, /client/proc/stickybanpanel ) @@ -372,17 +370,6 @@ var/list/admin_verbs_hideable = list( feedback_add_details("admin_verb","CHA") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! return -/client/proc/jobbans() - set name = "Display Job bans" - set category = "Admin" - if(holder) - if(config.ban_legacy_system) - holder.Jobbans() - else - holder.DB_ban_panel() - feedback_add_details("admin_verb","VJB") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! - return - /client/proc/unban_panel() set name = "Unban Panel" set category = "Admin" diff --git a/code/modules/admin/banjob.dm b/code/modules/admin/banjob.dm index 1399c6310a5..d3eede9153b 100644 --- a/code/modules/admin/banjob.dm +++ b/code/modules/admin/banjob.dm @@ -1,109 +1,36 @@ -//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:32 - -var/jobban_runonce // Updates legacy bans with new info -var/jobban_keylist[0] //to store the keys & ranks - -/proc/jobban_fullban(mob/M, rank, reason) - if (!M || !M.key) return - jobban_keylist.Add(text("[M.ckey] - [rank] ## [reason]")) - jobban_savebanfile() - -/proc/jobban_client_fullban(ckey, rank) - if (!ckey || !rank) return - jobban_keylist.Add(text("[ckey] - [rank]")) - jobban_savebanfile() - //returns a reason if M is banned from rank, returns 0 otherwise /proc/jobban_isbanned(mob/M, rank) - if(M && rank) - for (var/s in jobban_keylist) - if( findtext(s,"[M.ckey] - [rank]") == 1 ) - var/startpos = findtext(s, "## ")+3 - if(startpos && startpos Now())) AND isnull(unbanned)") + if(!query.Execute()) + log_game("SQL ERROR obtaining jobbans. Error : \[[query.ErrorMsg()]\]\n") + return + if(query.NextRow()) + var/reason = query.item[1] + return reason ? reason : 1 //we don't want to return "" if there is no ban reason, as that would evaluate to false + else + return 0 + + if(!M.client.jobbancache) + jobban_buildcache(M.client) + + if(rank in M.client.jobbancache) + var/reason = M.client.jobbancache[rank] + return (reason) ? reason : 1 //see above for why we need to do this return 0 -/* -DEBUG -/mob/verb/list_all_jobbans() - set name = "list all jobbans" - - for(var/s in jobban_keylist) - world << s - -/mob/verb/reload_jobbans() - set name = "reload jobbans" - - jobban_loadbanfile() -*/ - -/proc/jobban_loadbanfile() - if(config.ban_legacy_system) - var/savefile/S=new("data/job_full.ban") - S["keys[0]"] >> jobban_keylist - log_admin("Loading jobban_rank") - S["runonce"] >> jobban_runonce - - if (!length(jobban_keylist)) - jobban_keylist=list() - log_admin("jobban_keylist was empty") - else - if(!establish_db_connection()) - world.log << "Database connection failed. Reverting to the legacy ban system." - diary << "Database connection failed. Reverting to the legacy ban system." - config.ban_legacy_system = 1 - jobban_loadbanfile() +/proc/jobban_buildcache(client/C) + if(C && istype(C)) + C.jobbancache = list() + var/DBQuery/query = dbcon.NewQuery("SELECT job, reason FROM [format_table_name("ban")] WHERE ckey = '[sanitizeSQL(C.ckey)]' AND (bantype = 'JOB_PERMABAN' OR (bantype = 'JOB_TEMPBAN' AND expiration_time > Now())) AND isnull(unbanned)") + if(!query.Execute()) + log_game("SQL ERROR obtaining jobbans. Error : \[[query.ErrorMsg()]\]\n") return - - //Job permabans - var/DBQuery/query = dbcon.NewQuery("SELECT ckey, job FROM [format_table_name("ban")] WHERE bantype = 'JOB_PERMABAN' AND isnull(unbanned)") - query.Execute() - while(query.NextRow()) - var/ckey = query.item[1] - var/job = query.item[2] - - jobban_keylist.Add("[ckey] - [job]") - - //Job tempbans - var/DBQuery/query1 = dbcon.NewQuery("SELECT ckey, job FROM [format_table_name("ban")] WHERE bantype = 'JOB_TEMPBAN' AND isnull(unbanned) AND expiration_time > Now()") - query1.Execute() - - while(query1.NextRow()) - var/ckey = query1.item[1] - var/job = query1.item[2] - - jobban_keylist.Add("[ckey] - [job]") - -/proc/jobban_savebanfile() - var/savefile/S=new("data/job_full.ban") - S["keys[0]"] << jobban_keylist - -/proc/jobban_unban(mob/M, rank) - jobban_remove("[M.ckey] - [rank]") - jobban_savebanfile() - + C.jobbancache[query.item[1]] = query.item[2] /proc/ban_unban_log_save(var/formatted_log) text2file(formatted_log,"data/ban_unban_log.txt") - - -/proc/jobban_updatelegacybans() - if(!jobban_runonce) - log_admin("Updating jobbanfile!") - // Updates bans.. Or fixes them. Either way. - for(var/T in jobban_keylist) - if(!T) continue - jobban_runonce++ //don't run this update again - - -/proc/jobban_remove(X) - for (var/i = 1; i <= length(jobban_keylist); i++) - if( findtext(jobban_keylist[i], "[X]") ) - jobban_keylist.Remove(jobban_keylist[i]) - jobban_savebanfile() - return 1 - return 0 diff --git a/code/modules/admin/newbanjob.dm b/code/modules/admin/newbanjob.dm deleted file mode 100644 index 2c429f6de82..00000000000 --- a/code/modules/admin/newbanjob.dm +++ /dev/null @@ -1,276 +0,0 @@ -var/savefile/Banlistjob - - -/proc/_jobban_isbanned(client/clientvar, rank) - if(!clientvar) return 1 - ClearTempbansjob() - var/id = clientvar.computer_id - var/key = clientvar.ckey - if (guest_jobbans(rank)) - if(config.guest_jobban && IsGuestKey(key)) - return 1 - Banlistjob.cd = "/base" - if (Banlistjob.dir.Find("[key][id][rank]")) - return 1 - - Banlistjob.cd = "/base" - for (var/A in Banlistjob.dir) - Banlistjob.cd = "/base/[A]" - if ((id == Banlistjob["id"] || key == Banlistjob["key"]) && rank == Banlistjob["rank"]) - return 1 - return 0 - - -///proc/UpdateTime() //No idea why i made this a proc. -// CMinutes = (world.realtime / 10) / 60 -// return 1 - -/proc/LoadBansjob() - - Banlistjob = new("data/job_fullnew.bdb") - log_admin("Loading Banlistjob") - - if (!length(Banlistjob.dir)) log_admin("Banlistjob is empty.") - - if (!Banlistjob.dir.Find("base")) - log_admin("Banlistjob missing base dir.") - Banlistjob.dir.Add("base") - Banlistjob.cd = "/base" - else if (Banlistjob.dir.Find("base")) - Banlistjob.cd = "/base" - - ClearTempbansjob() - return 1 - -/proc/ClearTempbansjob() - UpdateTime() - - Banlistjob.cd = "/base" - for (var/A in Banlistjob.dir) - Banlistjob.cd = "/base/[A]" - //if (!Banlistjob["key"] || !Banlistjob["id"]) - // RemoveBanjob(A, "full") - // log_admin("Invalid Ban.") - // message_admins("Invalid Ban.") - // continue - - if (!Banlistjob["temp"]) continue - if (CMinutes >= Banlistjob["minutes"]) RemoveBanjob(A) - - return 1 - - -/proc/AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, rank) - UpdateTime() - var/bantimestamp - if (temp) - UpdateTime() - bantimestamp = CMinutes + minutes - if(rank == "Heads") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Head of Personnel") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Captain") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Head of Security") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Chief Engineer") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Research Director") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Chief Medical Officer") - return 1 - if(rank == "Security") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Head of Security") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Warden") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Detective") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Security Officer") - return 1 - if(rank == "Engineering") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Station Engineer") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Atmospheric Technician") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Chief Engineer") - return 1 - if(rank == "Research") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Scientist") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Geneticist") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Chief Medical Officer") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Research Director") - return 1 - if(rank == "Medical") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Geneticist") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Medical Doctor") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Chief Medical Officer") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Chemist") - return 1 - if(rank == "CE_Station_Engineer") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Station Engineer") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Chief Engineer") - return 1 - if(rank == "CE_Atmospheric_Tech") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Atmospheric Technician") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Chief Engineer") - return 1 - if(rank == "CE_Shaft_Miner") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Shaft Miner") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Chief Engineer") - return 1 - if(rank == "Chemist_RD_CMO") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Chief Medical Officer") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Research Director") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Chemist") - return 1 - if(rank == "Geneticist_RD_CMO") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Chief Medical Officer") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Research Director") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Geneticist") - return 1 - if(rank == "MD_CMO") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Chief Medical Officer") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Medical Doctor") - return 1 - if(rank == "Scientist_RD") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Research Director") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Scientist") - return 1 - if(rank == "AI_Cyborg") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Cyborg") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "AI") - return 1 - if(rank == "Detective_HoS") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Detective") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Head of Security") - return 1 - if(rank == "Virologist_RD_CMO") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Chief Medical Officer") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Research Director") - AddBanjob(ckey, computerid, reason, bannedby, temp, minutes, "Virologist") - return 1 - - Banlistjob.cd = "/base" - if ( Banlistjob.dir.Find("[ckey][computerid][rank]") ) - usr << text("Banjob already exists.") - return 0 - else - Banlistjob.dir.Add("[ckey][computerid][rank]") - Banlistjob.cd = "/base/[ckey][computerid][rank]" - Banlistjob["key"] << ckey - Banlistjob["id"] << computerid - Banlistjob["rank"] << rank - Banlistjob["reason"] << reason - Banlistjob["bannedby"] << bannedby - Banlistjob["temp"] << temp - if (temp) - Banlistjob["minutes"] << bantimestamp - - return 1 - -/proc/RemoveBanjob(foldername) - var/key - var/id - var/rank - Banlistjob.cd = "/base/[foldername]" - Banlistjob["key"] >> key - Banlistjob["id"] >> id - Banlistjob["rank"] >> rank - Banlistjob.cd = "/base" - - if (!Banlistjob.dir.Remove(foldername)) return 0 - - if(!usr) - log_admin("Banjob Expired: [key]") - message_admins("Banjob Expired: [key]") - else - log_admin("[key_name(usr)] unjobbanned [key] from [rank]") - message_admins("[key_name_admin(usr)] unjobbanned:[key] from [rank]") - ban_unban_log_save("[key_name(usr)] unjobbanned [key] from [rank]") - feedback_inc("ban_job_unban",1) - feedback_add_details("ban_job_unban","- [rank]") - - for (var/A in Banlistjob.dir) - Banlistjob.cd = "/base/[A]" - if ((key == Banlistjob["key"] || id == Banlistjob["id"]) && (rank == Banlistjob["rank"])) - Banlistjob.cd = "/base" - Banlistjob.dir.Remove(A) - continue - - return 1 - -/proc/GetExpjob(minutes as num) - UpdateTime() - var/exp = minutes - CMinutes - if (exp <= 0) - return 0 - else - var/timeleftstring - if (exp >= 1440) //1440 = 1 day in minutes - timeleftstring = "[round(exp / 1440, 0.1)] Days" - else if (exp >= 60) //60 = 1 hour in minutes - timeleftstring = "[round(exp / 60, 0.1)] Hours" - else - timeleftstring = "[exp] Minutes" - return timeleftstring - -/datum/admins/proc/unjobbanpanel() - var/count = 0 - var/dat - //var/dat = "
Unban Player: \blue(U) = Unban , (E) = Edit Ban\green (Total
" - Banlistjob.cd = "/base" - for (var/A in Banlistjob.dir) - count++ - Banlistjob.cd = "/base/[A]" - dat += text("") - - dat += "
(U) Key: [Banlistjob["key"]] Rank: [Banlistjob["rank"]] ([Banlistjob["temp"] ? "[GetExpjob(Banlistjob["minutes"]) ? GetExpjob(Banlistjob["minutes"]) : "Removal pending" ]" : "Permaban"])(By: [Banlistjob["bannedby"]])(Reason: [Banlistjob["reason"]])
" - dat = "
Bans: (U) = Unban , - ([count] Bans)
[dat]" - usr << browse(dat, "window=unbanp;size=875x400") - -/*/datum/admins/proc/permjobban(ckey, computerid, reason, bannedby, temp, minutes, rank) - if(AddBanjob(ckey, computerid, reason, usr.ckey, 0, 0, job)) - M << "\redYou have been banned from [job] by [usr.client.ckey].\nReason: [reason]" - M << "\red This is a permanent ban." - if(config.banappeals) - M << "\red To try to resolve this matter head to [config.banappeals]" - else - M << "\red No ban appeals URL has been set." - log_admin("[usr.client.ckey] has banned from [job] [ckey].\nReason: [reason]\nThis is a permanent ban.") - message_admins("\blue[usr.client.ckey] has banned from [job] [ckey].\nReason: [reason]\nThis is a permanent ban.") -/datum/admins/proc/timejobban(ckey, computerid, reason, bannedby, temp, minutes, rank) - if(AddBanjob(ckey, computerid, reason, usr.ckey, 1, mins, job)) - M << "\redYou have been jobbanned from [job] by [usr.client.ckey].\nReason: [reason]" - M << "\red This is a temporary ban, it will be removed in [mins] minutes." - if(config.banappeals) - M << "\red To try to resolve this matter head to [config.banappeals]" - else - M << "\red No ban appeals URL has been set." - log_admin("[usr.client.ckey] has jobbanned from [job] [ckey].\nReason: [reason]\nThis will be removed in [mins] minutes.") - message_admins("\blue[usr.client.ckey] has banned from [job] [ckey].\nReason: [reason]\nThis will be removed in [mins] minutes.")*/ -//////////////////////////////////// DEBUG //////////////////////////////////// - -/proc/CreateBansjob() - - UpdateTime() - - var/i - var/last - - for(i=0, i<1001, i++) - var/a = pick(1,0) - var/b = pick(1,0) - if(b) - Banlistjob.cd = "/base" - Banlistjob.dir.Add("trash[i]trashid[i]") - Banlistjob.cd = "/base/trash[i]trashid[i]" - Banlistjob["key"] << "trash[i]" - else - Banlistjob.cd = "/base" - Banlistjob.dir.Add("[last]trashid[i]") - Banlistjob.cd = "/base/[last]trashid[i]" - Banlistjob["key"] << last - Banlistjob["id"] << "trashid[i]" - Banlistjob["reason"] << "Trashban[i]." - Banlistjob["temp"] << a - Banlistjob["minutes"] << CMinutes + rand(1,2000) - Banlistjob["bannedby"] << "trashmin" - last = "trash[i]" - - Banlistjob.cd = "/base" - -/proc/ClearAllBansjob() - Banlistjob.cd = "/base" - for (var/A in Banlistjob.dir) - RemoveBanjob(A, "full") diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index dc08a87351b..e5123e44cb8 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -483,10 +483,6 @@ var/banreason = appearance_isbanned(M) if(banreason) - /* if(!config.ban_legacy_system) - usr << "Unfortunately, database based unbanning cannot be done through this panel" - DB_ban_panel(M.ckey) - return */ switch(alert("Reason: '[banreason]' Remove appearance ban?","Please Confirm","Yes","No")) if("Yes") ban_unban_log_save("[key_name(usr)] removed [key_name(M)]'s appearance ban") @@ -895,9 +891,6 @@ if(notbannedlist.len) //at least 1 unbanned job exists in joblist so we have stuff to ban. switch(alert("Temporary Ban?",,"Yes","No", "Cancel")) if("Yes") - if(config.ban_legacy_system) - usr << "Your server is using the legacy banning system, which does not support temporary job bans. Consider upgrading. Aborting ban." - return var/mins = input(usr,"How long (in minutes)?","Ban time",1440) as num|null if(!mins) return @@ -912,7 +905,6 @@ feedback_inc("ban_job_tmp",1) DB_ban_record(BANTYPE_JOB_TEMP, M, mins, reason, job) feedback_add_details("ban_job_tmp","- [job]") - jobban_fullban(M, job, "[reason]; By [usr.ckey] on [time2text(world.realtime)]") //Legacy banning does not support temporary jobbans. if(!msg) msg = job else @@ -934,7 +926,6 @@ feedback_inc("ban_job",1) DB_ban_record(BANTYPE_JOB_PERMA, M, -1, reason, job) feedback_add_details("ban_job","- [job]") - jobban_fullban(M, job, "[reason]; By [usr.ckey] on [time2text(world.realtime)]") if(!msg) msg = job else msg += ", [job]" add_note(M.ckey, "Banned from [msg] - [reason]", null, usr.ckey, 0) @@ -961,7 +952,6 @@ DB_ban_unban(M.ckey, BANTYPE_ANY_JOB, job) feedback_inc("ban_job_unban",1) feedback_add_details("ban_job_unban","- [job]") - jobban_unban(M, job) if(!msg) msg = job else msg += ", [job]" else @@ -1029,21 +1019,6 @@ var/edit_log = query_noteedits.item[1] usr << browse(edit_log,"window=noteedits") - else if(href_list["removejobban"]) - if(!check_rights(R_BAN)) return - - var/t = href_list["removejobban"] - if(t) - if((alert("Do you want to unjobban [t]?","Unjobban confirmation", "Yes", "No") == "Yes") && t) //No more misclicks! Unless you do it twice. - log_admin("[key_name(usr)] removed [t]") - message_admins("[key_name_admin(usr)] removed [t]") - jobban_remove(t) - href_list["ban"] = 1 // lets it fall through and refresh - var/t_split = text2list(t, " - ") - var/key = t_split[1] - var/job = t_split[2] - DB_ban_unban(ckey(key), BANTYPE_JOB_PERMA, job) - else if(href_list["newban"]) if(!check_rights(R_BAN)) return @@ -1103,19 +1078,6 @@ if("Cancel") return - else if(href_list["unjobbanf"]) - if(!check_rights(R_BAN)) return - - var/banfolder = href_list["unjobbanf"] - Banlist.cd = "/base/[banfolder]" - var/key = Banlist["key"] - if(alert(usr, "Are you sure you want to unban [key]?", "Confirmation", "Yes", "No") == "Yes") - if (RemoveBanjob(banfolder)) - unjobbanpanel() - else - alert(usr,"This ban has already been lifted / does not exist.","Error","Ok") - unjobbanpanel() - //Watchlist else if(href_list["watchadd"]) var/target_ckey = locate(href_list["watchadd"]) diff --git a/code/modules/admin/verbs/diagnostics.dm b/code/modules/admin/verbs/diagnostics.dm index 399afc597b5..dce65ac5269 100644 --- a/code/modules/admin/verbs/diagnostics.dm +++ b/code/modules/admin/verbs/diagnostics.dm @@ -97,26 +97,3 @@ message_admins("[key_name_admin(usr)] manually reloaded admins") load_admins() feedback_add_details("admin_verb","RLDA") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! - -/client/proc/print_jobban_old() - set name = "Print Jobban Log" - set desc = "This spams all the active jobban entries for the current round to standard output." - set category = "Debug" - - usr << "Jobbans active in this round." - for(var/t in jobban_keylist) - usr << "[t]" - -/client/proc/print_jobban_old_filter() - set name = "Search Jobban Log" - set desc = "This searches all the active jobban entries for the current round and outputs the results to standard output." - set category = "Debug" - - var/filter = input("Contains what?","Filter") as text|null - if(!filter) - return - - usr << "Jobbans active in this round." - for(var/t in jobban_keylist) - if(findtext(t, filter)) - usr << "[t]" diff --git a/code/modules/admin/verbs/mapping.dm b/code/modules/admin/verbs/mapping.dm index 255c01abe52..74384f6a8c4 100644 --- a/code/modules/admin/verbs/mapping.dm +++ b/code/modules/admin/verbs/mapping.dm @@ -153,8 +153,6 @@ var/intercom_range_display_status = 0 src.verbs += /client/proc/cmd_admin_areatest src.verbs += /client/proc/cmd_admin_rejuvenate src.verbs += /datum/admins/proc/show_traitor_panel - src.verbs += /client/proc/print_jobban_old - src.verbs += /client/proc/print_jobban_old_filter src.verbs += /client/proc/disable_communication src.verbs += /client/proc/print_pointers src.verbs += /client/proc/count_movable_instances @@ -162,7 +160,6 @@ var/intercom_range_display_status = 0 src.verbs += /client/proc/cmd_show_at_list src.verbs += /client/proc/manipulate_organs src.verbs += /client/proc/reload_nanoui_resources - //src.verbs += /client/proc/cmd_admin_rejuvenate feedback_add_details("admin_verb","mDV") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! diff --git a/code/modules/client/client defines.dm b/code/modules/client/client defines.dm index c9217c164f7..e5b4a1d2895 100644 --- a/code/modules/client/client defines.dm +++ b/code/modules/client/client defines.dm @@ -6,6 +6,7 @@ var/datum/admins/holder = null var/buildmode = 0 + var/jobbancache = null //Used to cache this client's jobbans to save on DB queries var/last_message = "" //Contains the last message sent by this client - used to protect against copy-paste spamming. var/last_message_count = 0 //contins a number of how many times a message identical to last_message was sent. diff --git a/code/world.dm b/code/world.dm index fe34671e0e2..d47c2a97b62 100644 --- a/code/world.dm +++ b/code/world.dm @@ -34,12 +34,9 @@ var/global/list/map_transition_config = MAP_TRANSITION_CONFIG load_mode() load_motd() load_admins() - LoadBansjob() if(config.usewhitelist) load_whitelist() - jobban_loadbanfile() appearance_loadbanfile() - jobban_updatelegacybans() LoadBans() investigate_reset() diff --git a/tgstation.dme b/tgstation.dme index b775bf90359..b6f960e23bc 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -841,7 +841,6 @@ #include "code\modules\admin\holder2.dm" #include "code\modules\admin\IsBanned.dm" #include "code\modules\admin\NewBan.dm" -#include "code\modules\admin\newbanjob.dm" #include "code\modules\admin\player_panel.dm" #include "code\modules\admin\secrets.dm" #include "code\modules\admin\sql_notes.dm"