mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
optimization
This commit is contained in:
@@ -61,29 +61,31 @@ class Smarty_Template_Compiled
|
|||||||
*/
|
*/
|
||||||
static function load($_template)
|
static function load($_template)
|
||||||
{
|
{
|
||||||
|
$smarty = $_template->smarty;
|
||||||
if (!isset($_template->source)) {
|
if (!isset($_template->source)) {
|
||||||
$_template->loadSource();
|
$_template->loadSource();
|
||||||
}
|
}
|
||||||
|
$source = $_template->source;
|
||||||
// check runtime cache
|
// check runtime cache
|
||||||
if (!$_template->source->recompiled && $_template->smarty->resource_caching) {
|
if (!$source->recompiled && $smarty->resource_caching) {
|
||||||
$_cache_key = $_template->source->unique_resource . '#';
|
$_cache_key = $source->unique_resource . '#';
|
||||||
if ($_template->caching) {
|
if ($_template->caching) {
|
||||||
$_cache_key .= 'caching#';
|
$_cache_key .= 'caching#';
|
||||||
}
|
}
|
||||||
$_cache_key .= $_template->compile_id;
|
$_cache_key .= $_template->compile_id;
|
||||||
if (isset($_template->source->compileds[$_cache_key])) {
|
if (isset($source->compileds[$_cache_key])) {
|
||||||
return $_template->source->compileds[$_cache_key];
|
return $source->compileds[$_cache_key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$compiled = new Smarty_Template_Compiled();
|
$compiled = new Smarty_Template_Compiled();
|
||||||
if (method_exists($_template->source->handler, 'populateCompiledFilepath')) {
|
if (method_exists($source->handler, 'populateCompiledFilepath')) {
|
||||||
$_template->source->handler->populateCompiledFilepath($compiled, $_template);
|
$source->handler->populateCompiledFilepath($compiled, $_template);
|
||||||
} else {
|
} else {
|
||||||
$compiled->populateCompiledFilepath($_template);
|
$compiled->populateCompiledFilepath($_template);
|
||||||
}
|
}
|
||||||
// runtime cache
|
// runtime cache
|
||||||
if (!$_template->source->recompiled && $_template->smarty->resource_caching) {
|
if (!$source->recompiled && $smarty->resource_caching) {
|
||||||
$_template->source->compileds[$_cache_key] = $compiled;
|
$source->compileds[$_cache_key] = $compiled;
|
||||||
}
|
}
|
||||||
return $compiled;
|
return $compiled;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user