Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

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.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

      (Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

core.php

Zuletzt modifiziert: 09.10.2024, 12:54 - Dateigröße: 3.33 KiB


 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 = 6;
 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          // Set the Twig options if defined in the environment
 075          $definition = $container->getDefinition('template.twig.environment');
 076          $twig_environment_options = $definition->getArgument(static::TWIG_OPTIONS_POSITION);
 077          if ($config['twig']['debug'])
 078          {
 079              $twig_environment_options['debug'] = true;
 080          }
 081          if ($config['twig']['auto_reload'])
 082          {
 083              $twig_environment_options['auto_reload'] = true;
 084          }
 085   
 086          // Replace the 7th argument, the options passed to the environment
 087          $definition->replaceArgument(static::TWIG_OPTIONS_POSITION, $twig_environment_options);
 088   
 089          if ($config['twig']['enable_debug_extension'])
 090          {
 091              $definition = $container->getDefinition('template.twig.extensions.debug');
 092              $definition->addTag('twig.extension');
 093          }
 094   
 095          // Set the debug options
 096          foreach ($config['debug'] as $name => $value)
 097          {
 098              $container->setParameter('debug.' . $name, $value);
 099          }
 100      }
 101   
 102      /**
 103       * {@inheritdoc}
 104       */
 105      public function getConfiguration(array $config, ContainerBuilder $container)
 106      {
 107          $r = new \ReflectionClass('\phpbb\di\extension\container_configuration');
 108          $container->addResource(new FileResource($r->getFileName()));
 109   
 110          return new container_configuration();
 111      }
 112   
 113      /**
 114       * Returns the recommended alias to use in XML.
 115       *
 116       * This alias is also the mandatory prefix to use when using YAML.
 117       *
 118       * @return string The alias
 119       */
 120      public function getAlias()
 121      {
 122          return 'core';
 123      }
 124  }
 125