mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[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
This commit is contained in:
parent
7a9aec5fda
commit
6c771a38de
2 changed files with 16 additions and 4 deletions
|
@ -45,15 +45,27 @@ class phpbb_template_twig_environment extends Twig_Environment
|
||||||
*
|
*
|
||||||
* @return string The cache file name
|
* @return string The cache file name
|
||||||
*/
|
*/
|
||||||
public function getCacheFilename($name)
|
public function ignoregetCacheFilename($name)
|
||||||
{
|
{
|
||||||
if (false === $this->cache) {
|
if (false === $this->cache) {
|
||||||
return false;
|
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) . '.php';
|
||||||
|
return $this->getCache() . '/' . preg_replace('#[^a-zA-Z0-9_/]#', '_', $name) . '_' . md5($this->getLoader()->getCacheKey($name)) . '.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -82,7 +82,7 @@ class phpbb_template_template_test_case extends phpbb_test_case
|
||||||
|
|
||||||
protected function tearDown()
|
protected function tearDown()
|
||||||
{
|
{
|
||||||
$this->template->clear_cache();
|
//$this->template->clear_cache();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function run_template($file, array $vars, array $block_vars, array $destroy, $expected)
|
protected function run_template($file, array $vars, array $block_vars, array $destroy, $expected)
|
||||||
|
|
Loading…
Add table
Reference in a new issue