diff options
-rw-r--r-- | system/core/Loader.php | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/system/core/Loader.php b/system/core/Loader.php index e0a7d5e1b..afdedf522 100644 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -1090,31 +1090,38 @@ class CI_Loader { if (is_array($config_component->_config_paths)) { - // Break on the first found file, thus package files - // are not overridden by default paths + $found = FALSE; foreach ($config_component->_config_paths as $path) { // We test for both uppercase and lowercase, for servers that - // are case-sensitive with regard to file names. Check for environment - // first, global next + // are case-sensitive with regard to file names. Load global first, + // override with environment next + if (file_exists($path.'config/'.strtolower($class).'.php')) + { + include($path.'config/'.strtolower($class).'.php'); + $found = TRUE; + } + elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) + { + include($path.'config/'.ucfirst(strtolower($class)).'.php'); + $found = TRUE; + } + if (file_exists($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php')) { include($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'); - break; + $found = TRUE; } elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) { include($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'); - break; + $found = TRUE; } - elseif (file_exists($path.'config/'.strtolower($class).'.php')) - { - include($path.'config/'.strtolower($class).'.php'); - break; - } - elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) + + // Break on the first found configuration, thus package + // files are not overridden by default paths + if ($found === TRUE) { - include($path.'config/'.ucfirst(strtolower($class)).'.php'); break; } } @@ -1193,14 +1200,11 @@ class CI_Loader { */ protected function _ci_autoloader() { + include(APPPATH.'config/autoload.php'); if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload.php')) { include(APPPATH.'config/'.ENVIRONMENT.'/autoload.php'); } - else - { - include(APPPATH.'config/autoload.php'); - } if ( ! isset($autoload)) { |