diff options
author | Tristan Darricau <github@nicofuma.fr> | 2014-10-04 16:30:34 +0200 |
---|---|---|
committer | Tristan Darricau <github@nicofuma.fr> | 2014-11-20 20:59:48 +0100 |
commit | 6cbb60d13f75da6d9b6c6d60555ea119df79b5c0 (patch) | |
tree | 3977e49d0e6eee7bf153973a81f459b0b0a612f1 /phpBB/phpbb/di/extension/core.php | |
parent | 74cd97e75b1dce43a05d8e15e9fbccf01e833b57 (diff) | |
download | forums-6cbb60d13f75da6d9b6c6d60555ea119df79b5c0.tar forums-6cbb60d13f75da6d9b6c6d60555ea119df79b5c0.tar.gz forums-6cbb60d13f75da6d9b6c6d60555ea119df79b5c0.tar.bz2 forums-6cbb60d13f75da6d9b6c6d60555ea119df79b5c0.tar.xz forums-6cbb60d13f75da6d9b6c6d60555ea119df79b5c0.zip |
[ticket/12620] Adds a yaml config file
PHPBB3-12620
Diffstat (limited to 'phpBB/phpbb/di/extension/core.php')
-rw-r--r-- | phpBB/phpbb/di/extension/core.php | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/phpBB/phpbb/di/extension/core.php b/phpBB/phpbb/di/extension/core.php index 7787602aba..62fcf46ad5 100644 --- a/phpBB/phpbb/di/extension/core.php +++ b/phpBB/phpbb/di/extension/core.php @@ -13,10 +13,11 @@ namespace phpbb\di\extension; +use Symfony\Component\Config\FileLocator; +use Symfony\Component\Config\Resource\FileResource; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\HttpKernel\DependencyInjection\Extension; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; -use Symfony\Component\Config\FileLocator; +use Symfony\Component\HttpKernel\DependencyInjection\Extension; /** * Container core extension @@ -42,15 +43,41 @@ class core extends Extension /** * Loads a specific configuration. * - * @param array $config An array of configuration values + * @param array $configs An array of configuration values * @param ContainerBuilder $container A ContainerBuilder instance * * @throws \InvalidArgumentException When provided tag is not defined in this extension */ - public function load(array $config, ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container) { $loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($this->config_path))); - $loader->load(PHPBB_ENVIRONMENT . '/environment.yml'); + $loader->load(PHPBB_ENVIRONMENT . '/container/environment.yml'); + + $config = $this->getConfiguration($configs, $container); + $config = $this->processConfiguration($config, $configs); + + if ($config['require_dev_dependencies']) + { + if (!class_exists('Goutte\Client', true)) + { + trigger_error( + 'Composer development dependencies have not been set up for the ' . $container->getParameter('core.environment') . ' environment yet, run ' . + "'php ../composer.phar install --dev' from the phpBB directory to do so.", + E_USER_ERROR + ); + } + } + } + + /** + * {@inheritdoc} + */ + public function getConfiguration(array $config, ContainerBuilder $container) + { + $r = new \ReflectionClass('\phpbb\di\extension\container_configuration'); + $container->addResource(new FileResource($r->getFileName())); + + return new container_configuration(); } /** |