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

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

default_resources_locator.php

Zuletzt modifiziert: 02.04.2025, 15:02 - Dateigröße: 2.57 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\routing\resources_locator;
015   
016  use phpbb\extension\manager;
017   
018  /**
019   * Locates the yaml routing resources located in the default locations
020   */
021  class default_resources_locator implements resources_locator_interface
022  {
023      /**
024       * phpBB root path
025       *
026       * @var string
027       */
028      protected $phpbb_root_path;
029   
030      /**
031       * Name of the current environment
032       *
033       * @var string
034       */
035      protected $environment;
036   
037      /**
038       * Extension manager
039       *
040       * @var manager
041       */
042      protected $extension_manager;
043   
044      /**
045       * Construct method
046       *
047       * @param string    $phpbb_root_path    phpBB root path
048       * @param string    $environment        Name of the current environment
049       * @param manager    $extension_manager    Extension manager
050       */
051      public function __construct($phpbb_root_path, $environment, manager $extension_manager = null)
052      {
053          $this->phpbb_root_path        = $phpbb_root_path;
054          $this->environment            = $environment;
055          $this->extension_manager    = $extension_manager;
056      }
057   
058      /**
059       * {@inheritdoc}
060       */
061      public function locate_resources()
062      {
063          $resources = [['config/' . $this->environment . '/routing/environment.yml', 'yaml']];
064   
065          $resources = $this->append_ext_resources($resources);
066   
067          return $resources;
068      }
069   
070      /**
071       * Append extension resources to an array of resouces
072       *
073       * @see resources_locator_interface::locate_resources()
074       *
075       * @param mixed[] $resources List of resources
076       *
077       * @return mixed[] List of resources
078       */
079      protected function append_ext_resources(array $resources)
080      {
081          if ($this->extension_manager !== null)
082          {
083              foreach ($this->extension_manager->all_enabled(false) as $path)
084              {
085                  if (file_exists($this->phpbb_root_path . $path . 'config/' . $this->environment . '/routing/environment.yml'))
086                  {
087                      $resources[] = [$path . 'config/' . $this->environment . '/routing/environment.yml', 'yaml'];
088                  }
089                  else if (!is_dir($this->phpbb_root_path . $path . 'config/' . $this->environment))
090                  {
091                      if (file_exists($this->phpbb_root_path . $path . 'config/default/routing/environment.yml'))
092                      {
093                          $resources[] = [$path . 'config/default/routing/environment.yml', 'yaml'];
094                      }
095                      else if (!is_dir($this->phpbb_root_path . $path . 'config/default/routing') && file_exists($this->phpbb_root_path . $path . 'config/routing.yml'))
096                      {
097                          $resources[] = [$path . 'config/routing.yml', 'yaml'];
098                      }
099                  }
100              }
101          }
102   
103          return $resources;
104      }
105  }
106