Skip to content

Commit

Permalink
Merge pull request #7388 from aleeks/clear_cache
Browse files Browse the repository at this point in the history
Fix clear media cache
  • Loading branch information
antoin-m committed Jan 25, 2017
2 parents 1caa3e8 + 68e1add commit 9bd7899
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions classes/Media.php
Expand Up @@ -670,11 +670,14 @@ public static function cccJS($jsFiles)
*/
public static function clearCache()
{
foreach (array(_PS_THEME_DIR_.'cache') as $dir) {
if (file_exists($dir)) {
foreach (array_diff(scandir($dir), array('..', '.', 'index.php')) as $file) {
Tools::deleteFile($dir.DIRECTORY_SEPARATOR.$file);
}
$files = array_merge(
glob(_PS_THEME_DIR_.'assets/cache/*'),
glob(_PS_THEME_DIR_.'cache/*')
);

foreach ($files as $file) {
if ('index.php' !== basename($file)) {
Tools::deleteFile($file);
}
}

Expand Down

0 comments on commit 9bd7899

Please sign in to comment.