]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/ConfigFileLoader.php
Merge pull request #10769 from MrPetovan/task/10734-unfollow-hook
[friendica.git] / src / Util / ConfigFileLoader.php
index 0c416a189f8fe51ce2527f822e23b7f17d71fab4..aabefc18bba112f0dcfae08ed775c5b570225a19 100644 (file)
@@ -35,20 +35,6 @@ use Friendica\Core\Config\Cache;
  */
 class ConfigFileLoader
 {
-       /**
-        * The Sub directory of the config-files
-        *
-        * @var string
-        */
-       const CONFIG_DIR = 'config';
-
-       /**
-        * The Sub directory of the static config-files
-        *
-        * @var string
-        */
-       const STATIC_DIR = 'static';
-
        /**
         * The default name of the user defined ini file
         *
@@ -83,11 +69,16 @@ class ConfigFileLoader
         */
        private $staticDir;
 
-       public function __construct(string $basePath)
+       /**
+        * @param string $baseDir   The base
+        * @param string $configDir
+        * @param string $staticDir
+        */
+       public function __construct(string $baseDir, string $configDir, string $staticDir)
        {
-               $this->baseDir   = $basePath;
-               $this->configDir = $this->baseDir . DIRECTORY_SEPARATOR . self::CONFIG_DIR;
-               $this->staticDir = $this->baseDir . DIRECTORY_SEPARATOR . self::STATIC_DIR;
+               $this->baseDir   = $baseDir;
+               $this->configDir = $configDir;
+               $this->staticDir = $staticDir;
        }
 
        /**
@@ -102,7 +93,7 @@ class ConfigFileLoader
         *
         * @throws Exception
         */
-       public function setupCache(Cache $config, array $server = [], $raw = false)
+       public function setupCache(Cache $config, array $server = [], bool $raw = false)
        {
                // Load static config files first, the order is important
                $config->load($this->loadStaticConfig('defaults'), Cache::SOURCE_FILE);
@@ -185,7 +176,7 @@ class ConfigFileLoader
                $filepath = $this->baseDir . DIRECTORY_SEPARATOR .   // /var/www/html/
                            Addon::DIRECTORY . DIRECTORY_SEPARATOR . // addon/
                            $name . DIRECTORY_SEPARATOR .            // openstreetmap/
-                           self::CONFIG_DIR . DIRECTORY_SEPARATOR . // config/
+                           'config'. DIRECTORY_SEPARATOR .              // config/
                            $name . ".config.php";                   // openstreetmap.config.php
 
                if (file_exists($filepath)) {
@@ -206,9 +197,8 @@ class ConfigFileLoader
         */
        public function loadEnvConfig(array $server)
        {
-               $filepath = $this->baseDir . DIRECTORY_SEPARATOR .   // /var/www/html/
-                                       self::STATIC_DIR . DIRECTORY_SEPARATOR . // static/
-                                       "env.config.php";                        // env.config.php
+               $filepath = $this->staticDir . DIRECTORY_SEPARATOR .   // /var/www/html/static/
+                                       "env.config.php";                          // env.config.php
 
                if (!file_exists($filepath)) {
                        return [];