Beispiel #1
0
 /**
  * Run the task
  *
  * @param Task $task The task
  *
  * @return mixed|null The task return value or null when if failed or dry run
  */
 protected function runTask(Task $task)
 {
     if ($this->running) {
         return parent::runTask($task);
     }
     $this->running = true;
     $as = $this->getAs();
     foreach ($this->getArray() as $key => $value) {
         foreach ($as as $type => $name) {
             $this->set($name, ${$type});
         }
         try {
             parent::runTask($task);
         } catch (\Exception $exception) {
             break;
         }
     }
     if (isset($exception) && $exception instanceof Exception\BreakException) {
         $message = $exception->getMessage();
         if ($message) {
             $this->console->output($task->expand($message));
         }
         unset($exception);
     }
     if (isset($key)) {
         foreach ($as as $name) {
             $this->remove($name);
         }
     }
     $this->running = false;
     if (isset($exception)) {
         throw $exception;
     }
 }
Beispiel #2
0
 public function updateSubTask($id, $status)
 {
     try {
         $subTask = \SubTask::find($id);
         $subTask->status = $status;
         $subTask->save();
         return 'success';
     } catch (\Exception $e) {
         \Log::error('Someting Went Wrong in Task Repository - updateSubTask():' . $e->getMessage());
         return 'error';
     }
 }
Beispiel #3
0
 /**
  * Run an array of tasks
  *
  * @return mixed The ran tasks return value
  */
 public function run()
 {
     try {
         return parent::run();
     } catch (\Exception $e) {
         $message = $this->get('errorMessage');
         if ($message) {
             $this->console->output($message);
         }
         if ($this->catchTask) {
             return $this->addTask($this->catchTask);
         }
         return null;
     }
 }