aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2011-04-24 00:22:41 -0400
committerOleg Pudeyev <oleg@bsdpower.com>2011-04-24 01:08:48 -0400
commit203187a8410c411b0bdd90729e19c257ec3a7820 (patch)
tree165990650a310df304db99c1cd5bdad0ec6d7532
parent4dfe4c7f13ac8177dac5eb73cd3535d3c651bd75 (diff)
downloadforums-203187a8410c411b0bdd90729e19c257ec3a7820.tar
forums-203187a8410c411b0bdd90729e19c257ec3a7820.tar.gz
forums-203187a8410c411b0bdd90729e19c257ec3a7820.tar.bz2
forums-203187a8410c411b0bdd90729e19c257ec3a7820.tar.xz
forums-203187a8410c411b0bdd90729e19c257ec3a7820.zip
[feature/template-engine] Fix recompilation logic.
Do not change $recompile from true to false - any recompilation condition alone is sufficient to force recompilation. Also uncomment the nonexistent file test which passes with this fix. PHPBB3-9726
-rw-r--r--phpBB/includes/template.php23
-rw-r--r--tests/template/template_test.php2
2 files changed, 14 insertions, 11 deletions
diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php
index 5eebeeae34..5d0e8416a4 100644
--- a/phpBB/includes/template.php
+++ b/phpBB/includes/template.php
@@ -343,19 +343,22 @@ class phpbb_template
$recompile = false;
$recompile = (!file_exists($filename) || @filesize($filename) === 0 || ($config['load_tplcompile'] && @filemtime($filename) < @filemtime($this->files[$handle]))) ? true : false;
- if (defined('DEBUG_EXTRA'))
- {
- $recompile = true;
- }
- else if ($config['load_tplcompile'])
+ if (!$recompile)
{
- // No way around it: we need to check inheritance here
- if ($user->theme['template_inherits_id'] && !file_exists($this->files[$handle]))
+ if (defined('DEBUG_EXTRA'))
{
- $this->files[$handle] = $this->files_inherit[$handle];
- $this->files_template[$handle] = $user->theme['template_inherits_id'];
+ $recompile = true;
+ }
+ else if ($config['load_tplcompile'])
+ {
+ // No way around it: we need to check inheritance here
+ if ($user->theme['template_inherits_id'] && !file_exists($this->files[$handle]))
+ {
+ $this->files[$handle] = $this->files_inherit[$handle];
+ $this->files_template[$handle] = $user->theme['template_inherits_id'];
+ }
+ $recompile = (@filemtime($filename) < @filemtime($this->files[$handle])) ? true : false;
}
- $recompile = (@filemtime($filename) < @filemtime($this->files[$handle])) ? true : false;
}
// Recompile page if the original template is newer, otherwise load the compiled version
diff --git a/tests/template/template_test.php b/tests/template/template_test.php
index 44f0ad2640..665b7a81ab 100644
--- a/tests/template/template_test.php
+++ b/tests/template/template_test.php
@@ -267,7 +267,7 @@ class phpbb_template_template_test extends phpbb_test_case
$this->assertFileNotExists($this->template_path . '/' . $filename, 'Testing missing file, file cannot exist');
$expecting = sprintf('template->_tpl_load_file(): File %s does not exist or is empty', realpath($this->template_path . '/../') . '/templates/' . $filename);
- // $this->setExpectedTriggerError(E_USER_ERROR, $expecting);
+ $this->setExpectedTriggerError(E_USER_ERROR, $expecting);
$this->display('test');
}