isDir()) throw new IOException('file is not an directory or does not exist', IOException::IO_NOT_FOUND, $directory); $system = System::getInstance(); ob_start(); foreach($directory->getFiles() as $file) { if(preg_match('#\\.php[0-9]*$#i', $file->getFilename())) { include ($file->getPath()); // echo 'loading config '.$file->getPath(); // check if config variable is set if(isset($$varname) && is_array($$varname)) { foreach($$varname as $key=>$value) $system->setConfig($key, $value); } } } ob_end_clean(); } public function doCleanup() { $system = System::getInstance(); $cfg = $system->getConfig('cron'); if(defined('_CRON_') && $cfg['mode'] == 'emulate') { ignore_user_abort(true); set_time_limit(0); $this->runCronJobs(); } else if(!defined('_CRON_') && $cfg['mode'] == 'emulate') { $time = time(); $lastrun = (int) $system->getSiteParam(0, 'cron', 'lastrun', -1); if($lastrun <= 0 || $time - $lastrun >= 58) { if(function_exists('apache_lookup_uri')) { apache_lookup_uri(_BASEURL_ . '/cron.' . _PHPEXT_); } elseif(extension_loaded('curl')) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://" . $_SERVER['HTTP_HOST'] . '/' . _BASEURL_ . '/cron.' . _PHPEXT_); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_NOBODY, true); defined('DEBUG') or ob_start(); curl_exec($ch); defined('DEBUG') or ob_end_clean(); curl_close($ch); } } } } public function doRunCLI() { // do noting by default } public function onException(\Exception $e) { System::getInstance()->onException($e); // throw to the base system } }