Skip to content

Commit

Permalink
Merge pull request #903 from shreesh-webkul/gli-912
Browse files Browse the repository at this point in the history
Fix: Smarty index.php in smarty cache and compile directory gets deleted when clearing cache
  • Loading branch information
rohit053 authored Mar 15, 2024
2 parents a8079d5 + 8f0a0b6 commit 52cf39a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 2 additions & 0 deletions classes/Tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -3023,6 +3023,8 @@ public static function clearSmartyCache()
$smarty = Context::getContext()->smarty;
Tools::clearCache($smarty);
Tools::clearCompile($smarty);
@copy(_PS_CACHE_DIR_.'smarty/index.php', _PS_CACHE_DIR_.'smarty/cache/index.php');
@copy(_PS_CACHE_DIR_.'smarty/index.php', _PS_CACHE_DIR_.'smarty/compile/index.php');
}

public static function clearColorListCache($id_product = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,6 @@ public function clearCompiledTemplate(Smarty $smarty, $resource_name = null, $co
$unlink = true;
}
}

if (substr($_filepath, -9) == 'index.php') {
$unlink = false;
}

if ($unlink && is_file($_filepath) && @unlink($_filepath)) {
$_count++;
if (function_exists('opcache_invalidate')
Expand Down

0 comments on commit 52cf39a

Please sign in to comment.