Пример #1
0
 /**
  * Run cron
  */
 public function run()
 {
     $now = time();
     $cron_task = new Cron_Task();
     if ($tasks = $cron_task->findAll()) {
         // Discount all limits for cron to fill free
         @set_time_limit(0);
         @ignore_user_abort();
         foreach ($tasks as $task) {
             // If task hasn't been executed, it idles for first time
             if (!$task->last_exec) {
                 $task->last_exec = $now;
                 $task->save();
             } elseif ($now - $task->last_exec > $task->period) {
                 $cron_task->object($task);
                 $cron_task->run();
             }
         }
     }
 }
Пример #2
0
 /**
  * Run cron
  */
 public function run()
 {
     $now = time();
     $cron_task = new Cron_Task();
     if ($tasks = $cron_task->findAll()) {
         // Discount all limits for cron to fill free
         @set_time_limit(0);
         @ignore_user_abort();
         foreach ($tasks as $task) {
             // If task hasn't been executed, it idles for first time
             if (!$task->last_exec) {
                 $task->last_exec = $now;
                 $task->save();
             } elseif ($now - $task->last_exec > $task->period) {
                 $cron_task->object($task);
                 $cron_task->run();
             }
         }
     }
     $px = new Image(ENGINE . DS . 'Core' . DS . 'images' . DS . 'pixel.gif');
     $px->adapter->render();
     event('exit');
     exit;
 }