diff --git a/code/game/magic/archived_book.dm b/code/game/magic/archived_book.dm index 0e9225c66b6..b4ac91c3f68 100644 --- a/code/game/magic/archived_book.dm +++ b/code/game/magic/archived_book.dm @@ -29,6 +29,32 @@ datum/book_manager/proc/freeid() return id +/client/proc/delbook() + set name = "Delete Book" + set desc = "Permamently deletes a book from the database." + set category = "Admin" + if(!src.holder) + src << "Only administrators may use this command." + return + + var/isbn = input("ISBN number?", "Delete Book") as num | null + if(!isbn) + return + + if(config.sql_enabled) + var/DBConnection/dbcon = new() + dbcon.Connect("dbi:mysql:[sqldb]:[sqladdress]:[sqlport]","[sqllogin]","[sqlpass]") + if(!dbcon.IsConnected()) + alert("Connection to Archive has been severed. Aborting.") + else + var/DBQuery/query = dbcon.NewQuery("DELETE FROM library WHERE id=[isbn]") + if(!query.Execute()) + usr << query.ErrorMsg() + dbcon.Disconnect() + else + book_mgr.remove(isbn) + log_admin("[usr.key] has deleted the book [isbn]") + // delete a book datum/book_manager/proc/remove(var/id) fdel(path(id)) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 5c57602b09e..3ae78a4acfd 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -172,6 +172,7 @@ verbs += /client/proc/strike_team verbs += /client/proc/admin_invis verbs += /client/proc/cmd_admin_godmode + verbs += /client/proc/delbook if (holder.level >= 4)//Badmin******************************************************************** verbs += /obj/admins/proc/adrev //toggle admin revives @@ -406,6 +407,7 @@ verbs -= /client/proc/callprocgen verbs -= /client/proc/callprocobj verbs -= /client/proc/cmd_admin_godmode + verbs -= /client/proc/delbook return