- bugfix removed possible race condition when isCached() was called for an individually cached subtemplate

This commit is contained in:
uwe.tews@googlemail.com
2011-02-18 17:33:38 +00:00
parent 0e863c651d
commit 5b8a7e2ad9
2 changed files with 14 additions and 1 deletions

View File

@@ -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()

View File

@@ -136,7 +136,17 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
$_caching = Smarty::CACHING_OFF;
}
// create template object
$_output = "<?php \$_template = new {$compiler->smarty->template_class}($include_file, \$_smarty_tpl->smarty, \$_smarty_tpl, $_cache_id, $_compile_id, $_caching, $_cache_lifetime);\n";
$_output = "<?php ";
if ($_caching != 'null' && $_caching != Smarty::CACHING_OFF) {
$_output .= "\$sha = sha1($include_file . $_cache_id . $_compile_id);\n";
$_output .= "if (isset(\$_smarty_tpl->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