mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-26 21:48:21 +01:00
Async SQL + SSdbcore (#15007)
* Initial Commit - Async SQL * First batch of queries * More progress * Nukes DB Polls * More work * oops * One push * Notes work now * Ok these work * Watchlist done * Async Bans! * Async Permissions * Async client procs * I officially hate preference datums * Also these * Async Custom Items * Async Karma * Async Library * Async TOS * Cleans out the old SQL code * CI Sanity * Apparently MySQL doesnt support this * What about this * Maybe this * Review pass 1 * This too * Fixes job ban loading * Fix undeleted queries * Prevents sensitive queries being logged * Documentation + tweaks * Adds a verb to force reconnect the DB * More review tweaks * Farie tweaks * Fixes this
This commit is contained in:
@@ -168,7 +168,8 @@ GLOBAL_LIST_INIT(admin_verbs_debug, list(
|
||||
/client/proc/jump_to_ruin,
|
||||
/client/proc/toggle_medal_disable,
|
||||
/client/proc/uid_log,
|
||||
/client/proc/visualise_active_turfs
|
||||
/client/proc/visualise_active_turfs,
|
||||
/client/proc/reestablish_db_connection
|
||||
))
|
||||
GLOBAL_LIST_INIT(admin_verbs_possess, list(
|
||||
/proc/possess,
|
||||
@@ -176,7 +177,6 @@ GLOBAL_LIST_INIT(admin_verbs_possess, list(
|
||||
))
|
||||
GLOBAL_LIST_INIT(admin_verbs_permissions, list(
|
||||
/client/proc/edit_admin_permissions,
|
||||
/client/proc/create_poll,
|
||||
/client/proc/big_brother
|
||||
))
|
||||
GLOBAL_LIST_INIT(admin_verbs_rejuv, list(
|
||||
@@ -691,15 +691,23 @@ GLOBAL_LIST_INIT(admin_verbs_ticket, list(
|
||||
continue
|
||||
|
||||
else
|
||||
if(!GLOB.dbcon.IsConnected())
|
||||
message_admins("Warning, MySQL database is not connected.")
|
||||
if(!SSdbcore.IsConnected())
|
||||
to_chat(src, "Warning, MYSQL database is not connected.")
|
||||
return
|
||||
var/sql_ckey = sanitizeSQL(ckey)
|
||||
var/DBQuery/query = GLOB.dbcon.NewQuery("SELECT rank FROM [format_table_name("admin")] WHERE ckey = '[sql_ckey]'")
|
||||
query.Execute()
|
||||
while(query.NextRow())
|
||||
rank = ckeyEx(query.item[1])
|
||||
|
||||
var/datum/db_query/rank_read = SSdbcore.NewQuery(
|
||||
"SELECT rank FROM [format_table_name("admin")] WHERE ckey=:ckey",
|
||||
list("ckey" = ckey)
|
||||
)
|
||||
|
||||
if(!rank_read.warn_execute())
|
||||
qdel(rank_read)
|
||||
return FALSE
|
||||
|
||||
while(rank_read.NextRow())
|
||||
rank = ckeyEx(rank_read.item[1])
|
||||
|
||||
qdel(rank_read)
|
||||
if(!D)
|
||||
if(config.admin_legacy_system)
|
||||
if(GLOB.admin_ranks[rank] == null)
|
||||
@@ -709,24 +717,38 @@ GLOBAL_LIST_INIT(admin_verbs_ticket, list(
|
||||
|
||||
D = new(rank, GLOB.admin_ranks[rank], ckey)
|
||||
else
|
||||
var/sql_ckey = sanitizeSQL(ckey)
|
||||
var/DBQuery/query = GLOB.dbcon.NewQuery("SELECT ckey, rank, flags FROM [format_table_name("admin")] WHERE ckey = '[sql_ckey]'")
|
||||
query.Execute()
|
||||
while(query.NextRow())
|
||||
var/admin_ckey = query.item[1]
|
||||
var/admin_rank = query.item[2]
|
||||
var/flags = query.item[3]
|
||||
if(!SSdbcore.IsConnected())
|
||||
to_chat(src, "Warning, MYSQL database is not connected.")
|
||||
return
|
||||
|
||||
var/datum/db_query/admin_read = SSdbcore.NewQuery(
|
||||
"SELECT ckey, rank, flags FROM [format_table_name("admin")] WHERE ckey=:ckey",
|
||||
list("ckey" = ckey)
|
||||
)
|
||||
|
||||
if(!admin_read.warn_execute())
|
||||
qdel(admin_read)
|
||||
return FALSE
|
||||
|
||||
while(admin_read.NextRow())
|
||||
var/admin_ckey = admin_read.item[1]
|
||||
var/admin_rank = admin_read.item[2]
|
||||
var/flags = admin_read.item[3]
|
||||
if(!admin_ckey)
|
||||
to_chat(src, "Error while re-adminning, ckey [admin_ckey] was not found in the admin database.")
|
||||
qdel(admin_read)
|
||||
return
|
||||
if(admin_rank == "Removed") //This person was de-adminned. They are only in the admin list for archive purposes.
|
||||
to_chat(src, "Error while re-adminning, ckey [admin_ckey] is not an admin.")
|
||||
qdel(admin_read)
|
||||
return
|
||||
|
||||
if(istext(flags))
|
||||
flags = text2num(flags)
|
||||
D = new(admin_rank, flags, ckey)
|
||||
|
||||
qdel(admin_read)
|
||||
|
||||
var/client/C = GLOB.directory[ckey]
|
||||
D.associate(C)
|
||||
message_admins("[key_name_admin(usr)] re-adminned themselves.")
|
||||
|
||||
Reference in New Issue
Block a user