mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-02 09:24:28 +02:00
Take out one more stat call (on the compiled template) by not calculating it's existence / timestamp when compile_check is false.
This commit is contained in:
@@ -74,9 +74,14 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base
|
|||||||
$this->filepath .= '.cache';
|
$this->filepath .= '.cache';
|
||||||
}
|
}
|
||||||
$this->filepath .= '.php';
|
$this->filepath .= '.php';
|
||||||
$this->timestamp = $this->exists = is_file($this->filepath);
|
|
||||||
if ($this->exists) {
|
if ($smarty->compile_check) {
|
||||||
$this->timestamp = filemtime($this->filepath);
|
$this->timestamp = $this->exists = is_file($this->filepath);
|
||||||
|
if ($this->exists) {
|
||||||
|
$this->timestamp = filemtime($this->filepath);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->timestamp = $this->exists = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,8 +140,9 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base
|
|||||||
if ($source->handler->recompiled) {
|
if ($source->handler->recompiled) {
|
||||||
$source->handler->process($_smarty_tpl);
|
$source->handler->process($_smarty_tpl);
|
||||||
} elseif (!$source->handler->uncompiled) {
|
} elseif (!$source->handler->uncompiled) {
|
||||||
if (!$this->exists || $smarty->force_compile
|
if (
|
||||||
|| ($_smarty_tpl->compile_check && $source->getTimeStamp() > $this->getTimeStamp())
|
$smarty->force_compile ||
|
||||||
|
($_smarty_tpl->compile_check && (!$this->exists || ($source->getTimeStamp() > $this->getTimeStamp())))
|
||||||
) {
|
) {
|
||||||
$this->compileTemplateSource($_smarty_tpl);
|
$this->compileTemplateSource($_smarty_tpl);
|
||||||
$compileCheck = $_smarty_tpl->compile_check;
|
$compileCheck = $_smarty_tpl->compile_check;
|
||||||
|
Reference in New Issue
Block a user