Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
core.php
001 <?php
002 /**
003 *
004 * This file is part of the phpBB Forum Software package.
005 *
006 * @copyright (c) phpBB Limited <https://www.phpbb.com>
007 * @license GNU General Public License, version 2 (GPL-2.0)
008 *
009 * For full copyright and license information, please see
010 * the docs/CREDITS.txt file.
011 *
012 */
013
014 namespace phpbb\di\extension;
015
016 use Symfony\Component\Config\FileLocator;
017 use Symfony\Component\Config\Resource\FileResource;
018 use Symfony\Component\DependencyInjection\ContainerBuilder;
019 use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
020 use Symfony\Component\HttpKernel\DependencyInjection\Extension;
021
022 /**
023 * Container core extension
024 */
025 class core extends Extension
026 {
027 const TWIG_OPTIONS_POSITION = 7;
028
029 /**
030 * Config path
031 * @var string
032 */
033 protected $config_path;
034
035 /**
036 * Constructor
037 *
038 * @param string $config_path Config path
039 */
040 public function __construct($config_path)
041 {
042 $this->config_path = $config_path;
043 }
044
045 /**
046 * Loads a specific configuration.
047 *
048 * @param array $configs An array of configuration values
049 * @param ContainerBuilder $container A ContainerBuilder instance
050 *
051 * @throws \InvalidArgumentException When provided tag is not defined in this extension
052 */
053 public function load(array $configs, ContainerBuilder $container)
054 {
055 $filesystem = new \phpbb\filesystem\filesystem();
056 $loader = new YamlFileLoader($container, new FileLocator($filesystem->realpath($this->config_path)));
057 $loader->load($container->getParameter('core.environment') . '/container/environment.yml');
058
059 $config = $this->getConfiguration($configs, $container);
060 $config = $this->processConfiguration($config, $configs);
061
062 if ($config['require_dev_dependencies'])
063 {
064 if (!class_exists('Goutte\Client', true))
065 {
066 trigger_error(
067 'Composer development dependencies have not been set up for the ' . $container->getParameter('core.environment') . ' environment yet, run ' .
068 "'php ../composer.phar install --dev' from the phpBB directory to do so.",
069 E_USER_ERROR
070 );
071 }
072 }
073
074 $container->setParameter('allow_install_dir', $config['allow_install_dir']);
075
076 // Set the Twig options if defined in the environment
077 $definition = $container->getDefinition('template.twig.environment');
078 $twig_environment_options = $definition->getArgument(static::TWIG_OPTIONS_POSITION);
079 if ($config['twig']['debug'])
080 {
081 $twig_environment_options['debug'] = true;
082 }
083 if ($config['twig']['auto_reload'])
084 {
085 $twig_environment_options['auto_reload'] = true;
086 }
087
088 // Replace the 7th argument, the options passed to the environment
089 $definition->replaceArgument(static::TWIG_OPTIONS_POSITION, $twig_environment_options);
090
091 if ($config['twig']['enable_debug_extension'])
092 {
093 $definition = $container->getDefinition('template.twig.extensions.debug');
094 $definition->addTag('twig.extension');
095 }
096
097 // Set the debug options
098 foreach ($config['debug'] as $name => $value)
099 {
100 $container->setParameter('debug.' . $name, $value);
101 }
102
103 // Set the log options
104 foreach ($config['session'] as $name => $value)
105 {
106 $container->setParameter('session.' . $name, $value);
107 }
108 }
109
110 /**
111 * {@inheritdoc}
112 */
113 public function getConfiguration(array $config, ContainerBuilder $container)
114 {
115 $r = new \ReflectionClass('\phpbb\di\extension\container_configuration');
116 $container->addResource(new FileResource($r->getFileName()));
117
118 return new container_configuration();
119 }
120
121 /**
122 * Returns the recommended alias to use in XML.
123 *
124 * This alias is also the mandatory prefix to use when using YAML.
125 *
126 * @return string The alias
127 */
128 public function getAlias()
129 {
130 return 'core';
131 }
132 }
133