mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-13 14:58:52 +00:00
[ticket/12620] Use the container to get the environment name
PHPBB3-12620
This commit is contained in:
parent
c98efc53a8
commit
acc91a2bbf
4 changed files with 23 additions and 8 deletions
|
@ -35,7 +35,9 @@ if (!defined('IN_PHPBB'))
|
||||||
*/
|
*/
|
||||||
function phpbb_get_url_matcher(\phpbb\extension\manager $manager, RequestContext $context, $root_path, $php_ext)
|
function phpbb_get_url_matcher(\phpbb\extension\manager $manager, RequestContext $context, $root_path, $php_ext)
|
||||||
{
|
{
|
||||||
$config_cache = new ConfigCache($root_path . 'cache/' . PHPBB_ENVIRONMENT . '/url_matcher.' . $php_ext, defined('DEBUG'));
|
global $phpbb_container;
|
||||||
|
|
||||||
|
$config_cache = new ConfigCache($root_path . 'cache/' . $phpbb_container->getParameter('core.environment') . '/url_matcher.' . $php_ext, defined('DEBUG'));
|
||||||
if (!$config_cache->isFresh())
|
if (!$config_cache->isFresh())
|
||||||
{
|
{
|
||||||
phpbb_create_dumped_url_matcher($manager, $root_path, $config_cache);
|
phpbb_create_dumped_url_matcher($manager, $root_path, $config_cache);
|
||||||
|
@ -90,6 +92,8 @@ function phpbb_create_url_matcher(\phpbb\extension\manager $manager, RequestCont
|
||||||
*/
|
*/
|
||||||
function phpbb_load_url_matcher(RequestContext $context, $root_path, $php_ext)
|
function phpbb_load_url_matcher(RequestContext $context, $root_path, $php_ext)
|
||||||
{
|
{
|
||||||
require($root_path . 'cache/' . PHPBB_ENVIRONMENT . '/url_matcher.' . $php_ext);
|
global $phpbb_container;
|
||||||
|
|
||||||
|
require($root_path . 'cache/' . $phpbb_container->getParameter('core.environment') . '/url_matcher.' . $php_ext);
|
||||||
return new phpbb_url_matcher($context);
|
return new phpbb_url_matcher($context);
|
||||||
}
|
}
|
||||||
|
|
5
phpBB/phpbb/cache/driver/file.php
vendored
5
phpBB/phpbb/cache/driver/file.php
vendored
|
@ -27,8 +27,9 @@ class file extends \phpbb\cache\driver\base
|
||||||
*/
|
*/
|
||||||
function __construct($cache_dir = null)
|
function __construct($cache_dir = null)
|
||||||
{
|
{
|
||||||
global $phpbb_root_path;
|
global $phpbb_root_path, $phpbb_container;
|
||||||
$this->cache_dir = !is_null($cache_dir) ? $cache_dir : $phpbb_root_path . 'cache/' . PHPBB_ENVIRONMENT . '/';
|
|
||||||
|
$this->cache_dir = !is_null($cache_dir) ? $cache_dir : $phpbb_root_path . 'cache/' . $phpbb_container->getParameter('core.environment') . '/';
|
||||||
|
|
||||||
if (!is_dir($this->cache_dir))
|
if (!is_dir($this->cache_dir))
|
||||||
{
|
{
|
||||||
|
|
|
@ -193,7 +193,7 @@ class container_builder
|
||||||
}
|
}
|
||||||
|
|
||||||
$loader = new YamlFileLoader($this->container, new FileLocator(phpbb_realpath($this->get_config_path())));
|
$loader = new YamlFileLoader($this->container, new FileLocator(phpbb_realpath($this->get_config_path())));
|
||||||
$loader->load(PHPBB_ENVIRONMENT . '/config.yml');
|
$loader->load($this->container->getParameter('core.environment') . '/config.yml');
|
||||||
|
|
||||||
$this->inject_custom_parameters();
|
$this->inject_custom_parameters();
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ class container_builder
|
||||||
*/
|
*/
|
||||||
protected function get_cache_dir()
|
protected function get_cache_dir()
|
||||||
{
|
{
|
||||||
return $this->cache_dir ?: $this->phpbb_root_path . 'cache/' . PHPBB_ENVIRONMENT . '/';
|
return $this->cache_dir ?: $this->phpbb_root_path . 'cache/' . $this->get_environment() . '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -457,7 +457,7 @@ class container_builder
|
||||||
array(
|
array(
|
||||||
'core.root_path' => $this->phpbb_root_path,
|
'core.root_path' => $this->phpbb_root_path,
|
||||||
'core.php_ext' => $this->php_ext,
|
'core.php_ext' => $this->php_ext,
|
||||||
'core.environment' => PHPBB_ENVIRONMENT,
|
'core.environment' => $this->get_environment(),
|
||||||
'core.debug' => DEBUG,
|
'core.debug' => DEBUG,
|
||||||
),
|
),
|
||||||
$this->get_env_parameters()
|
$this->get_env_parameters()
|
||||||
|
@ -495,4 +495,14 @@ class container_builder
|
||||||
$filename = str_replace(array('/', '.'), array('slash', 'dot'), $this->phpbb_root_path);
|
$filename = str_replace(array('/', '.'), array('slash', 'dot'), $this->phpbb_root_path);
|
||||||
return $this->get_cache_dir() . 'container_' . $filename . '.' . $this->php_ext;
|
return $this->get_cache_dir() . 'container_' . $filename . '.' . $this->php_ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the name of the current environment.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function get_environment()
|
||||||
|
{
|
||||||
|
return PHPBB_ENVIRONMENT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ class core extends Extension
|
||||||
public function load(array $configs, ContainerBuilder $container)
|
public function load(array $configs, ContainerBuilder $container)
|
||||||
{
|
{
|
||||||
$loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($this->config_path)));
|
$loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($this->config_path)));
|
||||||
$loader->load(PHPBB_ENVIRONMENT . '/container/environment.yml');
|
$loader->load($container->getParameter('core.environment') . '/container/environment.yml');
|
||||||
|
|
||||||
$config = $this->getConfiguration($configs, $container);
|
$config = $this->getConfiguration($configs, $container);
|
||||||
$config = $this->processConfiguration($config, $configs);
|
$config = $this->processConfiguration($config, $configs);
|
||||||
|
|
Loading…
Add table
Reference in a new issue