mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
Merge pull request #4237 from Nicofuma/ticket/14555
[ticket/14555] Uniformize cache directory usages
This commit is contained in:
4
phpBB/phpbb/cache/driver/file.php
vendored
4
phpBB/phpbb/cache/driver/file.php
vendored
@@ -32,9 +32,9 @@ class file extends \phpbb\cache\driver\base
|
||||
*/
|
||||
function __construct($cache_dir = null)
|
||||
{
|
||||
global $phpbb_root_path, $phpbb_container;
|
||||
global $phpbb_container;
|
||||
|
||||
$this->cache_dir = !is_null($cache_dir) ? $cache_dir : $phpbb_root_path . 'cache/' . $phpbb_container->getParameter('core.environment') . '/';
|
||||
$this->cache_dir = !is_null($cache_dir) ? $cache_dir : $phpbb_container->getParameter('core.cache_dir');
|
||||
$this->filesystem = new \phpbb\filesystem\filesystem();
|
||||
|
||||
if (!is_dir($this->cache_dir))
|
||||
|
4
phpBB/phpbb/cache/driver/memory.php
vendored
4
phpBB/phpbb/cache/driver/memory.php
vendored
@@ -25,9 +25,9 @@ abstract class memory extends \phpbb\cache\driver\base
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
global $phpbb_root_path, $dbname, $table_prefix;
|
||||
global $phpbb_root_path, $dbname, $table_prefix, $phpbb_container;
|
||||
|
||||
$this->cache_dir = $phpbb_root_path . 'cache/';
|
||||
$this->cache_dir = $phpbb_container->getParameter('core.cache_dir');
|
||||
$this->key_prefix = substr(md5($dbname . $table_prefix), 0, 8) . '_';
|
||||
|
||||
if (!isset($this->extension) || !extension_loaded($this->extension))
|
||||
|
@@ -20,20 +20,23 @@ class queue extends \phpbb\cron\task\base
|
||||
{
|
||||
protected $phpbb_root_path;
|
||||
protected $php_ext;
|
||||
protected $cache_dir;
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $phpbb_root_path The root path
|
||||
* @param string $php_ext PHP file extension
|
||||
* @param \phpbb\config\config $config The config
|
||||
*/
|
||||
public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config)
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $phpbb_root_path The root path
|
||||
* @param string $php_ext PHP file extension
|
||||
* @param \phpbb\config\config $config The config
|
||||
* @param string $cache_dir phpBB cache directory
|
||||
*/
|
||||
public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config, $cache_dir)
|
||||
{
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
$this->config = $config;
|
||||
$this->cache_dir = $cache_dir;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,7 +63,7 @@ class queue extends \phpbb\cron\task\base
|
||||
*/
|
||||
public function is_runnable()
|
||||
{
|
||||
return file_exists($this->phpbb_root_path . 'cache/queue.' . $this->php_ext);
|
||||
return file_exists($this->cache_dir . 'queue.' . $this->php_ext);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -522,6 +522,7 @@ class container_builder
|
||||
'core.php_ext' => $this->php_ext,
|
||||
'core.environment' => $this->get_environment(),
|
||||
'core.debug' => defined('DEBUG') ? DEBUG : false,
|
||||
'core.cache_dir' => $this->get_cache_dir(),
|
||||
),
|
||||
$this->get_env_parameters()
|
||||
);
|
||||
|
@@ -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());
|
||||
|
Reference in New Issue
Block a user