mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-29 06:38:52 +00:00
[ticket/12775] Add customs parameters
PHPBB3-12775
This commit is contained in:
parent
cdf87e0078
commit
86205454af
1 changed files with 45 additions and 4 deletions
|
@ -93,6 +93,19 @@ class container_factory
|
||||||
*/
|
*/
|
||||||
protected $dump_container = true;
|
protected $dump_container = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom parameters to inject into the container.
|
||||||
|
*
|
||||||
|
* Default to true:
|
||||||
|
* array(
|
||||||
|
* 'core.root_path', $this->phpbb_root_path,
|
||||||
|
* 'core.php_ext', $this->php_ext,
|
||||||
|
* );
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $custom_parameters = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
|
@ -146,8 +159,7 @@ class container_factory
|
||||||
$this->container->addCompilerPass(new \phpbb\di\pass\kernel_pass());
|
$this->container->addCompilerPass(new \phpbb\di\pass\kernel_pass());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->container->setParameter('core.root_path', $this->phpbb_root_path);
|
$this->inject_custom_parameters();
|
||||||
$this->container->setParameter('core.php_ext', $this->php_ext);
|
|
||||||
|
|
||||||
$this->container->compile();
|
$this->container->compile();
|
||||||
|
|
||||||
|
@ -234,7 +246,7 @@ class container_factory
|
||||||
*
|
*
|
||||||
* @var bool $dump_container
|
* @var bool $dump_container
|
||||||
*/
|
*/
|
||||||
public function setDumpContainer($dump_container)
|
public function set_dump_container($dump_container)
|
||||||
{
|
{
|
||||||
$this->dump_container = $dump_container;
|
$this->dump_container = $dump_container;
|
||||||
}
|
}
|
||||||
|
@ -244,11 +256,21 @@ class container_factory
|
||||||
*
|
*
|
||||||
* @param string $config_path
|
* @param string $config_path
|
||||||
*/
|
*/
|
||||||
public function setConfigPath($config_path)
|
public function set_config_path($config_path)
|
||||||
{
|
{
|
||||||
$this->config_path = $config_path;
|
$this->config_path = $config_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set custom parameters to inject into the container.
|
||||||
|
*
|
||||||
|
* @param array $custom_parameters
|
||||||
|
*/
|
||||||
|
public function set_custom_parameters($custom_parameters)
|
||||||
|
{
|
||||||
|
$this->custom_parameters = $custom_parameters;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dump the container to the disk.
|
* Dump the container to the disk.
|
||||||
*
|
*
|
||||||
|
@ -348,6 +370,25 @@ class container_factory
|
||||||
return $container;
|
return $container;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inject the customs parameters into the container
|
||||||
|
*/
|
||||||
|
protected function inject_custom_parameters()
|
||||||
|
{
|
||||||
|
if ($this->custom_parameters === null)
|
||||||
|
{
|
||||||
|
$this->custom_parameters = array(
|
||||||
|
'core.root_path', $this->phpbb_root_path,
|
||||||
|
'core.php_ext', $this->php_ext,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($this->custom_parameters as $key => $value)
|
||||||
|
{
|
||||||
|
$this->container->setParameter($key, $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the filename under which the dumped container will be stored.
|
* Get the filename under which the dumped container will be stored.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue