global $db; $stmt = $db->prepare(self::SQL_UPDATE_COMPILE_MODEL); $stmt->execute(array(':last_compile_dt' => gmdate('Y-m-d H:i:s'), ':compile_status' => $compile_status, ':compile_msg' => $compile_status === 0 ? "" : $compile_msg, ':mid' => $mid)); } catch (PDOException $Exception) { throw new RuleException($Exception->getMessage(), 401); } } public function compile_model() { //$this->validate_admin($uid, $apikey); try { global $db; $stmt = $db->prepare(self::SQL_FETCH_ONE_MODEL); $stmt->execute(); $result = $stmt->fetchAll(PDO::FETCH_ASSOC); foreach ($result as $value) { $status_code; $status_msg; $this->compile_using_docker($value['mbody'], $status_code, $status_msg); //var_dump($status_code); //var_dump($status_msg); $this->update_model_compile_db($status_code, $status_msg, $value['mid']); } } catch (PDOException $Exception) { throw new RuleException($Exception->getMessage(), 401); } } } $deamon = new Deamon(); $deamon->compile_model();