From de064363209a5541f3e84470557bf0f2a304757f Mon Sep 17 00:00:00 2001 From: MrStonedOne Date: Fri, 24 Oct 2014 12:34:07 -0700 Subject: [PATCH] Makes re-establish db connection verb logic better --- .../admin/verbs/reestablish_db_connection.dm | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/code/modules/admin/verbs/reestablish_db_connection.dm b/code/modules/admin/verbs/reestablish_db_connection.dm index 67586501bb5..146b8481a19 100644 --- a/code/modules/admin/verbs/reestablish_db_connection.dm +++ b/code/modules/admin/verbs/reestablish_db_connection.dm @@ -1,6 +1,9 @@ /client/proc/reestablish_db_connection() set category = "Special Verbs" set name = "Reestablish DB Connection" + if (!config.sql_enabled) + usr << "The Database is not enabled!" + return if (dbcon && dbcon.IsConnected()) if (!check_rights(R_DEBUG,0)) @@ -13,15 +16,16 @@ dbcon.Disconnect() failed_db_connections = 0 - log_admin("[key_name(usr)] Has forced the database to reconnect") - message_admins("[key_name_admin(usr)] Has forced the database to reconnect") + log_admin("[key_name(usr)] has forced the database to disconnect") + message_admins("[key_name_admin(usr)] has forced the database to disconnect!") feedback_add_details("admin_verb","FRDB") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + log_admin("[key_name(usr)] is attempting to re-established the DB Connection") + message_admins("[key_name_admin(usr)] is attempting to re-established the DB Connection") + feedback_add_details("admin_verb","RDB") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! failed_db_connections = 0 - spawn(0) - establish_db_connection() - - log_admin("[key_name(usr)] Has re-established the DB Connection") - message_admins("[key_name_admin(usr)] Has re-established the DB Connection") - feedback_add_details("admin_verb","RDB") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! \ No newline at end of file + if (!establish_db_connection()) + message_admins("Database connection failed: " + dbcon.ErrorMsg()) + else + message_admins("Database connection re-established") \ No newline at end of file