diff --git a/NEW_FEATURES.txt b/NEW_FEATURES.txt index 1a51c71d..36741c14 100644 --- a/NEW_FEATURES.txt +++ b/NEW_FEATURES.txt @@ -2,6 +2,12 @@ This file contains a brief description of new features which have been added to Smarty 3.1 +Smarty 3.1.30 + + Caching + ======= + Caching does now observe the template_dir setting and will create separate cache files if required + Smarty 3.1.28 OPCACHE diff --git a/change_log.txt b/change_log.txt index 327555b1..bf78d77d 100644 --- a/change_log.txt +++ b/change_log.txt @@ -2,7 +2,8 @@ 23.12.2015 - optimization move internal method decodeProperties back into template object - optimization move subtemplate processing back into template object - + - new feature Caching does now observe the template_dir setting and will create separate cache files if required + 22.12.2015 - change $xxx_dir properties from private to protected in case Smarty class gets extended - code optimizations diff --git a/libs/sysplugins/smarty_cacheresource_custom.php b/libs/sysplugins/smarty_cacheresource_custom.php index 4e9606ef..493570c6 100644 --- a/libs/sysplugins/smarty_cacheresource_custom.php +++ b/libs/sysplugins/smarty_cacheresource_custom.php @@ -84,7 +84,7 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource { $_cache_id = isset($cached->cache_id) ? preg_replace('![^\w\|]+!', '_', $cached->cache_id) : null; $_compile_id = isset($cached->compile_id) ? preg_replace('![^\w]+!', '_', $cached->compile_id) : null; - $path = $cached->source->filepath . $_cache_id . $_compile_id; + $path = $cached->source->filepath . $_template->smarty->_joined_template_dir. $_cache_id . $_compile_id; $cached->filepath = sha1($path); if ($_template->smarty->cache_locking) { $cached->lock_id = sha1('lock.' . $path); diff --git a/libs/sysplugins/smarty_cacheresource_keyvaluestore.php b/libs/sysplugins/smarty_cacheresource_keyvaluestore.php index ee4021a1..1f73a2ef 100644 --- a/libs/sysplugins/smarty_cacheresource_keyvaluestore.php +++ b/libs/sysplugins/smarty_cacheresource_keyvaluestore.php @@ -54,7 +54,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource */ public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template) { - $cached->filepath = $_template->source->uid . '#' . $this->sanitize($cached->source->resource) . '#' . + $cached->filepath = sha1($_template->source->uid . $_template->smarty->_joined_template_dir) . '#' . $this->sanitize($cached->source->resource) . '#' . $this->sanitize($cached->cache_id) . '#' . $this->sanitize($cached->compile_id); $this->populateTimestamp($cached); diff --git a/libs/sysplugins/smarty_internal_cacheresource_file.php b/libs/sysplugins/smarty_internal_cacheresource_file.php index 64d02dfe..24dab890 100644 --- a/libs/sysplugins/smarty_internal_cacheresource_file.php +++ b/libs/sysplugins/smarty_internal_cacheresource_file.php @@ -30,7 +30,7 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource $_source_file_path = str_replace(':', '.', $_template->source->filepath); $_cache_id = isset($_template->cache_id) ? preg_replace('![^\w\|]+!', '_', $_template->cache_id) : null; $_compile_id = isset($_template->compile_id) ? preg_replace('![^\w]+!', '_', $_template->compile_id) : null; - $_filepath = $_template->source->uid; + $_filepath = sha1($_template->source->uid . $_template->smarty->_joined_template_dir); // if use_sub_dirs, break file into directories if ($_template->smarty->use_sub_dirs) { $_filepath = substr($_filepath, 0, 2) . DS . substr($_filepath, 2, 2) . DS . substr($_filepath, 4, 2) . DS .