Beispiel #1
0
 $viewAlertsByJob = $alertsClass->viewAlertsByJob($jobID);
 if (!file_exists($jobPath)) {
     $message = sprintf(__("Job %s (%d) has a invalid path!"), $jobName, $jobID);
     $populateArray = array('startingScript' => $startingScript, 'endingScript' => time(), 'http_code' => 0, 'total_time' => 0, 'redirect_count' => 0, 'content_type' => 'text/plain', 'others' => NULL, 'responseContent' => 'NULL', 'comments' => $message, 'run_problems' => true);
     $logger->addError($message);
     foreach ($viewAlertsByJob as $singleAlert) {
         if ($singleAlert['block_other_jobs'] == true) {
             $blockClass->addBlock($jobID, $singleAlert['alert_id']);
         }
     }
     $runClass->addRunning($jobID, $populateArray);
     throw new Exception($message);
 }
 $logger->addInfo(sprintf("\r\n############################################\r\nRunning job ID %d\r\n############################################", $jobID));
 //Atualizar o is_running e o last_run
 $jobClass->updateJobAttr($jobID, 'is_running', true);
 $jobClass->updateJobAttr($jobID, 'last_run', date("Y-m-d H:i:s", time()));
 echo sprintf("############################################<br />Running job ID %d<br />############################################", $jobID);
 if ($jobClass->checkIfJobIsBlocked($jobID)) {
     $logger->addInfo(sprintf(__("Job %s (%d) blocked by another job!"), $jobName, $jobID));
     throw new \Exception(sprintf(__("Job %s (%d) blocked by another job!"), $jobName, $jobID));
 }
 //Executando o script interno
 exec("php {$jobPath}", $execReturn);
 $JobResponse = json_decode(end($execReturn), true);
 $logger->addInfo(sprintf(__("Raw Job %s (%d) response: %s"), $jobName, $jobID, var_export($execReturn, true)));
 foreach ($viewAlertsByJob as $singleAlert) {
     $queryWhen = transformAlertWhen($singleAlert['alert_when']);
     $queryComparison = transformAlertComparison($singleAlert['alert_comparison']);
     $queryReturn = $singleAlert['alert_return'];
     if (!array_key_exists($queryWhen, $JobResponse)) {