Skip to content

Commit

Permalink
Minor change to clear_cache upgrade script to check for folder existe…
Browse files Browse the repository at this point in the history
…nce before clearing
  • Loading branch information
dleffler committed Jul 11, 2011
1 parent 8a641ac commit 9d59a62
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions install/upgrades/clear_cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,19 @@ function upgrade() {
BASE.'tmp/rsscache', // magpierss cache
BASE.'tmp/views_c', // smarty cache
BASE.'tmp/cache', // alternate smarty cache
BASE.'tmp/img_cache', // phpThumb cache includes subfolders
);

// delete the files.
$removed = 0;
$errors = 0;
foreach ($files as $file) {
$files = exponent_files_remove_files_in_directory($file);
$removed += count($files['removed']);
$errors += count($files['not_removed']);
if (file_exists($file)) {
$files = exponent_files_remove_files_in_directory($file);
$removed += count($files['removed']);
$errors += count($files['not_removed']);
}
}

// phpThumb cache includes subfolders
// if (file_exists(BASE.'tmp/img_cache')) $this->cleardir_recursive(BASE.'tmp/img_cache');
if (file_exists(BASE.'tmp/img_cache')) exponent_files_remove_files_in_directory(BASE.'tmp/img_cache');

return "All Caches were cleared.<br>".$errors." files could not be removed.";
}

Expand Down

0 comments on commit 9d59a62

Please sign in to comment.