Line 115 | Line 115 |
---|
/** @var \Exception */ private $build_exception;
|
/** @var \Exception */ private $build_exception;
|
| /** * @var array */ private $env_parameters = [];
|
/** * Constructor
| /** * Constructor
|
Line 124 | Line 129 |
---|
*/ public function __construct($phpbb_root_path, $php_ext) {
|
*/ public function __construct($phpbb_root_path, $php_ext) {
|
$this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext;
| $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; $this->env_parameters = $this->get_env_parameters();
if (isset($this->env_parameters['core.cache_dir'])) { $this->with_cache_dir($this->env_parameters['core.cache_dir']); }
|
}
/**
| }
/**
|
Line 137 | Line 148 |
---|
{ try {
|
{ try {
|
$container_filename = $this->get_container_filename(); $config_cache = new ConfigCache($container_filename, defined('DEBUG')); if ($this->use_cache && $config_cache->isFresh())
| $build_container = true;
if ($this->use_cache)
|
{ if ($this->use_extensions) { $autoload_cache = new ConfigCache($this->get_autoload_filename(), defined('DEBUG'));
|
{ if ($this->use_extensions) { $autoload_cache = new ConfigCache($this->get_autoload_filename(), defined('DEBUG'));
|
|
|
if (!$autoload_cache->isFresh()) { // autoload cache should be refreshed
| if (!$autoload_cache->isFresh()) { // autoload cache should be refreshed
|
Line 153 | Line 165 |
---|
require($this->get_autoload_filename()); }
|
require($this->get_autoload_filename()); }
|
| $container_filename = $this->get_container_filename(); $config_cache = new ConfigCache($container_filename, defined('DEBUG'));
if ($config_cache->isFresh()) {
|
require($config_cache->getPath()); $this->container = new \phpbb_cache_container();
|
require($config_cache->getPath()); $this->container = new \phpbb_cache_container();
|
| $build_container = false;
|
}
|
}
|
else
| }
if ($build_container)
|
{ $this->container_extensions = [ new extension\core($this->get_config_path()),
| { $this->container_extensions = [ new extension\core($this->get_config_path()),
|
Line 209 | Line 229 |
---|
} }
|
} }
|
if ($this->compile_container && $this->config_php_file)
| if ($this->config_php_file)
|
{ $this->container->set('config.php', $this->config_php_file); }
| { $this->container->set('config.php', $this->config_php_file); }
|
Line 400 | Line 420 |
---|
* * @return string Path to the cache directory. */
|
* * @return string Path to the cache directory. */
|
protected function get_cache_dir()
| public function get_cache_dir()
|
{ return $this->cache_dir ?: $this->phpbb_root_path . 'cache/' . $this->get_environment() . '/'; }
| { return $this->cache_dir ?: $this->phpbb_root_path . 'cache/' . $this->get_environment() . '/'; }
|
Line 572 | Line 592 |
---|
protected function get_core_parameters() { return array_merge(
|
protected function get_core_parameters() { return array_merge(
|
array(
| [
|
'core.root_path' => $this->phpbb_root_path, 'core.php_ext' => $this->php_ext, 'core.environment' => $this->get_environment(), 'core.debug' => defined('DEBUG') ? DEBUG : false, 'core.cache_dir' => $this->get_cache_dir(),
|
'core.root_path' => $this->phpbb_root_path, '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()
| ], $this->env_parameters
|
); }
| ); }
|