aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2003-09-29 00:20:17 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2003-09-29 00:20:17 +0000
commitf2d90ce32f64973a37d228b8c132567ed07d7314 (patch)
tree53351c040ff58935521e67500f59290aa79d74a7
parenta32d43d94a44f189b7edf2627c532b68fb53ecd9 (diff)
downloadforums-f2d90ce32f64973a37d228b8c132567ed07d7314.tar
forums-f2d90ce32f64973a37d228b8c132567ed07d7314.tar.gz
forums-f2d90ce32f64973a37d228b8c132567ed07d7314.tar.bz2
forums-f2d90ce32f64973a37d228b8c132567ed07d7314.tar.xz
forums-f2d90ce32f64973a37d228b8c132567ed07d7314.zip
Switch for recompilation (based on filesystem modified time)
git-svn-id: file:///svn/phpbb/trunk@4517 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r--phpBB/includes/template.php22
1 files 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] . '<?php ');
- }
+ eval(' ?>' . $this->compiled_code[$handle] . '<?php ');
}
}