From a6cb25020bb5200cc3c00ecc941ddb751644fbcc Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 6 Dec 2015 23:12:37 +0100 Subject: add missing smarty files --- .../smarty_internal_runtime_validatecompiled.php | 81 ++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 library/Smarty/libs/sysplugins/smarty_internal_runtime_validatecompiled.php (limited to 'library/Smarty/libs/sysplugins/smarty_internal_runtime_validatecompiled.php') diff --git a/library/Smarty/libs/sysplugins/smarty_internal_runtime_validatecompiled.php b/library/Smarty/libs/sysplugins/smarty_internal_runtime_validatecompiled.php new file mode 100644 index 000000000..6624eb0bf --- /dev/null +++ b/library/Smarty/libs/sysplugins/smarty_internal_runtime_validatecompiled.php @@ -0,0 +1,81 @@ +smarty->compile_check) || $tpl->smarty->compile_check == 1) + ) { + // check file dependencies at compiled code + foreach ($properties['file_dependency'] as $_file_to_check) { + if ($_file_to_check[2] == 'file' || $_file_to_check[2] == 'extends' || $_file_to_check[2] == 'php') { + if ($tpl->source->filepath == $_file_to_check[0]) { + // do not recheck current template + continue; + //$mtime = $tpl->source->getTimeStamp(); + } else { + // file and php types can be checked without loading the respective resource handlers + $mtime = is_file($_file_to_check[0]) ? filemtime($_file_to_check[0]) : false; + } + } elseif ($_file_to_check[2] == 'string') { + continue; + } else { + $source = Smarty_Template_Source::load(null, $tpl->smarty, $_file_to_check[0]); + $mtime = $source->getTimeStamp(); + } + if (!$mtime || $mtime > $_file_to_check[1]) { + $is_valid = false; + break; + } + } + } + if ($cache) { + // CACHING_LIFETIME_SAVED cache expiry has to be validated here since otherwise we'd define the unifunc + if ($tpl->caching === Smarty::CACHING_LIFETIME_SAVED && $properties['cache_lifetime'] >= 0 && + (time() > ($tpl->cached->timestamp + $properties['cache_lifetime'])) + ) { + $is_valid = false; + } + $tpl->cached->cache_lifetime = $properties['cache_lifetime']; + $tpl->cached->valid = $is_valid; + $resource = $tpl->cached; + } else { + $tpl->mustCompile = !$is_valid; + $resource = $tpl->compiled; + $resource->includes = isset($properties['includes']) ? $properties['includes'] : array(); + } + if ($is_valid) { + $resource->unifunc = $properties['unifunc']; + $resource->has_nocache_code = $properties['has_nocache_code']; + // $tpl->compiled->nocache_hash = $properties['nocache_hash']; + $resource->file_dependency = $properties['file_dependency']; + if (isset($properties['tpl_function'])) { + $tpl->tpl_function = $properties['tpl_function']; + } + } + return $is_valid && !function_exists($properties['unifunc']); + } +} -- cgit v1.2.3