Ejemplo n.º 1
0
 /**
  * @param boolean
  * @return array
  */
 public function getDynamicTasks($dueOnly = FALSE)
 {
     $tasks = array();
     $now = new Now();
     foreach (self::getAllDynamicTaskImplementations($this->objectManager) as $dynamicTask) {
         $task = new Task($dynamicTask['expression'], $dynamicTask['implementation']);
         $cacheKey = md5($dynamicTask['implementation']);
         $lastExecution = $this->dynamicTaskLastExecutionCache->get($cacheKey);
         if ($dueOnly && ($lastExecution instanceof \DateTime && $now < $task->getNextExecution($lastExecution))) {
             continue;
         }
         $task->enable();
         $taskDecriptor = $this->getTaskDescriptor(TaskInterface::TYPE_DYNAMIC, $task);
         $taskDecriptor['lastExecution'] = $lastExecution instanceof \DateTime ? $lastExecution->format(\DateTime::ISO8601) : '';
         $taskDecriptor['identifier'] = '';
         $tasks[] = $taskDecriptor;
     }
     return $tasks;
 }
Ejemplo n.º 2
0
 /**
  * Enable the given persistend class
  *
  * @param Task $task persistend task identifier, see task:list
  */
 public function enableCommand(Task $task)
 {
     $task->enable();
     $this->taskService->update($task, TaskInterface::TYPE_PERSISTED);
 }