Exemplo n.º 1
0
 function run()
 {
     //called by outside cron NOT autocron
     Cron::MailFetcher();
     Cron::TicketMonitor();
     cron::PurgeLogs();
 }
Exemplo n.º 2
0
if ($sec < 180 || !$ost || $ost->isUpgradePending())
    ob_end_clean();

require_once(INCLUDE_DIR.'class.cron.php');

// Clear staff obj to avoid false credit internal notes & auto-assignment
$thisstaff = null;

// Release the session to prevent locking a future request while this is
// running
$_SESSION['lastcroncall'] = time();
session_write_close();

// Age tickets: We're going to age tickets regardless of cron settings.
Cron::TicketMonitor();

// Run file purging about every 20 cron runs (1h40 on a five minute cron)
if (mt_rand(1, 20) == 4)
    Cron::CleanOrphanedFiles();

if($cfg && $cfg->isAutoCronEnabled()) { //ONLY fetch tickets if autocron is enabled!
    Cron::MailFetcher();  //Fetch mail.
    $ost->logDebug(_S('Auto Cron'), sprintf(_S('Mail fetcher cron call [%s]'), $caller));
}

$data = array('autocron'=>true);
Signal::send('cron', $data);

ob_end_clean();
?>
Exemplo n.º 3
0
print $data;
// Flush the request buffer
while (@ob_end_flush()) {
}
flush();
//Terminate the request
if (function_exists('fastcgi_finish_request')) {
    fastcgi_finish_request();
}
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 && $ost && !$ost->isUpgradePending()) {
    //user can call cron once every 3 minutes.
    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 [' . $caller . ']');
    }
    $_SESSION['lastcroncall'] = time();
}
ob_end_clean();