- bugfix make sure that the cache resource is loaded in all conditions when template methods getCached... are called externally

This commit is contained in:
Uwe.Tews
2010-05-11 16:24:24 +00:00
parent 2d1ce2f940
commit 6e97a8a393
2 changed files with 13 additions and 1 deletions

View File

@@ -1,3 +1,6 @@
11/05/2010
- bugfix make sure that the cache resource is loaded in all conditions when template methods getCached... are called externally
10/05/2010
- bugfix on {foreach} and {for} optimizations of 27/04/2010

View File

@@ -271,7 +271,7 @@ class Smarty_Internal_Template extends Smarty_Internal_Data {
touch($this->getCompiledFilepath(), $saved_timestamp);
}
throw $e;
}
}
// compiling succeded
if (!$this->resource_object->isEvaluated) {
// write compiled template
@@ -291,6 +291,9 @@ class Smarty_Internal_Template extends Smarty_Internal_Data {
*/
public function getCachedFilepath ()
{
if (!isset($this->cache_resource_object)) {
$this->cache_resource_object = $this->smarty->cache->loadResource();
}
return $this->cached_filepath === null ?
$this->cached_filepath = ($this->resource_object->isEvaluated || !($this->caching == SMARTY_CACHING_LIFETIME_CURRENT || $this->caching == SMARTY_CACHING_LIFETIME_SAVED)) ? false : $this->cache_resource_object->getCachedFilepath($this) :
$this->cached_filepath;
@@ -305,6 +308,9 @@ class Smarty_Internal_Template extends Smarty_Internal_Data {
*/
public function getCachedTimestamp ()
{
if (!isset($this->cache_resource_object)) {
$this->cache_resource_object = $this->smarty->cache->loadResource();
}
return $this->cached_timestamp === null ?
$this->cached_timestamp = ($this->resource_object->isEvaluated || !($this->caching == SMARTY_CACHING_LIFETIME_CURRENT || $this->caching == SMARTY_CACHING_LIFETIME_SAVED)) ? false : $this->cache_resource_object->getCachedTimestamp($this) :
$this->cached_timestamp;
@@ -317,6 +323,9 @@ class Smarty_Internal_Template extends Smarty_Internal_Data {
*/
public function getCachedContent ()
{
if (!isset($this->cache_resource_object)) {
$this->cache_resource_object = $this->smarty->cache->loadResource();
}
return $this->rendered_content === null ?
$this->rendered_content = ($this->resource_object->isEvaluated || !($this->caching == SMARTY_CACHING_LIFETIME_CURRENT || $this->caching == SMARTY_CACHING_LIFETIME_SAVED)) ? false : $this->cache_resource_object->getCachedContents($this) :
$this->rendered_content;