July 5th TG sync (#1883)

July 5th TG sync
This commit is contained in:
Poojawa
2017-07-05 22:14:19 -05:00
committed by GitHub
parent 454b9c3d68
commit b1b4826c0c
1264 changed files with 149689 additions and 570309 deletions
+20 -8
View File
@@ -24,6 +24,7 @@
config = new
CheckSchemaVersion()
SetRoundID()
SetupLogs()
@@ -33,7 +34,6 @@
load_motd()
load_admins()
// load_mentors()
LoadVerbs(/datum/verbs/menu)
if(config.usewhitelist)
load_whitelist()
@@ -57,18 +57,32 @@
external_rsc_urls.Cut(i,i+1)
#endif
/world/proc/SetRoundID()
/world/proc/CheckSchemaVersion()
if(config.sql_enabled)
if(SSdbcore.Connect())
log_world("Database connection established.")
var/datum/DBQuery/db_version = SSdbcore.NewQuery("SELECT major, minor FROM [format_table_name("schema_version")]")
db_version.Execute()
if(db_version.NextRow())
var/db_major = db_version.item[1]
var/db_minor = db_version.item[2]
if(db_major < DB_MAJOR_VERSION || db_minor < DB_MINOR_VERSION)
message_admins("db schema ([db_major].[db_minor]) is behind latest tg schema version ([DB_MAJOR_VERSION].[DB_MINOR_VERSION]), this may lead to undefined behaviour or errors")
log_sql("db schema ([db_major].[db_minor]) is behind latest tg schema version ([DB_MAJOR_VERSION].[DB_MINOR_VERSION]), this may lead to undefined behaviour or errors")
else
message_admins("Could not get schema version from db")
else
log_world("Your server failed to establish a connection with the database.")
/world/proc/SetRoundID()
if(config.sql_enabled)
if(SSdbcore.Connect())
var/datum/DBQuery/query_round_start = SSdbcore.NewQuery("INSERT INTO [format_table_name("round")] (start_datetime, server_ip, server_port) VALUES (Now(), INET_ATON(IF('[world.internet_address]' LIKE '', '0', '[world.internet_address]')), '[world.port]')")
query_round_start.Execute()
var/datum/DBQuery/query_round_last_id = SSdbcore.NewQuery("SELECT LAST_INSERT_ID()")
query_round_last_id.Execute()
if(query_round_last_id.NextRow())
GLOB.round_id = query_round_last_id.item[1]
else
log_world("Your server failed to establish a connection with the database.")
/world/proc/SetupLogs()
GLOB.log_directory = "data/logs/[time2text(world.realtime, "YYYY/MM/DD")]/round-"
@@ -91,13 +105,12 @@
if(GLOB.round_id)
log_game("Round ID: [GLOB.round_id]")
/world/Topic(T, addr, master, key)
var/list/input = params2list(T)
var/pinging = ("ping" in input)
var/playing = ("players" in input)
if(!pinging && !playing && config && config.log_world_topic)
GLOB.world_game_log << "TOPIC: \"[T]\", from:[addr], master:[master], key:[key]"
@@ -251,7 +264,6 @@
s += "<b>[station_name()]</b>";
s += " ("
s += "<a href=\"http://\">" //Change this to wherever you want the hub to link to.
// s += "[game_version]"
s += "Default" //Replace this with something else. Or ever better, delete it and uncomment the game version.
s += "</a>"
s += ")"