diff options
author | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-04-06 23:57:43 +0200 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-04-06 23:57:43 +0200 |
commit | 05fa61144667c85b0463f7e8baa6af00aa195dc6 (patch) | |
tree | 2a611231c945ce7fd5bd021e3491dd973794f58e /system/core/Config.php | |
parent | 08b5169a5181706156c9a53229d164d9fa3aea32 (diff) |
Made Environment Support optional. Comment out or delete the constant to stop environment checks.
Diffstat (limited to 'system/core/Config.php')
-rw-r--r-- | system/core/Config.php | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/system/core/Config.php b/system/core/Config.php index a2a7dd564..863c5ef4b 100644 --- a/system/core/Config.php +++ b/system/core/Config.php @@ -81,29 +81,37 @@ class CI_Config { function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE) { $file = ($file == '') ? 'config' : str_replace(EXT, '', $file); + $found = FALSE; $loaded = FALSE; foreach ($this->_config_paths as $path) - { - $file_path = $path.'config/'.ENVIRONMENT.'/'.$file.EXT; + { + $check_locations = defined('ENVIRONMENT') + ? array(ENVIRONMENT.'/'.$file, $file) + : array($file); - if (in_array($file_path, $this->is_loaded, TRUE)) + foreach ($check_locations as $location) { - $loaded = TRUE; - continue; - } + $file_path = $path.'config/'.$location.EXT; - if ( ! file_exists($file_path)) - { - log_message('debug', 'Config for '.ENVIRONMENT.' environment is not found. Trying global config.'); - $file_path = $path.'config/'.$file.EXT; - - if ( ! file_exists($file_path)) + if (in_array($file_path, $this->is_loaded, TRUE)) + { + $loaded = TRUE; + continue 2; + } + + if (file_exists($file_path)) { - continue; + $found = TRUE; + break; } } - + + if ($found === FALSE) + { + continue; + } + include($file_path); if ( ! isset($config) OR ! is_array($config)) @@ -144,9 +152,9 @@ class CI_Config { { return FALSE; } - show_error('The configuration file '.ENVIRONMENT.'/'.$file.EXT.' and '.$file.EXT.' do not exist.'); + show_error('The configuration file '.$file.EXT.' does not exist.'); } - + return TRUE; } @@ -318,4 +326,4 @@ class CI_Config { // END CI_Config class /* End of file Config.php */ -/* Location: ./system/core/Config.php */ +/* Location: ./system/core/Config.php */
\ No newline at end of file |