Skip to content

Commit

Permalink
Added improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuszkrzaczkowski committed Aug 25, 2022
1 parent 6fec968 commit ea0e85f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ public static function clearTemporaryFiles(string $days = '-30 day'): array
$exclusion = ['.htaccess', 'index.html'];
$s = $i = 0;
foreach (['pdf', 'import', 'mail', 'vtlib', 'rss_cache', 'upload', 'templates_c'] as $dir) {
if (!file_exists(ROOT_DIRECTORY . "/cache/{$dir}")) {
continue;
}
foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(ROOT_DIRECTORY . "/cache/{$dir}", \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
if ($item->isFile() && !\in_array($item->getBasename(), $exclusion) && $item->getMTime() < $time && $item->getATime() < $time) {
$s += $item->getSize();
Expand Down

0 comments on commit ea0e85f

Please sign in to comment.