Example #1
0
 public function quit($checkResult = false)
 {
     $this->Log->debug(__METHOD__, sprintf('system running use time %fs,RAM %s', Common::click(), Common::convertUnit(Common::RAMClick())));
     $resultMsg = $this->resultMsg;
     if (self::$init !== null && self::$quit === null) {
         self::$quit = true;
         spl_autoload_unregister(array($this, 'autoLoad'));
         // 开启debug时将系统debug信息写入log
         if (Common::getConfig('debug_level', $this->config)) {
             $this->Log->writeLog();
         }
         // 清理Model所占资源
         if (is_object($this->Model)) {
             $this->Model->quit();
         }
         // 注销register_shutdown_function,避免影响其他程序
         $this->registerShutdown->unRegister();
     }
 }
Example #2
0
 private function checkWhiteFlag()
 {
     $time = Common::session(self::SESSION_WHITE_FLAG);
     // 白名单未设置则直接返回
     if (!$time) {
         return false;
     }
     //获取白名单有效时间
     $lifetime = Common::getConfig('white_list_timeout', $this->config);
     // 超过设定的白名单有效时候失效
     if (time() - $time > $lifetime) {
         // 超时后删除白名单标识
         $this->delWhiteFlag();
         return false;
     } else {
         return true;
     }
 }