public static function shutDown() { chdir(APP_PATH); $error = error_get_last(); if ($error !== null) { ini_set('memory_limit', memory_get_usage() + 16 * 1024 * 1024); //in case it was an memory limit error make sure we have enough memory for error handling $ignore = false; if (preg_match('#^include\\(\\).*Failed opening \'[^\']*cache/setup\\d+.php\' for inclusion#', $error['message'])) { //ignore error that can happen before creating setup the first time $ignore = true; } if (defined('E_STRICT') && $error["type"] == E_STRICT) { $ignore = true; } if (defined('E_DEPRECATED') && $error["type"] == E_DEPRECATED) { $ignore = true; } if (!$ignore) { $e = new ErrorException($error["message"], 0, $error["type"], $error["file"], $error["line"]); Kwf_Debug::handleException($e); } } Kwf_Benchmark::shutDown(); }
public function render($ignoreCli = false) { try { if (isset($_SERVER['REQUEST_URI']) && Kwf_Setup::hasDb() && Kwf_Registry::get('dao')->getDbConfig()) { $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : null; $target = Kwf_Model_Abstract::getInstance('Kwf_Util_Model_Redirects')->findRedirectUrl('path', $_SERVER['REQUEST_URI'], $host); if ($target) { header('Location: ' . $target, true, 301); exit; } } } catch (Exception $e) { Kwf_Debug::handleException($e); } parent::render($ignoreCli); }