- bugfix uncompiled templates could not be cached after recent change

This commit is contained in:
uwetews
2015-08-23 05:35:13 +02:00
parent 3daf187fb1
commit c6ea69feb7

View File

@@ -205,9 +205,6 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
if (!$this->smarty->debugging && $this->smarty->debugging_ctrl == 'URL') { if (!$this->smarty->debugging && $this->smarty->debugging_ctrl == 'URL') {
$this->smarty->_debug->debugUrl($this); $this->smarty->_debug->debugUrl($this);
} }
if ($this->source->handler->uncompiled) {
$this->source->render($this);
} else {
// disable caching for evaluated code // disable caching for evaluated code
if ($this->source->handler->recompiled) { if ($this->source->handler->recompiled) {
$this->caching = false; $this->caching = false;
@@ -220,15 +217,18 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
$this->loadCached(); $this->loadCached();
} }
$this->cached->render($this, $no_output_filter); $this->cached->render($this, $no_output_filter);
} elseif ($this->source->handler->uncompiled) {
$this->source->render($this);
} else { } else {
if (!isset($this->compiled)) { if (!isset($this->compiled)) {
$this->loadCompiled(); $this->loadCompiled();
} }
$this->compiled->render($this); $this->compiled->render($this);
} }
}
$content = null; $content = null;
if ((!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled) && !$no_output_filter && if ((!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled) &&
!$no_output_filter &&
(isset($this->smarty->autoload_filters['output']) || isset($this->smarty->registered_filters['output'])) (isset($this->smarty->autoload_filters['output']) || isset($this->smarty->registered_filters['output']))
) { ) {
$content = Smarty_Internal_Filter_Handler::runFilter('output', ob_get_clean(), $this); $content = Smarty_Internal_Filter_Handler::runFilter('output', ob_get_clean(), $this);
@@ -433,7 +433,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
$tpl->config_vars = &$this->config_vars; $tpl->config_vars = &$this->config_vars;
} else { } else {
$tpl->tpl_vars = &$scope_ptr->tpl_vars; $tpl->tpl_vars = &$scope_ptr->tpl_vars;
$tpl->config_vars = &$scope_ptr->$this->config_vars; $tpl->config_vars = &$scope_ptr->config_vars;
} }
} }
if (!empty($data)) { if (!empty($data)) {
@@ -491,7 +491,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
*/ */
public function cacheTpl($cache_tpl_obj) public function cacheTpl($cache_tpl_obj)
{ {
if (!$this->source->handler->recompiled && (isset($this->smarty->_cache['template_objects'][$this->parent->templateId]) || if (!$this->source->handler->recompiled &&
(isset($this->smarty->_cache['template_objects'][$this->parent->templateId]) ||
($cache_tpl_obj && $this->smarty->resource_cache_mode & Smarty::RESOURCE_CACHE_AUTOMATIC) || ($cache_tpl_obj && $this->smarty->resource_cache_mode & Smarty::RESOURCE_CACHE_AUTOMATIC) ||
$this->smarty->resource_cache_mode & Smarty::RESOURCE_CACHE_ON) $this->smarty->resource_cache_mode & Smarty::RESOURCE_CACHE_ON)
) { ) {