<?php

class clearMod extends commonMod
{

    //参数读取和设置
    public function setting($name = '', $value = null)
    {
        return $this->modulesetting(dirname(__file__),$name,$value);
    }
    // 缓存首页
    public function index()
    {        
        $cache=module('plus')->dirsize(__ROOTDIR__ . "/data/");
        $db_cache=module('plus')->dirsize(__ROOTDIR__ . "/data/db_cache");
        $html_cache=module('plus')->dirsize(__ROOTDIR__ . "/data/html_cache/");
        $tpl_cache=module('plus')->dirsize(__ROOTDIR__ . "/data/tpl_cache/");

        $this->assign('cache', $cache);
        $this->assign('db_cache', $db_cache);
        $this->assign('html_cache', $html_cache);
        $this->assign('tpl_cache', $tpl_cache);
        $this->display();
    }

    public function clearcache()
    {
        
        $dir = __ROOTDIR__ . "/data/db_cache/"; //清除数据库缓存
        del_dir($dir);
        $dir2 = __ROOTDIR__ . "/data/html_cache/"; //清除html缓存
        del_dir($dir2);
        $dir3 = __ROOTDIR__ . "/data/tpl_cache/"; //清除模板缓存
        del_dir($dir3);       

		$this->success('网站缓存清除成功！',__URL__);
    }

    public function cleartpl()
    {
        
        $dir = __ROOTDIR__ . "/data/tpl_cache/"; //清除模板缓存
        del_dir($dir);
		$this->success('模板缓存清除成功！',__URL__);
    }

    public function clearhtml()
    {
        
        $dir = __ROOTDIR__ . "/data/html_cache/"; //清除html缓存
        del_dir($dir);
        $this->success('HTML缓存清除成功！',__URL__);
    }

    public function cleardb()
    {
        
        $dir = __ROOTDIR__ . "/data/db_cache/"; //清除数据库缓存
        del_dir($dir);
       $this->success('数据库缓存清除成功！',__URL__);
    }

}

?>