Example #1
0
 public function responseAction()
 {
     $id = $this->dispatcher->getParam('id', 'uint', 0);
     $file = $this->dispatcher->getParam('file', 'string', '');
     $job = Job::findFirst(['executed_at is null and job_id = ?0', 'bind' => [$id]]);
     if ($job) {
         $job->save(['response' => file_get_contents($file), 'executed_at' => date('Y-m-d H:i:s')]);
         Assert::noMessages($job);
     } else {
         echo "JOB {$id} NOT FOUND\n";
     }
 }
Example #2
0
 public function executeAction()
 {
     Assert::found($id = (int) $this->dispatcher->getParam('0', 'uint'));
     Assert::found($task = Task::findFirst($id), "Task not found");
     $job = Job::findFirst(['task_id = ?0 and executed_at is null', 'bind' => [$task->task_id]]);
     if (!$job) {
         $job = new Job();
         $job->save(['task_id' => $task->task_id]);
         Assert::noMessages($job);
     }
     return $this->response->redirect('/task/run/' . $job->job_id, true);
 }