mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-20 19:44:09 +01:00
Merge pull request #8577 from Allfd/logs
Adds log rotate command to World/Topic()
This commit is contained in:
+17
-8
@@ -7,7 +7,7 @@ var/global/datum/global_init/init = new ()
|
||||
|
||||
makeDatumRefLists()
|
||||
load_configuration()
|
||||
|
||||
setLog()
|
||||
del(src)
|
||||
|
||||
/world
|
||||
@@ -23,14 +23,8 @@ var/global/datum/global_init/init = new ()
|
||||
var/global/list/map_transition_config = MAP_TRANSITION_CONFIG
|
||||
|
||||
/world/New()
|
||||
//logs
|
||||
var/date_string = time2text(world.realtime, "YYYY/MM-Month/DD-Day")
|
||||
href_logfile = file("data/logs/[date_string] hrefs.htm")
|
||||
diary = file("data/logs/[date_string].log")
|
||||
diaryofmeanpeople = file("data/logs/[date_string] Attack.log")
|
||||
diary << "\n\nStarting up. [time2text(world.timeofday, "hh:mm.ss")]\n---------------------"
|
||||
diaryofmeanpeople << "\n\nStarting up. [time2text(world.timeofday, "hh:mm.ss")]\n---------------------"
|
||||
|
||||
if(byond_version < RECOMMENDED_VERSION)
|
||||
log_to_dd("Your server's byond version does not meet the recommended requirements for this code. Please update BYOND")
|
||||
|
||||
@@ -264,6 +258,14 @@ var/world_topic_spam_protect_time = world.timeofday
|
||||
|
||||
return "Kick Successful"
|
||||
|
||||
else if("setlog" in input)
|
||||
if(!key_valid)
|
||||
return keySpamProtect(addr)
|
||||
|
||||
setLog()
|
||||
|
||||
return "Logs set to current date"
|
||||
|
||||
/proc/keySpamProtect(var/addr)
|
||||
if(world_topic_spam_protect_ip == addr && abs(world_topic_spam_protect_time - world.time) < 50)
|
||||
spawn(50)
|
||||
@@ -453,6 +455,12 @@ var/world_topic_spam_protect_time = world.timeofday
|
||||
var/failed_db_connections = 0
|
||||
var/failed_old_db_connections = 0
|
||||
|
||||
/proc/setLog()
|
||||
var/date_string = time2text(world.realtime, "YYYY/MM-Month/DD-Day")
|
||||
href_logfile = file("data/logs/[date_string] hrefs.htm")
|
||||
diary = file("data/logs/[date_string].log")
|
||||
diaryofmeanpeople = file("data/logs/[date_string] Attack.log")
|
||||
|
||||
/hook/startup/proc/connectDB()
|
||||
if(!setup_database_connection())
|
||||
log_to_dd("Your server failed to establish a connection with the feedback database.")
|
||||
@@ -460,7 +468,7 @@ var/failed_old_db_connections = 0
|
||||
log_to_dd("Feedback database connection established.")
|
||||
return 1
|
||||
|
||||
proc/setup_database_connection()
|
||||
/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.
|
||||
return 0
|
||||
@@ -495,3 +503,4 @@ proc/establish_db_connection()
|
||||
return 1
|
||||
|
||||
#undef FAILED_DB_CONNECTION_CUTOFF
|
||||
|
||||
|
||||
Reference in New Issue
Block a user