summaryrefslogtreecommitdiffstats
path: root/system/core
diff options
context:
space:
mode:
Diffstat (limited to 'system/core')
-rw-r--r--system/core/Config.php69
1 files changed, 28 insertions, 41 deletions
diff --git a/system/core/Config.php b/system/core/Config.php
index d8a606c14..ca865cebf 100644
--- a/system/core/Config.php
+++ b/system/core/Config.php
@@ -120,74 +120,61 @@ class CI_Config {
foreach ($this->_config_paths as $path)
{
- $found = FALSE;
- foreach (array(ENVIRONMENT.'/'.$file, $file) as $location)
+ foreach (array($file, ENVIRONMENT.'/'.$file) as $location)
{
$file_path = $path.'config/'.$location.'.php';
if (in_array($file_path, $this->is_loaded, TRUE))
{
- $loaded = TRUE;
- continue 2;
+ return TRUE;
}
- if (file_exists($file_path))
+ if ( ! file_exists($file_path))
{
- $found = TRUE;
- break;
+ continue;
}
- }
-
- if ($found === FALSE)
- {
- continue;
- }
- include($file_path);
+ include($file_path);
- if ( ! isset($config) OR ! is_array($config))
- {
- if ($fail_gracefully === TRUE)
+ if ( ! isset($config) OR ! is_array($config))
{
- return FALSE;
+ if ($fail_gracefully === TRUE)
+ {
+ return FALSE;
+ }
+
+ show_error('Your '.$file_path.' file does not appear to contain a valid configuration array.');
}
- show_error('Your '.$file_path.' file does not appear to contain a valid configuration array.');
- }
- if ($use_sections === TRUE)
- {
- if (isset($this->config[$file]))
+ if ($use_sections === TRUE)
{
- $this->config[$file] = array_merge($this->config[$file], $config);
+ $this->config[$file] = isset($this->config[$file])
+ ? array_merge($this->config[$file], $config)
+ : $config;
}
else
{
- $this->config[$file] = $config;
+ $this->config = array_merge($this->config, $config);
}
+
+ $this->is_loaded[] = $file_path;
+ $config = NULL;
+ $loaded = TRUE;
+ log_message('debug', 'Config file loaded: '.$file_path);
}
- else
+
+ if ($loaded === TRUE)
{
- $this->config = array_merge($this->config, $config);
+ return TRUE;
}
-
- $this->is_loaded[] = $file_path;
- unset($config);
-
- $loaded = TRUE;
- log_message('debug', 'Config file loaded: '.$file_path);
- break;
}
- if ($loaded === FALSE)
+ if ($fail_gracefully === TRUE)
{
- if ($fail_gracefully === TRUE)
- {
- return FALSE;
- }
- show_error('The configuration file '.$file.'.php does not exist.');
+ return FALSE;
}
- return TRUE;
+ show_error('The configuration file '.$file.'.php does not exist.');
}
// --------------------------------------------------------------------