diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index bf2f9a1ba5e..2d72be3ac19 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -373,8 +373,6 @@ sqlfdbklogin = value if("feedback_password") sqlfdbkpass = value - if("enable_stat_tracking") - sqllogging = 1 else diary << "Unknown setting in configuration: '[name]'" diff --git a/code/defines/procs/dbcore.dm b/code/defines/procs/dbcore.dm index 45139ab3fb1..35470e8c598 100644 --- a/code/defines/procs/dbcore.dm +++ b/code/defines/procs/dbcore.dm @@ -56,7 +56,7 @@ DBConnection/New(dbi_handler,username,password_handler,cursor_handler) _db_con = _dm_db_new_con() DBConnection/proc/Connect(dbi_handler=src.dbi,user_handler=src.user,password_handler=src.password,cursor_handler) - if(!sqllogging) + if(!config.sql_enabled) return 0 if(!src) return 0 cursor_handler = src.default_cursor @@ -66,7 +66,7 @@ DBConnection/proc/Connect(dbi_handler=src.dbi,user_handler=src.user,password_han DBConnection/proc/Disconnect() return _dm_db_close(_db_con) DBConnection/proc/IsConnected() - if(!sqllogging) return 0 + if(!config.sql_enabled) return 0 var/success = _dm_db_is_connected(_db_con) return success diff --git a/code/defines/procs/statistics.dm b/code/defines/procs/statistics.dm index dc31d3da493..9e5ad12f28e 100644 --- a/code/defines/procs/statistics.dm +++ b/code/defines/procs/statistics.dm @@ -1,5 +1,5 @@ proc/sql_poll_players() - if(!sqllogging) + if(!config.sql_enabled) return var/playercount = 0 for(var/mob/M in player_list) @@ -17,7 +17,7 @@ proc/sql_poll_players() proc/sql_poll_admins() - if(!sqllogging) + if(!config.sql_enabled) return var/admincount = admins.len establish_db_connection() @@ -32,16 +32,16 @@ proc/sql_poll_admins() proc/sql_report_round_start() // TODO - if(!sqllogging) + if(!config.sql_enabled) return proc/sql_report_round_end() // TODO - if(!sqllogging) + if(!config.sql_enabled) return proc/sql_report_death(var/mob/living/carbon/human/H) - if(!sqllogging) + if(!config.sql_enabled) return if(!H) return @@ -76,7 +76,7 @@ proc/sql_report_death(var/mob/living/carbon/human/H) proc/sql_report_cyborg_death(var/mob/living/silicon/robot/H) - if(!sqllogging) + if(!config.sql_enabled) return if(!H) return @@ -111,7 +111,7 @@ proc/sql_report_cyborg_death(var/mob/living/silicon/robot/H) proc/statistic_cycle() - if(!sqllogging) + if(!config.sql_enabled) return while(1) sql_poll_players() diff --git a/code/global.dm b/code/global.dm index 0bc5d4a9304..9a99a7ac518 100644 --- a/code/global.dm +++ b/code/global.dm @@ -171,22 +171,14 @@ var/list/hit_appends = list("-OOF", "-ACK", "-UGH", "-HRNK", "-HURGH", "-GLORF") var/sqladdress = "localhost" var/sqlport = "3306" -var/sqldb = "tgstation" -var/sqllogin = "root" -var/sqlpass = "" - - // Feedback gathering sql connection - var/sqlfdbkdb = "test" var/sqlfdbklogin = "root" var/sqlfdbkpass = "" -var/sqllogging = 0 // Should we log deaths, population stats, etc? - // For FTP requests. (i.e. downloading runtime logs.) // However it'd be ok to use for accessing attack logs and such too, which are even laggier. var/fileaccess_timer = 0 //Database connections //A connection is established on world creation. Ideally, the connection dies when the server restarts (After feedback logging.). -var/DBConnection/dbcon = new() //Feedback database (New database) +var/DBConnection/dbcon = new() //Feedback database (New database) diff --git a/code/world.dm b/code/world.dm index becdef1d031..758585776a2 100644 --- a/code/world.dm +++ b/code/world.dm @@ -268,7 +268,7 @@ var/failed_db_connections = 0 proc/setup_database_connection() - if(failed_db_connections > FAILED_DB_CONNECTION_CUTOFF) //If it failed to establish a connection more than 5 times in a row, don't bother attempting to conenct anymore. + if(failed_db_connections >= FAILED_DB_CONNECTION_CUTOFF) //If it failed to establish a connection more than 5 times in a row, don't bother attempting to connect anymore. return 0 if(!dbcon) @@ -286,7 +286,8 @@ proc/setup_database_connection() failed_db_connections = 0 //If this connection succeeded, reset the failed connections counter. else failed_db_connections++ //If it failed, increase the failed connections counter. - world.log << "SQL error: " + dbcon.ErrorMsg() + if(config.sql_enabled) + world.log << "SQL error: " + dbcon.ErrorMsg() return . diff --git a/config/dbconfig.txt b/config/dbconfig.txt index e01ba9a0655..c7e81e02b22 100644 --- a/config/dbconfig.txt +++ b/config/dbconfig.txt @@ -1,25 +1,22 @@ -# MySQL Connection Configuration -# This is used for stats, feedback gathering, -# administration, and the in game library. +## MySQL Connection Configuration +## This is used for stats, feedback gathering, +## administration, and the in game library. -# Should SQL be enabled? Uncomment to enable. +## Should SQL be enabled? Uncomment to enable. #SQL_ENABLED -# Server the MySQL database can be found at. +## Server the MySQL database can be found at. # Examples: localhost, 200.135.5.43, www.mysqldb.com, etc. ADDRESS localhost -# MySQL server port (default is 3306). +## MySQL server port (default is 3306). PORT 3306 -# Database for all SQL functions, not just feedback. +## Database for all SQL functions, not just feedback. FEEDBACK_DATABASE feedback -# Username/Login used to access the database. +## Username/Login used to access the database. FEEDBACK_LOGIN username -# Password used to access the database. -FEEDBACK_PASSWORD password - -# Comment out to disable tracking of population and death statistics. -ENABLE_STAT_TRACKING \ No newline at end of file +## Password used to access the database. +FEEDBACK_PASSWORD password \ No newline at end of file