Example #1
0
 /**
  * Execute the task
  *
  * @param   array $taskData Task data
  *
  * @return bool True on success, false otherwise
  */
 public function run($taskData)
 {
     $tasksNeedToBeCleanUp = NenoTask::load(array('_field' => 'numberOfAttemps', '_condition' => '>', '_value' => 3));
     /* @var $taskNeedToBeCleanUp NenoTask */
     foreach ($tasksNeedToBeCleanUp as $taskNeedToBeCleanUp) {
         NenoLog::add($taskNeedToBeCleanUp->getTask() . ' task has been deleted because reaches the maximum number of attempts allowed');
         $taskNeedToBeCleanUp->remove();
     }
     return false;
 }
Example #2
0
 /**
  * Execute a particular task given by parameter
  *
  * @param   NenoTask|null $task Task to execute
  *
  * @return bool True on success, false otherwise
  */
 private static function executeTask($task)
 {
     NenoLog::log('Received translation job to execute', 2);
     // If there are task to execute, let's run it
     if (!empty($task)) {
         $task->execute();
         NenoLog::add($task->getTask() . ' task has been executed properly');
         $task->remove();
         return true;
     }
     return false;
 }