diff options
author | emkael <emkael@tlen.pl> | 2018-10-18 02:40:38 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2018-10-18 02:40:38 +0200 |
commit | eab8a101e7a3fcbb41e01a574985e06c5a3775de (patch) | |
tree | 60f201da5984b0c3638d10da02bba42b61aa3177 /lib/smarty3/sysplugins/smarty_template_cached.php | |
parent | 7f38be342c1495aeca418286c15c25c18ac9e142 (diff) |
Updating Smarty
Diffstat (limited to 'lib/smarty3/sysplugins/smarty_template_cached.php')
-rw-r--r-- | lib/smarty3/sysplugins/smarty_template_cached.php | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/smarty3/sysplugins/smarty_template_cached.php b/lib/smarty3/sysplugins/smarty_template_cached.php index 58f0daf..508d27f 100644 --- a/lib/smarty3/sysplugins/smarty_template_cached.php +++ b/lib/smarty3/sysplugins/smarty_template_cached.php @@ -83,6 +83,8 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base * create Cached Object container * * @param Smarty_Internal_Template $_template template object + * + * @throws \SmartyException */ public function __construct(Smarty_Internal_Template $_template) { @@ -90,7 +92,7 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base $this->cache_id = $_template->cache_id; $this->source = $_template->source; if (!class_exists('Smarty_CacheResource', false)) { - require SMARTY_SYSPLUGINS_DIR . 'smarty_cacheresource.php'; + include SMARTY_SYSPLUGINS_DIR . 'smarty_cacheresource.php'; } $this->handler = Smarty_CacheResource::load($_template->smarty); } @@ -100,13 +102,12 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base * * @return Smarty_Template_Cached */ - static function load(Smarty_Internal_Template $_template) + public static function load(Smarty_Internal_Template $_template) { $_template->cached = new Smarty_Template_Cached($_template); $_template->cached->handler->populate($_template->cached, $_template); // caching enabled ? - if (!($_template->caching == Smarty::CACHING_LIFETIME_CURRENT || - $_template->caching == Smarty::CACHING_LIFETIME_SAVED) || $_template->source->handler->recompiled + if (!$_template->caching || $_template->source->handler->recompiled ) { $_template->cached->valid = false; } @@ -117,7 +118,7 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base * Render cache template * * @param \Smarty_Internal_Template $_template - * @param bool $no_output_filter + * @param bool $no_output_filter * * @throws \Exception */ @@ -162,14 +163,14 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base } else { $this->valid = true; } - if ($this->valid && $_template->caching == Smarty::CACHING_LIFETIME_CURRENT && - $_template->cache_lifetime >= 0 && time() > ($this->timestamp + $_template->cache_lifetime) + if ($this->valid && $_template->caching === Smarty::CACHING_LIFETIME_CURRENT + && $_template->cache_lifetime >= 0 && time() > ($this->timestamp + $_template->cache_lifetime) ) { // lifetime expired $this->valid = false; } - if ($this->valid && $_template->smarty->compile_check == 1 && - $_template->source->getTimeStamp() > $this->timestamp + if ($this->valid && $_template->compile_check === Smarty::COMPILECHECK_ON + && $_template->source->getTimeStamp() > $this->timestamp ) { $this->valid = false; } @@ -203,9 +204,9 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base } else { return $this->valid; } - if ($this->valid && $_template->caching === Smarty::CACHING_LIFETIME_SAVED && - $_template->cached->cache_lifetime >= 0 && - (time() > ($_template->cached->timestamp + $_template->cached->cache_lifetime)) + if ($this->valid && $_template->caching === Smarty::CACHING_LIFETIME_SAVED + && $_template->cached->cache_lifetime >= 0 + && (time() > ($_template->cached->timestamp + $_template->cached->cache_lifetime)) ) { $this->valid = false; } |