From 5807cd337405728fb25cc9dbff4715036cc20a46 Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@osticket.com> Date: Tue, 2 Oct 2012 14:45:29 -0400 Subject: [PATCH] Clobber object on auto-cron (Fixes false credit) --- scp/autocron.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scp/autocron.php b/scp/autocron.php index 08b65ba34..4a3b00678 100644 --- a/scp/autocron.php +++ b/scp/autocron.php @@ -30,13 +30,17 @@ ob_start(); //Keep the image output clean. Hide our dirt. //TODO: Make cron DB based to allow for better time limits. Direct calls for now sucks big time. //We DON'T want to spawn cron on every page load...we record the lastcroncall on the session per user $sec=time()-$_SESSION['lastcroncall']; +$caller = $thisstaff->getUserName(); + if($sec>180): //user can call cron once every 3 minutes. -require_once(INCLUDE_DIR.'class.cron.php'); +require_once(INCLUDE_DIR.'class.cron.php'); + +$thisstaff = null; //Clear staff obj to avoid false credit internal notes & auto-assignment Cron::TicketMonitor(); //Age tickets: We're going to age tickets regardless of cron settings. if($cfg && $cfg->isAutoCronEnabled()) { //ONLY fetch tickets if autocron is enabled! Cron::MailFetcher(); //Fetch mail. - $ost->logDebug('Auto Cron', 'Mail fetcher cron call ['.$thisstaff->getUserName().']'); -} + $ost->logDebug('Auto Cron', 'Mail fetcher cron call ['.$caller.']'); +} $_SESSION['lastcroncall']=time(); endif; -- GitLab