
增強織夢模板“更新系統緩存”清理沉余緩存的功能
我們使用DedeCMS系統有很長一段時間后,不間斷的在后臺更新系統緩存的時候,有些緩存文件夾及緩存文件沒有被清理,導致日積月累的垃圾緩存文件越來越多,可以以百千萬計算,現在增強更新系統緩存功能清理沉余的緩存文件及文件夾。

主要增加清理以下緩存文件夾的功能:
datacache
data plcache
datasessions
實現方法:
打開/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)
在它上面加入
//清理datacacheclean_cachefiles( "../data/cache" );//清理datatplcacheclean_cachefiles( "../data/tplcache" );//清理datasessionsclean_cachefiles( "../data/sessions" );


