Просмотр исходного кода

simplify logic, fullfills the unit test

El RIDO 6 лет назад
Родитель
Сommit
0efe6f7a8e
1 измененных файлов с 1 добавлено и 20 удалено
  1. 1 20
      lib/Configuration.php

+ 1 - 20
lib/Configuration.php

@@ -102,29 +102,10 @@ class Configuration
     public function __construct()
     public function __construct()
     {
     {
         $config     = array();
         $config     = array();
-        $basePath   = PATH . 'cfg' . DIRECTORY_SEPARATOR;
+        $basePath   = (getenv('CONFIG_PATH') !== false ? getenv('CONFIG_PATH') : PATH . 'cfg') . DIRECTORY_SEPARATOR;
         $configIni  = $basePath . 'conf.ini';
         $configIni  = $basePath . 'conf.ini';
         $configFile = $basePath . 'conf.php';
         $configFile = $basePath . 'conf.php';
 
 
-        if (getenv('CONFIG_PATH') !== false) {
-            $configFile    = getenv('CONFIG_PATH');
-            $configFilePhp = substr($configFile, 0, -3) . 'php';
-
-            // Rename INI files to avoid configuration leakage
-            if (
-                strtolower(substr($configFile, -3, 3)) == 'ini' &&
-                is_readable($configFile) &&
-                is_writable(dirname($configFile))
-            ) {
-                DataStore::prependRename($configFile, $configFilePhp, ';');
-            }
-
-            // Rename successful? Already renamed? use that file
-            if (is_readable($configFilePhp)) {
-                $configFile = $configFilePhp;
-            }
-        }
-
         // rename INI files to avoid configuration leakage
         // rename INI files to avoid configuration leakage
         if (is_readable($configIni)) {
         if (is_readable($configIni)) {
             DataStore::prependRename($configIni, $configFile, ';');
             DataStore::prependRename($configIni, $configFile, ';');