mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Switch for recompilation (based on filesystem modified time)
git-svn-id: file:///svn/phpbb/trunk@4517 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
a32d43d94a
commit
f2d90ce32f
1 changed files with 10 additions and 12 deletions
|
@ -54,9 +54,8 @@ class template
|
||||||
var $block_nesting_level = 0;
|
var $block_nesting_level = 0;
|
||||||
|
|
||||||
var $static_lang;
|
var $static_lang;
|
||||||
var $force_recompile;
|
|
||||||
|
|
||||||
function set_template($static_lang = false, $force_recompile = false)
|
function set_template($static_lang = false)
|
||||||
{
|
{
|
||||||
global $phpbb_root_path, $config, $user;
|
global $phpbb_root_path, $config, $user;
|
||||||
|
|
||||||
|
@ -74,7 +73,6 @@ class template
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->static_lang = $static_lang;
|
$this->static_lang = $static_lang;
|
||||||
$this->force_recompile = $force_recompile;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -132,12 +130,14 @@ class template
|
||||||
// Load a compiled template if possible, if not, recompile it
|
// Load a compiled template if possible, if not, recompile it
|
||||||
function _tpl_load(&$handle)
|
function _tpl_load(&$handle)
|
||||||
{
|
{
|
||||||
global $phpEx, $user, $db;
|
global $config, $user, $db, $phpEx;
|
||||||
|
|
||||||
$filename = $this->cachepath . $this->filename[$handle] . '.' . (($this->static_lang) ? $user->data['user_lang'] . '.' : '') . $phpEx;
|
$filename = $this->cachepath . $this->filename[$handle] . '.' . (($this->static_lang) ? $user->data['user_lang'] . '.' : '') . $phpEx;
|
||||||
|
|
||||||
|
$recompile = (($config['load_tplcompile'] && filemtime($filename) < filemtime($this->files[$handle])) || !file_exists($filename)) ? true : false;
|
||||||
|
|
||||||
// Recompile page if the original template is newer, otherwise load the compiled version
|
// Recompile page if the original template is newer, otherwise load the compiled version
|
||||||
if (file_exists($filename) && !$this->force_recompile)
|
if (!$recompile)
|
||||||
{
|
{
|
||||||
return $filename;
|
return $filename;
|
||||||
}
|
}
|
||||||
|
@ -285,8 +285,6 @@ class template
|
||||||
// Include a seperate template
|
// Include a seperate template
|
||||||
function _tpl_include($filename, $include = true)
|
function _tpl_include($filename, $include = true)
|
||||||
{
|
{
|
||||||
global $user;
|
|
||||||
|
|
||||||
$handle = $filename;
|
$handle = $filename;
|
||||||
$this->filename[$handle] = $filename;
|
$this->filename[$handle] = $filename;
|
||||||
$this->files[$handle] = $this->root . '/' . $filename;
|
$this->files[$handle] = $this->root . '/' . $filename;
|
||||||
|
@ -295,16 +293,16 @@ class template
|
||||||
|
|
||||||
if ($include)
|
if ($include)
|
||||||
{
|
{
|
||||||
if (!$this->force_recompile && $filename)
|
global $user;
|
||||||
|
|
||||||
|
if ($filename)
|
||||||
{
|
{
|
||||||
include($filename);
|
include($filename);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
eval(' ?>' . $this->compiled_code[$handle] . '<?php ');
|
eval(' ?>' . $this->compiled_code[$handle] . '<?php ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue