cache: check if cache folder exists

This commit is contained in:
Mitsukarenai 2015-12-03 22:09:18 +01:00
parent 40fdb17280
commit c13c7a1d25

View file

@ -26,6 +26,7 @@ ini_set('user_agent', 'Mozilla/5.0 (X11; Linux x86_64; rv:30.0) Gecko/20121202 F
// cache file purge - delete cache files older than 24 hours // cache file purge - delete cache files older than 24 hours
$cacheTimeLimit = time() - 60*60*24 ; $cacheTimeLimit = time() - 60*60*24 ;
$cachePath = 'cache'; $cachePath = 'cache';
if(file_exists($cachePath)) {
$cacheIterator = new RecursiveIteratorIterator( $cacheIterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($cachePath), new RecursiveDirectoryIterator($cachePath),
RecursiveIteratorIterator::CHILD_FIRST RecursiveIteratorIterator::CHILD_FIRST
@ -38,6 +39,7 @@ foreach ($cacheIterator as $cacheFile) {
unlink( $cacheFile->getPathname() ); unlink( $cacheFile->getPathname() );
} }
} }
}
// default whitelist // default whitelist
$whitelist_file = './whitelist.txt'; $whitelist_file = './whitelist.txt';