1
增強織夢模板“更新系統(tǒng)緩存”清理沉余緩存的功能
我們使用DedeCMS系統(tǒng)有很長一段時間后,不間斷的在后臺更新系統(tǒng)緩存的時候,有些緩存文件夾及緩存文件沒有被清理,導致日積月累的垃圾緩存文件越來越多,可以以百千萬計算,現(xiàn)在增強更新系統(tǒng)緩存功能清理沉余的緩存文件及文件夾。
2
主要增加清理以下緩存文件夾的功能:
datacache
data plcache
datasessions
實現(xiàn)方法:
打開/dede/sys_cache_up.php文件
找到
CheckPurview('sys_ArcBatch');
在它下面加入
//清理緩存增加版
function clean_cachefiles( $path ){
        $list = array();
        foreach( glob( $path . '/*') as $item ){
                if( is_dir( $item ) ){
                        $list = array_merge( $list , clean_cachefiles( $item ) );
                }else{
                        $list[] = $item;
                }
        }
        foreach( $list as $tmpfile ){
                @unlink( $tmpfile );
        }
        return true;
}
再找到
if($uparc==1)
在它上面加入
//清理datacache
clean_cachefiles( "../data/cache" );
//清理datatplcache
clean_cachefiles( "../data/tplcache" );
//清理datasessions
clean_cachefiles( "../data/sessions" );