示例#1
0
文件: Main.php 项目: q-phalcon/kernel
 /**
  * 定时任务刷新入口
  */
 public function task_refresh()
 {
     $QpException = new Exception();
     try {
         // 1.加载配置文件 - /config目录下的php文件
         Config\BaseConfig::init(['app', 'database', 'session']);
         Config\BaseConfig::initEnv();
         // 2.设置默认时区 - 从配置中读取
         date_default_timezone_set(Config::getEnv("app.timezone"));
         // 3.定义日志目录路径 - 从配置中读取
         $this->setLogPath();
         // 4.注册命名空间
         $this->setNamespace();
         // 5.定义Phalcon的DI
         $di = new \Phalcon\DI\FactoryDefault();
         // 6.预加载数据库链接
         $this->handleDBConnection($di);
         // 7.设置Redis数据库连接
         $this->handleRedis($di);
         // 8.处理刷新任务
         $this->handleTaskRefresh($di);
     } catch (\Exception $ex) {
         Log\SystemLog::error_log($ex);
         $QpException->fatalHandler($ex);
     } catch (\Throwable $ex) {
         Log\SystemLog::error_log($ex);
         $QpException->fatalHandler($ex);
     }
 }