diff options
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/config/default/container/services_cron.yml | 1 | ||||
-rw-r--r-- | phpBB/config/default/container/services_routing.yml | 3 | ||||
-rw-r--r-- | phpBB/config/default/container/services_text_formatter.yml | 2 | ||||
-rw-r--r-- | phpBB/config/default/container/services_twig.yml | 2 | ||||
-rw-r--r-- | phpBB/config/installer/container/services.yml | 2 | ||||
-rw-r--r-- | phpBB/includes/bbcode.php | 4 | ||||
-rw-r--r-- | phpBB/includes/functions_messenger.php | 4 | ||||
-rw-r--r-- | phpBB/install/convert/convertor.php | 2 | ||||
-rw-r--r-- | phpBB/phpbb/cache/driver/file.php | 4 | ||||
-rw-r--r-- | phpBB/phpbb/cache/driver/memory.php | 4 | ||||
-rw-r--r-- | phpBB/phpbb/cron/task/core/queue.php | 19 | ||||
-rw-r--r-- | phpBB/phpbb/di/container_builder.php | 1 | ||||
-rw-r--r-- | phpBB/phpbb/routing/router.php | 31 |
13 files changed, 36 insertions, 43 deletions
diff --git a/phpBB/config/default/container/services_cron.yml b/phpBB/config/default/container/services_cron.yml index dd3982a659..0b95a96190 100644 --- a/phpBB/config/default/container/services_cron.yml +++ b/phpBB/config/default/container/services_cron.yml @@ -75,6 +75,7 @@ services: - '%core.root_path%' - '%core.php_ext%' - '@config' + - '%core.cache_dir%' calls: - [set_name, [cron.task.core.queue]] tags: diff --git a/phpBB/config/default/container/services_routing.yml b/phpBB/config/default/container/services_routing.yml index 3cb74ca2b1..3048145a2f 100644 --- a/phpBB/config/default/container/services_routing.yml +++ b/phpBB/config/default/container/services_routing.yml @@ -5,9 +5,8 @@ services: - '@service_container' - '@routing.chained_resources_locator' - '@routing.delegated_loader' - - '%core.root_path%' - '%core.php_ext%' - - '%core.environment%' + - '%core.cache_dir%' router.listener: class: Symfony\Component\HttpKernel\EventListener\RouterListener diff --git a/phpBB/config/default/container/services_text_formatter.yml b/phpBB/config/default/container/services_text_formatter.yml index 943a79cd65..a9f2efdb16 100644 --- a/phpBB/config/default/container/services_text_formatter.yml +++ b/phpBB/config/default/container/services_text_formatter.yml @@ -1,5 +1,5 @@ parameters: - text_formatter.cache.dir: '%core.root_path%cache/%core.environment%/' + text_formatter.cache.dir: '%core.cache_dir%' text_formatter.cache.parser.key: _text_formatter_parser text_formatter.cache.renderer.key: _text_formatter_renderer diff --git a/phpBB/config/default/container/services_twig.yml b/phpBB/config/default/container/services_twig.yml index 2dbf444e0c..dc08d65e1a 100644 --- a/phpBB/config/default/container/services_twig.yml +++ b/phpBB/config/default/container/services_twig.yml @@ -1,5 +1,5 @@ parameters: - core.template.cache_path: '%core.root_path%cache/%core.environment%/twig/' + core.template.cache_path: '%core.cache_dir%twig/' services: template.twig.environment: diff --git a/phpBB/config/installer/container/services.yml b/phpBB/config/installer/container/services.yml index 20d790e9a6..97fc1256fd 100644 --- a/phpBB/config/installer/container/services.yml +++ b/phpBB/config/installer/container/services.yml @@ -12,7 +12,7 @@ services: cache.driver: class: '%cache.driver.class%' arguments: - - '%core.root_path%/cache/installer/' + - '%core.cache_dir%' config: class: phpbb\config\config diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index eb6133d013..5fb8304b9a 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -155,13 +155,13 @@ class bbcode $phpbb_container->get('filesystem'), $phpbb_container->get('path_helper'), $phpbb_container, - $phpbb_container->getParameter('core.root_path') . 'cache/', + $phpbb_container->getParameter('core.cache_dir'), $phpbb_container->get('ext.manager'), new \phpbb\template\twig\loader( $phpbb_filesystem ) ), - $phpbb_container->getParameter('core.root_path') . 'cache/', + $phpbb_container->getParameter('core.cache_dir'), $phpbb_container->get('user'), $phpbb_container->get('template.twig.extensions.collection'), $phpbb_extension_manager diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index e8d4e0d7f1..f55b5e7ec3 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -640,13 +640,13 @@ class messenger $phpbb_container->get('filesystem'), $phpbb_container->get('path_helper'), $phpbb_container, - $phpbb_container->getParameter('core.root_path') . 'cache/', + $phpbb_container->getParameter('core.cache_dir'), $phpbb_container->get('ext.manager'), new \phpbb\template\twig\loader( $phpbb_filesystem ) ), - $phpbb_container->getParameter('core.root_path') . 'cache/', + $phpbb_container->getParameter('core.cache_dir'), $phpbb_container->get('user'), $phpbb_container->get('template.twig.extensions.collection'), $phpbb_extension_manager diff --git a/phpBB/install/convert/convertor.php b/phpBB/install/convert/convertor.php index 2dae356c26..769f8bb637 100644 --- a/phpBB/install/convert/convertor.php +++ b/phpBB/install/convert/convertor.php @@ -1044,7 +1044,7 @@ class convertor OR config_name = 'convert_db_user'"); $db->sql_query('DELETE FROM ' . SESSIONS_TABLE); - @unlink($phpbb_root_path . 'cache/data_global.' . $phpEx); + @unlink($phpbb_container->getParameter('core.cache_dir') . 'data_global.' . $phpEx); phpbb_cache_moderators($db, $cache, $auth); // And finally, add a note to the log diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php index d994394249..a210d877f0 100644 --- a/phpBB/phpbb/cache/driver/file.php +++ b/phpBB/phpbb/cache/driver/file.php @@ -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)) diff --git a/phpBB/phpbb/cache/driver/memory.php b/phpBB/phpbb/cache/driver/memory.php index baae22d809..cc03804705 100644 --- a/phpBB/phpbb/cache/driver/memory.php +++ b/phpBB/phpbb/cache/driver/memory.php @@ -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)) diff --git a/phpBB/phpbb/cron/task/core/queue.php b/phpBB/phpbb/cron/task/core/queue.php index a9345a44df..eca69a5041 100644 --- a/phpBB/phpbb/cron/task/core/queue.php +++ b/phpBB/phpbb/cron/task/core/queue.php @@ -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); } /** diff --git a/phpBB/phpbb/di/container_builder.php b/phpBB/phpbb/di/container_builder.php index 2fb248082f..7bfe1bbb87 100644 --- a/phpBB/phpbb/di/container_builder.php +++ b/phpBB/phpbb/di/container_builder.php @@ -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() ); diff --git a/phpBB/phpbb/routing/router.php b/phpBB/phpbb/routing/router.php index 5d237b6433..f19886fb0b 100644 --- a/phpBB/phpbb/routing/router.php +++ b/phpBB/phpbb/routing/router.php @@ -49,13 +49,6 @@ class router implements RouterInterface protected $loader; /** - * phpBB root path - * - * @var string - */ - protected $phpbb_root_path; - - /** * PHP file extensions * * @var string @@ -63,13 +56,6 @@ class router implements RouterInterface protected $php_ext; /** - * Name of the current environment - * - * @var string - */ - protected $environment; - - /** * @var \Symfony\Component\Routing\Matcher\UrlMatcherInterface|null */ protected $matcher; @@ -90,24 +76,27 @@ 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()); |