From cece5392be5031db033f437b936e2dc463b54014 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Barrois?= Date: Wed, 15 May 2013 21:40:01 +0200 Subject: [PATCH] Add timers to compliance.php --- bin/cron/compliance.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/cron/compliance.php b/bin/cron/compliance.php index 5d3882e..6fd195f 100755 --- a/bin/cron/compliance.php +++ b/bin/cron/compliance.php @@ -72,13 +72,15 @@ function discardExpiredSessions($userPerms, $retentionPeriod, $minimalBacklog) { * Checks for sessions without a valid associated user id. */ function checkOrphanedSessions() { + $begin = time(); $res = XDB::query( "SELECT COUNT(*) FROM log_sessions AS s LEFT JOIN #x5dat#.accounts AS a ON (a.uid = s.uid) WHERE a.uid IS NULL"); if (($count = $res->fetchOneCell())) { - echo "Orphaned sessions: found $count orphaned sessions. Please fix that.\n"; + $duration = time() - $begin; + echo "Orphaned sessions: found $count orphaned sessions in $duration seconds. Please fix that.\n"; } } @@ -86,13 +88,15 @@ function checkOrphanedSessions() { * Purges session events without a valid session. */ function purgeOrphanedEvents() { + $begin = time(); XDB::execute( "DELETE e FROM log_events AS e LEFT JOIN log_sessions AS s ON (s.id = e.session) WHERE s.id IS NULL"); $affectedRows = XDB::affectedRows(); - echo "Orphaned events: removed $affectedRows events.\n"; + $duration = time() - $begin; + echo "Orphaned events: removed $affectedRows events in $duration seconds.\n"; } // Remove expired sessions. -- 2.1.4