summaryrefslogtreecommitdiffstats
path: root/system/core/Config.php
diff options
context:
space:
mode:
authorphilsturgeon <devnull@localhost>2011-06-15 17:00:03 +0200
committerphilsturgeon <devnull@localhost>2011-06-15 17:00:03 +0200
commit0fe54dbaf89a8337d27b9203f74891cf1a799715 (patch)
treece168b3c24788e5a4a31e0cc65b64f54e25ee8a2 /system/core/Config.php
parent3a43c7adae7737d68a0eeca663cc2dd3fc5b0cf3 (diff)
parent3ef65bd7491f847fecdab1acc9687f0e90eee09b (diff)
Merged Alex Bilbies MSSQL changes.
Diffstat (limited to 'system/core/Config.php')
-rw-r--r--system/core/Config.php61
1 files changed, 35 insertions, 26 deletions
diff --git a/system/core/Config.php b/system/core/Config.php
index a2a7dd564..fa71f4d3d 100644
--- a/system/core/Config.php
+++ b/system/core/Config.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
@@ -37,11 +37,11 @@ class CI_Config {
*
* Sets the $config data from the primary config.php file as a class variable
*
- * @access public
- * @param string the config file name
- * @param boolean if configuration values should be loaded into their own section
- * @param boolean true if errors should just return false, false if an error message should be displayed
- * @return boolean if the file was successfully loaded or not
+ * @access public
+ * @param string the config file name
+ * @param boolean if configuration values should be loaded into their own section
+ * @param boolean true if errors should just return false, false if an error message should be displayed
+ * @return boolean if the file was successfully loaded or not
*/
function __construct()
{
@@ -74,36 +74,44 @@ class CI_Config {
*
* @access public
* @param string the config file name
- * @param boolean if configuration values should be loaded into their own section
- * @param boolean true if errors should just return false, false if an error message should be displayed
+ * @param boolean if configuration values should be loaded into their own section
+ * @param boolean true if errors should just return false, false if an error message should be displayed
* @return boolean if the file was loaded correctly
*/
function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
{
- $file = ($file == '') ? 'config' : str_replace(EXT, '', $file);
+ $file = ($file == '') ? 'config' : str_replace('.php', '', $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.'.php';
- 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))
@@ -136,6 +144,7 @@ class CI_Config {
$loaded = TRUE;
log_message('debug', 'Config file loaded: '.$file_path);
+ break;
}
if ($loaded === FALSE)
@@ -144,9 +153,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.'.php'.' does not exist.');
}
-
+
return TRUE;
}
@@ -296,7 +305,7 @@ class CI_Config {
* Assign to Config
*
* This function is called by the front controller (CodeIgniter.php)
- * after the Config class is instantiated. It permits config items
+ * after the Config class is instantiated. It permits config items
* to be assigned or overriden by variables contained in the index.php file
*
* @access private