From 6c9346d0c4d7a8f1f6e5c293dd091fa0ba26d2d6 Mon Sep 17 00:00:00 2001 From: Arokha Sieyes Date: Sat, 14 May 2016 21:09:21 -0400 Subject: [PATCH] Prevent Unexpected SQL Errors (#1628) * Don't nag me, game. * Added disabled message, made config consistent * Missed adding 'else' --- code/controllers/configuration.dm | 4 ++-- code/world.dm | 8 ++++++-- config/example/config.txt | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index bd817baf41..d456c52e71 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -21,7 +21,7 @@ var/list/gamemode_cache = list() var/log_pda = 0 // log pda messages var/log_hrefs = 0 // logs all links clicked in-game. Could be used for debugging and tracking down exploits var/log_runtime = 0 // logs world.log to a file - var/sql_enabled = 1 // for sql switching + var/sql_enabled = 0 // for sql switching var/allow_admin_ooccolor = 0 // Allows admins with relevant permissions to have their own ooc colour var/allow_vote_restart = 0 // allow votes to restart var/ert_admin_call_only = 0 @@ -289,7 +289,7 @@ var/list/gamemode_cache = list() config.log_access = 1 if ("sql_enabled") - config.sql_enabled = text2num(value) + config.sql_enabled = 1 if ("log_say") config.log_say = 1 diff --git a/code/world.dm b/code/world.dm index b81c0f7c3a..bfa399fe2a 100644 --- a/code/world.dm +++ b/code/world.dm @@ -558,7 +558,9 @@ var/failed_db_connections = 0 var/failed_old_db_connections = 0 /hook/startup/proc/connectDB() - if(!setup_database_connection()) + if(!config.sql_enabled) + world.log << "SQL connection disabled in config." + else if(!setup_database_connection()) world.log << "Your server failed to establish a connection with the feedback database." else world.log << "Feedback database connection established." @@ -600,7 +602,9 @@ proc/establish_db_connection() /hook/startup/proc/connectOldDB() - if(!setup_old_database_connection()) + if(!config.sql_enabled) + world.log << "SQL connection disabled in config." + else if(!setup_old_database_connection()) world.log << "Your server failed to establish a connection with the SQL database." else world.log << "SQL database connection established." diff --git a/config/example/config.txt b/config/example/config.txt index b38bfd7354..ec93429827 100644 --- a/config/example/config.txt +++ b/config/example/config.txt @@ -67,8 +67,8 @@ LOG_PDA ## log admin warning messages ##LOG_ADMINWARN ## Also duplicates a bunch of other messages. -## sql switching -# SQL_ENABLED +## Enable/disable SQL connection (comment out to disable) +SQL_ENABLED ## disconnect players who did nothing during the set amount of minutes # KICK_INACTIVE 10