mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2025-12-21 15:51:31 +00:00
* Initial Commit - Async SQL * First batch of queries * More progress * Nukes DB Polls * More work * oops * One push * Notes work now * Ok these work * Watchlist done * Async Bans! * Async Permissions * Async client procs * I officially hate preference datums * Also these * Async Custom Items * Async Karma * Async Library * Async TOS * Cleans out the old SQL code * CI Sanity * Apparently MySQL doesnt support this * What about this * Maybe this * Review pass 1 * This too * Fixes job ban loading * Fix undeleted queries * Prevents sensitive queries being logged * Documentation + tweaks * Adds a verb to force reconnect the DB * More review tweaks * Farie tweaks * Fixes this
29 lines
1.0 KiB
Plaintext
29 lines
1.0 KiB
Plaintext
SUBSYSTEM_DEF(statistics)
|
|
name = "Statistics"
|
|
wait = 6000 // 10 minute delay between fires
|
|
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME // Only count time actually ingame to avoid logging pre-round dips
|
|
offline_implications = "Player count and admin count statistics will no longer be logged to the database. No immediate action is needed."
|
|
|
|
|
|
/datum/controller/subsystem/statistics/Initialize(start_timeofday)
|
|
if(!config.sql_enabled)
|
|
flags |= SS_NO_FIRE // Disable firing if SQL is disabled
|
|
return ..()
|
|
|
|
/datum/controller/subsystem/statistics/fire(resumed = 0)
|
|
sql_poll_players()
|
|
|
|
/datum/controller/subsystem/statistics/proc/sql_poll_players()
|
|
if(!SSdbcore.IsConnected())
|
|
return
|
|
else
|
|
var/datum/db_query/statquery = SSdbcore.NewQuery(
|
|
"INSERT INTO [format_table_name("legacy_population")] (playercount, admincount, time) VALUES (:playercount, :admincount, NOW())",
|
|
list(
|
|
"playercount" = length(GLOB.clients),
|
|
"admincount" = length(GLOB.admins)
|
|
)
|
|
)
|
|
statquery.warn_execute()
|
|
qdel(statquery)
|