Add option to control how many seconds to wait before compiling updated template file

This commit is contained in:
Kijin Sung 2023-06-18 23:01:59 +09:00
parent c2f0e4fad9
commit de2a9288f2
6 changed files with 22 additions and 1 deletions

View file

@ -16,6 +16,7 @@ class TemplateHandler
private $config = NULL;
private $skipTags = NULL;
private $handler_mtime = 0;
private $delay_compile = 0;
private static $rootTpl = NULL;
/**
@ -32,6 +33,7 @@ class TemplateHandler
ini_set('pcre.jit', false);
$this->config = new stdClass;
$this->handler_mtime = filemtime(__FILE__);
$this->delay_compile = config('view.delay_compile') ?? 0;
$this->user = Rhymix\Framework\Session::getMemberInfo();
}
@ -163,7 +165,7 @@ class TemplateHandler
// Don't try to compile files that are less than 1 second old
$filemtime = filemtime($this->file);
if ($filemtime > time() - 1)
if ($filemtime > time() - $this->delay_compile)
{
$latest_mtime = $this->handler_mtime;
}