diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 5d1e1f28..daaf64e3 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -1419,7 +1419,7 @@ class Smarty // if a _cache_serial was set, we also have to write an include-file: if ($this->_cache_include_info) { require_once(SMARTY_CORE_DIR . 'core.write_compiled_include.php'); - smarty_core_write_compiled_include(array_merge($this->_cache_include_info, array('compiled_content'=>$_compiled_content)), $this); + smarty_core_write_compiled_include(array_merge($this->_cache_include_info, array('compiled_content'=>$_compiled_content, 'resource_name'=>$resource_name)), $this); } $_params = array('compile_path'=>$compile_path, 'compiled_content' => $_compiled_content); @@ -1476,7 +1476,9 @@ class Smarty $smarty_compiler->_config = $this->_config; $smarty_compiler->request_use_auto_globals = $this->request_use_auto_globals; - $smarty_compiler->_cache_serial = null; + if (isset($cache_include_path) && isset($this->_cache_serials[$cache_include_path])) { + $smarty_compiler->_cache_serial = $this->_cache_serials[$cache_include_path]; + } $smarty_compiler->_cache_include = $cache_include_path; diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index b84de272..17272052 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -2161,7 +2161,7 @@ class Smarty_Compiler extends Smarty { if ($_cacheable || 0<$this->_cacheable_state++) return ''; if (!isset($this->_cache_serial)) $this->_cache_serial = md5(uniqid('Smarty')); - $_ret = 'if ($this->caching) { echo \'{nocache:' + $_ret = 'if ($this->caching && !$this->_cache_including) { echo \'{nocache:' . $this->_cache_serial . '#' . $this->_nocache_count . '}\';}'; return $_ret; @@ -2178,7 +2178,7 @@ class Smarty_Compiler extends Smarty { $_cacheable = !isset($this->_plugins[$type][$name]) || $this->_plugins[$type][$name][4]; if ($_cacheable || --$this->_cacheable_state>0) return ''; - return 'if ($this->caching) { echo \'{/nocache:' + return 'if ($this->caching && !$this->_cache_including) { echo \'{/nocache:' . $this->_cache_serial . '#' . ($this->_nocache_count++) . '}\';}'; } diff --git a/libs/internals/core.write_compiled_include.php b/libs/internals/core.write_compiled_include.php index 21cac845..d17bee11 100644 --- a/libs/internals/core.write_compiled_include.php +++ b/libs/internals/core.write_compiled_include.php @@ -15,8 +15,8 @@ function smarty_core_write_compiled_include($params, &$smarty) { - $_tag_start = 'if \(\$this->caching\) \{ echo \'\{nocache\:('.$params['cache_serial'].')#(\d+)\}\';\}'; - $_tag_end = 'if \(\$this->caching\) \{ echo \'\{/nocache\:(\\2)#(\\3)\}\';\}'; + $_tag_start = 'if \(\$this->caching && \!\$this->_cache_including\) \{ echo \'\{nocache\:('.$params['cache_serial'].')#(\d+)\}\';\}'; + $_tag_end = 'if \(\$this->caching && \!\$this->_cache_including\) \{ echo \'\{/nocache\:(\\2)#(\\3)\}\';\}'; preg_match_all('!('.$_tag_start.'(.*)'.$_tag_end.')!Us', $params['compiled_content'], $_match_source, PREG_SET_ORDER); @@ -25,7 +25,8 @@ function smarty_core_write_compiled_include($params, &$smarty) if (count($_match_source)==0) return; // convert the matched php-code to functions - $_include_compiled = "_version.", created on ".strftime("%Y-%m-%d %H:%M:%S")."\n"; + $_include_compiled .= " compiled from " . strtr(urlencode($params['resource_name']), array('%2F'=>'/', '%3A'=>':')) . " */\n\n"; $_compile_path = $params['include_file_path'];