From 8defafbb144ff32355814286c54001198ea213d8 Mon Sep 17 00:00:00 2001 From: "Uwe.Tews" Date: Mon, 25 Jan 2010 18:10:35 +0000 Subject: [PATCH] - bugfix cache resource was not loaded when caching was globally off but enabled at a template object --- change_log.txt | 3 +++ libs/sysplugins/smarty_internal_template.php | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/change_log.txt b/change_log.txt index 2301925a..bd328dbd 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,3 +1,6 @@ +01/25/2010 +- bugfix cache resource was not loaded when caching was globally off but enabled at a template object + 01/22/2010 - new method $smarty->createData([$parent]) for creating a data object (required for bugfixes below) - bugfix config_load() method now works also on a data object diff --git a/libs/sysplugins/smarty_internal_template.php b/libs/sysplugins/smarty_internal_template.php index fab9d084..e6c5ac55 100644 --- a/libs/sysplugins/smarty_internal_template.php +++ b/libs/sysplugins/smarty_internal_template.php @@ -32,7 +32,7 @@ class Smarty_Internal_Template extends Smarty_Internal_Data { public $resource_name = null; public $resource_object = null; private $isExisting = null; - public $templateUid = ''; + public $templateUid = ''; // Template source public $template_filepath = null; public $template_source = null; @@ -260,7 +260,7 @@ class Smarty_Internal_Template extends Smarty_Internal_Data { // compiling succeded if (!$this->resource_object->isEvaluated) { // write compiled template - Smarty_Internal_Write_File::writeFile($this->getCompiledFilepath(), $this->compiled_template, $this->smarty); + Smarty_Internal_Write_File::writeFile($this->getCompiledFilepath(), $this->compiled_template, $this->smarty); } } else { // error compiling template @@ -337,6 +337,9 @@ class Smarty_Internal_Template extends Smarty_Internal_Data { if ($this->isCached === null) { $this->isCached = false; if (($this->caching == SMARTY_CACHING_LIFETIME_CURRENT || $this->caching == SMARTY_CACHING_LIFETIME_SAVED) && !$this->resource_object->isEvaluated && !$this->force_compile && !$this->force_cache) { + if (!isset($this->cache_resource_object)) { + $this->cache_resource_object = $this->smarty->loadCacheResource(); + } $cachedTimestamp = $this->getCachedTimestamp(); if ($cachedTimestamp === false) { return $this->isCached; @@ -481,7 +484,7 @@ class Smarty_Internal_Template extends Smarty_Internal_Data { eval("?>" . $output); $this->rendered_content = ob_get_clean(); // write cache file content - $this->writeCachedContent($output); + $this->writeCachedContent($output); if ($this->smarty->debugging) { Smarty_Internal_Debug::end_cache($this); }