<?php
/*
 *   www.weidogs.cn 清理缓存
 * */
$fileArr=array(DOXCX_FRAME_PATH.'/sys/compilations',DOXCX_FRAME_PATH.'/sys/cache',DOXCX_FRAME_PATH.'/log/aes',
			   DOXCX_FRAME_PATH.'/log/db',DOXCX_FRAME_PATH.'/log/debug',DOXCX_FRAME_PATH.'/log/error',
			   DOXCX_FRAME_PATH.'/log/info',DOXCX_FRAME_PATH.'/log/warn',DOXCX_FRAME_PATH.'/log/wshell'
			   );			   
foreach($fileArr as $path){
	deleteFile($path);
}
Response::write('ok');

//定义删除文件函数
function deleteFile($dirName) {
    // 判断是否为有效句柄
    if ($handle = opendir( $dirName )) {
        // 循环打开的句柄条目（打开成功，则返回文件名；打开失败，则返回false）
        while ( false !== ($item = readdir ($handle))) {
            if ($item != "." && $item != "..") {
                // 判断是否为目录
                if (is_dir($dirName . "/" . $item )) {
                    // 递归删除
                    deleteFile($dirName . "/" . $item);
					//目录清空后删除空文件夹
					@rmdir($dirName . "/" . $item);
                } else {
					unlink($dirName . "/" . $item);
                }
            }
        }
        // 关闭打开的句柄
        closedir( $handle );
    }
}