コード例 #1
0
 public function clearCache()
 {
     header("Content-Type:text/html; charset=utf-8");
     $action = strtolower($_REQUEST['Action']);
     cookie("MenuTopID", NULL);
     switch ($action) {
         case "systemcache":
             YdCache::writeall();
             $this->ajaxReturn(NULL, "清除系统缓存成功!", 1);
             break;
         case "modelcache":
             YdCache::deletetemp();
             $this->ajaxReturn(NULL, "清除频道模型缓存成功!", 1);
             break;
         case "homecache":
             YdCache::deletehome();
             $this->ajaxReturn(NULL, "清除模板缓存成功!", 1);
             break;
         case "wapcache":
             YdCache::deletewap();
             $this->ajaxReturn(NULL, "清除模板缓存成功!", 1);
             break;
         case "indexhtmlcache":
             YdCache::deletehtml("index");
             $this->ajaxReturn(NULL, "清除首页Html缓存成功!", 1);
             break;
         case "channelhtmlcache":
             YdCache::deletehtml("channel");
             $this->ajaxReturn(NULL, "清除频道首页Html缓存成功!", 1);
             break;
         case "infohtmlcache":
             YdCache::deletehtml("info");
             $this->ajaxReturn(NULL, "清除内容页面Html缓存成功!", 1);
             break;
         case "allhtmlcache":
             YdCache::deletehtml("all");
             $this->ajaxReturn(NULL, "清除全部Html缓存成功!", 1);
             break;
         case "saveconfig":
             if (isset($_POST)) {
                 break;
             }
             if (is_numeric($_POST['INDEX_CACHE_TIME'])) {
                 if (is_numeric($_POST['CHANNEL_CACHE_TIME'])) {
                 }
             }
             if (!is_numeric($_POST['INFO_CACHE_TIME'])) {
                 $this->ajaxReturn(NULL, "缓存时间必须为数字!", 0);
             }
             unset($_POST['__hash__']);
             $m = d("Admin/Config");
             if ($m->saveConfig($_POST, "html")) {
                 $this->ajaxReturn(NULL, "保存配置成功!", 1);
             } else {
                 $this->ajaxReturn(NULL, "保存配置失败!", 0);
             }
     }
     $m = d("Admin/Config");
     $data = $m->getConfig("html");
     $this->assign("HtmlEnable", $data['HTML_ENABLE']);
     $this->assign("IndexCacheTime", $data['INDEX_CACHE_TIME']);
     $this->assign("ChannelCacheTime", $data['CHANNEL_CACHE_TIME']);
     $this->assign("InfoCacheTime", $data['INFO_CACHE_TIME']);
     $this->assign("Action", __URL__ . "/clearCache");
     $this->display();
 }