From 8f0a0b6c2030cfc84537af7ba9ba0e79195a4d75 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Wed, 24 Jan 2024 19:06:56 +0530 Subject: [PATCH] fix smarty chache and compile index file deletion on cache clear and revert changes done in smrty library --- classes/Tools.php | 2 ++ .../smarty_internal_method_clearcompiledtemplate.php | 5 ----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/classes/Tools.php b/classes/Tools.php index 58ab06580..fb0fe493a 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -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) diff --git a/tools/smarty/sysplugins/smarty_internal_method_clearcompiledtemplate.php b/tools/smarty/sysplugins/smarty_internal_method_clearcompiledtemplate.php index d1b21ee68..bf4929807 100644 --- a/tools/smarty/sysplugins/smarty_internal_method_clearcompiledtemplate.php +++ b/tools/smarty/sysplugins/smarty_internal_method_clearcompiledtemplate.php @@ -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')