- bugfix clearCompiledTemplate() did not delete files on WINDOWS when a compile_id was specified

This commit is contained in:
Uwe.Tews@googlemail.com
2014-04-19 13:53:20 +00:00
parent 8658b04c86
commit c7071d9d2c
2 changed files with 5 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
===== 3.1.19-dev ===== (xx.xx.2014) ===== 3.1.19-dev ===== (xx.xx.2014)
19.04.2014 19.04.2014
- bugfix calling createTemplate(template, data) with empty data array caused notice of array to string conversion (Issue 189) - bugfix calling createTemplate(template, data) with empty data array caused notice of array to string conversion (Issue 189)
- bugfix clearCompiledTemplate() did not delete files on WINDOWS when a compile_id was specified
18.04.2014 18.04.2014
- revert bugfix of 5.4.2015 because %-e date format is not supported on all operating systems - revert bugfix of 5.4.2015 because %-e date format is not supported on all operating systems

View File

@@ -184,7 +184,7 @@ class Smarty_Internal_Utility
{ {
$_compile_dir = realpath($smarty->getCompileDir()).'/'; $_compile_dir = realpath($smarty->getCompileDir()).'/';
$_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null; $_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null;
$_dir_sep = $smarty->use_sub_dirs ? DS : '^'; $_dir_sep = $smarty->use_sub_dirs ? '/' : '^';
if (isset($resource_name)) { if (isset($resource_name)) {
$_save_stat = $smarty->caching; $_save_stat = $smarty->caching;
$smarty->caching = false; $smarty->caching = false;
@@ -218,7 +218,7 @@ class Smarty_Internal_Utility
$_dir .= $_compile_id . $_dir_sep; $_dir .= $_compile_id . $_dir_sep;
} }
if (isset($_compile_id)) { if (isset($_compile_id)) {
$_compile_id_part = $_compile_dir . $_compile_id . $_dir_sep; $_compile_id_part = str_replace('\\','/',$_compile_dir . $_compile_id . $_dir_sep);
$_compile_id_part_length = strlen($_compile_id_part); $_compile_id_part_length = strlen($_compile_id_part);
} }
$_count = 0; $_count = 0;
@@ -233,7 +233,7 @@ class Smarty_Internal_Utility
if (substr(basename($_file->getPathname()), 0, 1) == '.' || strpos($_file, '.svn') !== false) if (substr(basename($_file->getPathname()), 0, 1) == '.' || strpos($_file, '.svn') !== false)
continue; continue;
$_filepath = (string) $_file; $_filepath = str_replace('\\','/',(string) $_file);
if ($_file->isDir()) { if ($_file->isDir()) {
if (!$_compile->isDot()) { if (!$_compile->isDot()) {
@@ -242,7 +242,7 @@ class Smarty_Internal_Utility
} }
} else { } else {
$unlink = false; $unlink = false;
if ((!isset($_compile_id) || (isset($_filepath[$_compile_id_part_length]) && !strncmp($_filepath, $_compile_id_part, $_compile_id_part_length))) if ((!isset($_compile_id) || (isset($_filepath[$_compile_id_part_length]) && $a = !strncmp($_filepath, $_compile_id_part, $_compile_id_part_length)))
&& (!isset($resource_name) && (!isset($resource_name)
|| (isset($_filepath[$_resource_part_1_length]) || (isset($_filepath[$_resource_part_1_length])
&& substr_compare($_filepath, $_resource_part_1, -$_resource_part_1_length, $_resource_part_1_length) == 0) && substr_compare($_filepath, $_resource_part_1, -$_resource_part_1_length, $_resource_part_1_length) == 0)