POST TIME:2021-05-25 11:10
dedecms在后臺(tái),點(diǎn)擊更新系統(tǒng)緩存的時(shí)候,有些緩存文件夾沒有清理,導(dǎo)致垃圾文件越來(lái)越多,可以以百千計(jì)算,現(xiàn)在增加清理以下緩存文件夾的功能:
datacache
data plcache
datasessions
打開文件:dedesys_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" ); 如此便可更加有效的清理系統(tǒng)緩存,在加這個(gè)功能之前,大家有沒發(fā)現(xiàn):你在添加廣告的時(shí)候,用的是JS調(diào)用,但是你更改了廣告,更新了緩存,廣告依然沒變,需要“一鍵更新”-->“更新全部”才可以。加了這個(gè)功能之后,點(diǎn)擊“更新系統(tǒng)緩存”,然后在前臺(tái)刷新一下頁(yè)面就可以了! |