From 48d8b66ae196bced46f830dbde2aa597b2ffaf26 Mon Sep 17 00:00:00 2001 From: messju Date: Thu, 17 Jul 2003 19:25:22 +0000 Subject: [PATCH] improved checking of compiled_include against cached-template with non-cached-chunks --- libs/core/core.process_compiled_include.php | 1 - libs/core/core.read_cache_file.php | 13 ++++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/libs/core/core.process_compiled_include.php b/libs/core/core.process_compiled_include.php index 1482dc35..486636f4 100644 --- a/libs/core/core.process_compiled_include.php +++ b/libs/core/core.process_compiled_include.php @@ -18,7 +18,6 @@ function smarty_core_process_compiled_include($params, &$smarty) { $_return = $params['results']; foreach ($smarty->_cache_serials as $_include_file_path=>$_cache_serial) { - $smarty->smarty_include($_include_file_path, true); $_return = preg_replace_callback('!(\{nocache\:('.$_cache_serial.')#(\d+)\})!s', array(&$smarty, '_process_compiled_include_callback'), $_return); diff --git a/libs/core/core.read_cache_file.php b/libs/core/core.read_cache_file.php index 0f2e46ac..4f0acace 100644 --- a/libs/core/core.read_cache_file.php +++ b/libs/core/core.read_cache_file.php @@ -91,9 +91,16 @@ function smarty_core_read_cache_file(&$params, &$smarty) } } - $smarty->_cache_serials = array_merge($smarty->_cache_serials, - $smarty->_cache_info['cache_serials']); - + foreach ($smarty->_cache_info['cache_serials'] as $_include_file_path=>$_cache_serial) { + if (empty($smarty->_cache_serials[$_include_file_path])) { + $smarty->smarty_include($_include_file_path, true); + } + + if ($smarty->_cache_serials[$_include_file_path] != $_cache_serial) { + /* regenerate */ + return false; + } + } $params['results'] = $cache_split[1]; $content_cache[$params['tpl_file'].','.$params['cache_id'].','.$params['compile_id']] = array($params['results'], $smarty->_cache_info);