1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 05:50:42 +02:00

[ticket/14555] Uniformize cache directory usages

PHPBB3-14555
This commit is contained in:
Tristan Darricau
2016-03-23 22:48:58 +01:00
parent eca4726f3c
commit 56c2caf6c0
18 changed files with 43 additions and 48 deletions

View File

@@ -48,13 +48,6 @@ class router implements RouterInterface
*/
protected $loader;
/**
* phpBB root path
*
* @var string
*/
protected $phpbb_root_path;
/**
* PHP file extensions
*
@@ -62,13 +55,6 @@ class router implements RouterInterface
*/
protected $php_ext;
/**
* Name of the current environment
*
* @var string
*/
protected $environment;
/**
* @var \Symfony\Component\Routing\Matcher\UrlMatcherInterface|null
*/
@@ -89,25 +75,28 @@ class router implements RouterInterface
*/
protected $route_collection;
/**
* @var string
*/
protected $cache_dir;
/**
* Construct method
*
* @param ContainerInterface $container DI container
* @param resources_locator_interface $resources_locator Resources locator
* @param LoaderInterface $loader Resources loader
* @param string $phpbb_root_path phpBB root path
* @param string $php_ext PHP file extension
* @param string $environment Name of the current environment
* @param string $cache_dir phpBB cache directory
*/
public function __construct(ContainerInterface $container, resources_locator_interface $resources_locator, LoaderInterface $loader, $phpbb_root_path, $php_ext, $environment)
public function __construct(ContainerInterface $container, resources_locator_interface $resources_locator, LoaderInterface $loader, $php_ext, $cache_dir)
{
$this->container = $container;
$this->resources_locator = $resources_locator;
$this->loader = $loader;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
$this->environment = $environment;
$this->context = new RequestContext();
$this->cache_dir = $cache_dir;
}
/**
@@ -211,7 +200,7 @@ class router implements RouterInterface
{
try
{
$cache = new ConfigCache("{$this->phpbb_root_path}cache/{$this->environment}/url_matcher.{$this->php_ext}", defined('DEBUG'));
$cache = new ConfigCache("{$this->cache_dir}url_matcher.{$this->php_ext}", defined('DEBUG'));
if (!$cache->isFresh())
{
$dumper = new PhpMatcherDumper($this->get_routes());
@@ -266,7 +255,7 @@ class router implements RouterInterface
{
try
{
$cache = new ConfigCache("{$this->phpbb_root_path}cache/{$this->environment}/url_generator.{$this->php_ext}", defined('DEBUG'));
$cache = new ConfigCache("{$this->cache_dir}url_generator.{$this->php_ext}", defined('DEBUG'));
if (!$cache->isFresh())
{
$dumper = new PhpGeneratorDumper($this->get_routes());