function CheckCacheFiles_Rec($strDir) { global $iGoodNum, $iOldNum, $iEmptyDirNum, $dLog; if ($handle = @opendir($strDir)) { while (($file = readdir($handle)) !== false) { if ($file == "." || $file == "..") continue; if (is_dir($strDir."/".$file)) { CheckCacheFiles_Rec($strDir."/".$file); } elseif (is_file($strDir."/".$file)) { $ext = ""; $ext_pos = bxstrrpos($file, "."); if ($ext_pos!==false) $ext = substr($file, $ext_pos + 1); $bCacheExp = False; if ($ext=="html") $bCacheExp = CPageCache::IsCacheExpired($strDir."/".$file); elseif ($ext=="php") $bCacheExp = CPHPCache::IsCacheExpired($strDir."/".$file); if ($bCacheExp) { $iOldNum++; @unlink($strDir."/".$file); } else { $iGoodNum++; } } } @closedir($handle); } clearstatcache(); $bEmptyFolder = True; if ($handle = @opendir($strDir)) { while (($file = readdir($handle)) !== false) { if ($file == "." || $file == "..") continue; $bEmptyFolder = False; break; } } if ($bEmptyFolder) { $iEmptyDirNum++; @rmdir($strDir); } }
function IsCacheExpired($path) { if (is_object($this) && is_object($this->_cache)) { return $this->_cache->IsCacheExpired($path); } else { $obCache = new CPHPCache(); return $obCache->IsCacheExpired($path); } }