From f2d90ce32f64973a37d228b8c132567ed07d7314 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Mon, 29 Sep 2003 00:20:17 +0000 Subject: [PATCH] Switch for recompilation (based on filesystem modified time) git-svn-id: file:///svn/phpbb/trunk@4517 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/template.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php index abd9ebf516..ccb835c6cb 100644 --- a/phpBB/includes/template.php +++ b/phpBB/includes/template.php @@ -54,9 +54,8 @@ class template var $block_nesting_level = 0; 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; @@ -74,7 +73,6 @@ class template } $this->static_lang = $static_lang; - $this->force_recompile = $force_recompile; return true; } @@ -132,12 +130,14 @@ class template // Load a compiled template if possible, if not, recompile it 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; + $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 - if (file_exists($filename) && !$this->force_recompile) + if (!$recompile) { return $filename; } @@ -285,8 +285,6 @@ class template // Include a seperate template function _tpl_include($filename, $include = true) { - global $user; - $handle = $filename; $this->filename[$handle] = $filename; $this->files[$handle] = $this->root . '/' . $filename; @@ -295,14 +293,14 @@ class template if ($include) { - if (!$this->force_recompile && $filename) + global $user; + + if ($filename) { include($filename); + return; } - else - { - eval(' ?>' . $this->compiled_code[$handle] . '' . $this->compiled_code[$handle] . '