From cacfd07dfaa404bee6e8674dafb918432a59ffbc Mon Sep 17 00:00:00 2001 From: bLeveque Date: Fri, 11 May 2012 01:21:09 +0000 Subject: [PATCH] [-] Core : Fixed bug #PSCFV-586 - index.php was deleted during the Smarty Cache deletion --- .../sysplugins/smarty_internal_cacheresource_file.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/smarty/sysplugins/smarty_internal_cacheresource_file.php b/tools/smarty/sysplugins/smarty_internal_cacheresource_file.php index 26a76a8a5..6e59bc105 100644 --- a/tools/smarty/sysplugins/smarty_internal_cacheresource_file.php +++ b/tools/smarty/sysplugins/smarty_internal_cacheresource_file.php @@ -176,10 +176,12 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource { $_cacheDirs = new RecursiveDirectoryIterator($_dir); $_cache = new RecursiveIteratorIterator($_cacheDirs, RecursiveIteratorIterator::CHILD_FIRST); foreach ($_cache as $_file) { - /* PrestaShop - if (substr($_file->getBasename(),0,1) == '.' || strpos($_file, '.svn') !== false) continue;*/ - if (substr($_file->getFilename(),0,1) == '.' || strpos($_file, '.svn') !== false) continue; - /* END */ + + /* PrestaShop - Do not delete index.php and .svn files */ + if (preg_match('/^(\.|\.\.|\.svn|index\.php)$/', $_file->getFilename())) + continue; + /* End */ + // directory ? if ($_file->isDir()) { if (!$_cache->isDot()) {