/** * Run tasks */ private function runTasks() { // // Check task if (!empty($this->tasks)) { fastcgi_finish_request(); // allow to run one hour ini_set('max_execution_time', intval(Conf::get('wisphp.fastcgi_finish_timeout', 3600))); foreach ($this->tasks as $task) { if (is_callable($task[0])) { // buffer output ob_start(); call_user_func_array($task[0], $task[1]); $output = ob_get_clean(); if ($output) { Logger::trace('task output:' . $output); } } } } }
/** * Inner Exception handler * * @param Exception $ex */ public function exceptionHandler($ex) { restore_exception_handler(); $errcode = $ex->getMessage(); $errmsg = sprintf('caught exception, errcode:%s, trace: %s', $errcode, $ex->__toString()); if ($pos = strpos($errcode, ' ')) { $errcode = substr($errcode, 0, $pos); } $this->endStatus = $errcode; if ($this->isUserErr($errcode)) { Logger::trace($errmsg); } else { Logger::fatal($errmsg); } }