diff --git a/change_log.txt b/change_log.txt index 159caf02..93a5fa46 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,7 @@ ===== SVN trunk ===== +18/02/2011 +- bugfix removed possible race condition when isCached() was called for an individually cached subtemplate + 17/02/2011 -improvement not to delete files starting with '.' from cache and template_c folders on clearCompiledTemplate() and clearCache() diff --git a/libs/sysplugins/smarty_internal_compile_include.php b/libs/sysplugins/smarty_internal_compile_include.php index 01d260eb..ff6430c3 100644 --- a/libs/sysplugins/smarty_internal_compile_include.php +++ b/libs/sysplugins/smarty_internal_compile_include.php @@ -136,7 +136,17 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase { $_caching = Smarty::CACHING_OFF; } // create template object - $_output = "smarty->template_class}($include_file, \$_smarty_tpl->smarty, \$_smarty_tpl, $_cache_id, $_compile_id, $_caching, $_cache_lifetime);\n"; + $_output = "smarty->template_objects[\$sha])) {\n"; + $_output .= "\$_template = \$_smarty_tpl->smarty->template_objects[\$sha]; \$_template->caching = $_caching; \$_template->cache_lifetime = $_cache_lifetime;\n"; + $_output .= "} else {\n"; + } + $_output .= "\$_template = new {$compiler->smarty->template_class}($include_file, \$_smarty_tpl->smarty, \$_smarty_tpl, $_cache_id, $_compile_id, $_caching, $_cache_lifetime);\n"; + if ($_caching != 'null' && $_caching != Smarty::CACHING_OFF) { + $_output .= "}\n"; + } // delete {include} standard attributes unset($_attr['file'], $_attr['assign'], $_attr['cache_id'], $_attr['compile_id'], $_attr['cache_lifetime'], $_attr['nocache'], $_attr['caching'], $_attr['scope'], $_attr['inline']); // remaining attributes must be assigned as smarty variable