File size: 1.18Kb
<?php
# Очиска кэша
# author Drk
class cache_clear {
public static function all() # удаление всего кэша
{
global $config;
$files = cache."_config/files.data";
if(@filemtime($files) < time() - $config['cache_time_clear']):
if (file_exists(cache.'_cookies/')): # cookies
foreach (glob(cache.'_cookies/*') as $file):
@unlink($file);
endforeach;
endif;
if (file_exists(cache.'_mod/')): # mod
foreach (glob(cache.'_mod/*') as $file):
@unlink($file);
endforeach;
endif;
if (file_exists(cache.'_search/')): # search
foreach (glob(cache.'_search/*') as $file):
@unlink($file);
endforeach;
endif;
if (file_exists(cache.'_tag/')): # tag
foreach (glob(cache.'_tag/*') as $file):
@unlink($file);
endforeach;
endif;
if (file_exists(cache.'_user/')): # user
foreach (glob(cache.'_user/*') as $file):
@unlink($file);
endforeach;
endif;
if (file_exists(cache.'_watch/')): # watch
foreach (glob(cache.'_watch/*') as $file):
@unlink($file);
endforeach;
endif;
@unlink(cache."_config/files.data");
$cache = '# author Drk';
@file_put_contents($files, $cache);
endif;
}
}
?>