diff options
author | Mario Vavti <mario@mariovavti.com> | 2015-12-06 21:09:58 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2015-12-06 21:09:58 +0100 |
commit | 26c465ad0c1d5b6801507ed190430f44ac92c672 (patch) | |
tree | 9e80c34da1235e6dd55942c23bf9511fac31344d /library/Smarty/libs/sysplugins/smarty_cacheresource.php | |
parent | f2d70831838b0738e6895296f3e8ce02f86fec2f (diff) | |
download | volse-hubzilla-26c465ad0c1d5b6801507ed190430f44ac92c672.tar.gz volse-hubzilla-26c465ad0c1d5b6801507ed190430f44ac92c672.tar.bz2 volse-hubzilla-26c465ad0c1d5b6801507ed190430f44ac92c672.zip |
update smarty to 3.1.28-dev which fixes a bug where changes in a template are only visible on the second pageload which is annoying for developing
Diffstat (limited to 'library/Smarty/libs/sysplugins/smarty_cacheresource.php')
-rw-r--r-- | library/Smarty/libs/sysplugins/smarty_cacheresource.php | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/library/Smarty/libs/sysplugins/smarty_cacheresource.php b/library/Smarty/libs/sysplugins/smarty_cacheresource.php index 622ab6fbc..8cd2805a5 100644 --- a/library/Smarty/libs/sysplugins/smarty_cacheresource.php +++ b/library/Smarty/libs/sysplugins/smarty_cacheresource.php @@ -20,9 +20,7 @@ abstract class Smarty_CacheResource * * @var array */ - protected static $sysplugins = array( - 'file' => 'smarty_internal_cacheresource_file.php', - ); + protected static $sysplugins = array('file' => 'smarty_internal_cacheresource_file.php',); /** * populate Cached Object with meta data from Resource @@ -48,10 +46,11 @@ abstract class Smarty_CacheResource * * @param Smarty_Internal_Template $_template template object * @param Smarty_Template_Cached $cached cached object + * @param bool $update flag if called because cache update * - * @return boolean true or false if the cached content does not exist + * @return bool true or false if the cached content does not exist */ - abstract public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached = null); + abstract public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached = null, $update = false); /** * Write the rendered template output to cache @@ -74,8 +73,8 @@ abstract class Smarty_CacheResource { if ($_template->cached->handler->process($_template)) { ob_start(); - $_template->properties['unifunc']($_template); - + $unifunc = $_template->cached->unifunc; + $unifunc($_template); return ob_get_clean(); } @@ -186,27 +185,24 @@ abstract class Smarty_CacheResource } // try smarty's cache - if (isset($smarty->_cacheresource_handlers[$type])) { - return $smarty->_cacheresource_handlers[$type]; + if (isset($smarty->_cache['cacheresource_handlers'][$type])) { + return $smarty->_cache['cacheresource_handlers'][$type]; } // try registered resource if (isset($smarty->registered_cache_resources[$type])) { // do not cache these instances as they may vary from instance to instance - return $smarty->_cacheresource_handlers[$type] = $smarty->registered_cache_resources[$type]; + return $smarty->_cache['cacheresource_handlers'][$type] = $smarty->registered_cache_resources[$type]; } // try sysplugins dir if (isset(self::$sysplugins[$type])) { $cache_resource_class = 'Smarty_Internal_CacheResource_' . ucfirst($type); - if (!class_exists($cache_resource_class, false)) { - require SMARTY_SYSPLUGINS_DIR . self::$sysplugins[$type]; - } - return $smarty->_cacheresource_handlers[$type] = new $cache_resource_class(); + return $smarty->_cache['cacheresource_handlers'][$type] = new $cache_resource_class(); } // try plugins dir $cache_resource_class = 'Smarty_CacheResource_' . ucfirst($type); if ($smarty->loadPlugin($cache_resource_class)) { - return $smarty->_cacheresource_handlers[$type] = new $cache_resource_class(); + return $smarty->_cache['cacheresource_handlers'][$type] = new $cache_resource_class(); } // give up throw new SmartyException("Unable to load cache resource '{$type}'"); @@ -217,12 +213,13 @@ abstract class Smarty_CacheResource * * @param Smarty $smarty Smarty object */ - public static function invalidLoadedCache(Smarty $smarty) + public function invalidLoadedCache(Smarty $smarty) { - foreach ($smarty->template_objects as $tpl) { - if (isset($tpl->cached)) { - $tpl->cached->valid = false; - $tpl->cached->processed = false; + if (isset($smarty->_cache['template_objects'])) { + foreach ($smarty->_cache['template_objects'] as $key => $tpl) { + if (isset($tpl->cached)) { + unset ($smarty->_cache['template_objects'][$key]); + } } } } |