diff options
| author | Nathaniel Guse <nathaniel.guse@gmail.com> | 2013-06-25 19:24:32 -0500 |
|---|---|---|
| committer | Nathaniel Guse <nathaniel.guse@gmail.com> | 2013-06-25 19:24:32 -0500 |
| commit | 6c771a38ded92135b9264e142cc27d7e5770eda1 (patch) | |
| tree | eb69b9c93029c2d610c2af8f052ef52471e18c46 | |
| parent | 7a9aec5fda8b5be0aba1918b58b3972f7eed906f (diff) | |
| download | forums-6c771a38ded92135b9264e142cc27d7e5770eda1.tar forums-6c771a38ded92135b9264e142cc27d7e5770eda1.tar.gz forums-6c771a38ded92135b9264e142cc27d7e5770eda1.tar.bz2 forums-6c771a38ded92135b9264e142cc27d7e5770eda1.tar.xz forums-6c771a38ded92135b9264e142cc27d7e5770eda1.zip | |
[feature/twig] Going back to Twig's handling of cache file names for now
My method was not working correctly, will work on it more later.
PHPBB3-11598
| -rw-r--r-- | phpBB/includes/template/twig/environment.php | 18 | ||||
| -rw-r--r-- | tests/template/template_test_case.php | 2 |
2 files changed, 16 insertions, 4 deletions
diff --git a/phpBB/includes/template/twig/environment.php b/phpBB/includes/template/twig/environment.php index 0947a902d0..d20da965c3 100644 --- a/phpBB/includes/template/twig/environment.php +++ b/phpBB/includes/template/twig/environment.php @@ -45,15 +45,27 @@ class phpbb_template_twig_environment extends Twig_Environment * * @return string The cache file name */ - public function getCacheFilename($name) + public function ignoregetCacheFilename($name) { if (false === $this->cache) { return false; } +// @todo + $file_path = $this->getLoader()->getCacheKey($name); + foreach ($this->getLoader()->getNamespaces() as $namespace) + { + foreach ($this->getLoader()->getPaths($namespace) as $path) + { + if (strpos($file_path, $path) === 0) + { + //return $this->getCache() . '/' . preg_replace('#[^a-zA-Z0-9_/]#', '_', $namespace . '/' . $name) . '.php'; + } + } + } - // @todo correct cache file name handling - + // We probably should never get here under normal circumstances return $this->getCache() . '/' . preg_replace('#[^a-zA-Z0-9_/]#', '_', $name) . '.php'; + return $this->getCache() . '/' . preg_replace('#[^a-zA-Z0-9_/]#', '_', $name) . '_' . md5($this->getLoader()->getCacheKey($name)) . '.php'; } /** diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php index 5ff15fff53..23ee8aae04 100644 --- a/tests/template/template_test_case.php +++ b/tests/template/template_test_case.php @@ -82,7 +82,7 @@ class phpbb_template_template_test_case extends phpbb_test_case protected function tearDown() { - $this->template->clear_cache(); + //$this->template->clear_cache(); } protected function run_template($file, array $vars, array $block_vars, array $destroy, $expected) |
