Re-organized rendering (read source / compile / cache) process to avoid circular dependencies.

This commit is contained in:
Simon Wisselink
2023-01-26 12:58:15 +01:00
parent 047b73d4a1
commit c47756b489
11 changed files with 234 additions and 259 deletions

View File

@@ -36,35 +36,6 @@ abstract class RecompiledPlugin extends BasePlugin {
return false;
}
/**
* compile template from source
*
* @param Template $_smarty_tpl do not change variable name, is used by compiled template
*
* @throws Exception
*/
public function recompile(Template $_smarty_tpl) {
$compiled = $_smarty_tpl->getCompiled();
$compiled->file_dependency = [];
$compiled->includes = [];
$compiled->nocache_hash = null;
$compiled->unifunc = null;
$level = ob_get_level();
ob_start();
// call compiler
try {
eval('?>' . $_smarty_tpl->getCompiler()->compileTemplate($_smarty_tpl));
} catch (\Exception $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
ob_get_clean();
$compiled->timestamp = time();
$compiled->exists = true;
}
/*
* Disable timestamp checks for recompiled resource.
*