summaryrefslogtreecommitdiffstats
path: root/system/core
diff options
context:
space:
mode:
Diffstat (limited to 'system/core')
-rw-r--r--system/core/CodeIgniter.php2
-rw-r--r--system/core/Common.php15
-rw-r--r--system/core/Config.php42
-rw-r--r--system/core/Hooks.php2
-rw-r--r--system/core/Loader.php6
-rw-r--r--system/core/Output.php2
-rw-r--r--system/core/Router.php2
7 files changed, 39 insertions, 32 deletions
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php
index 39a4d7ffd..143faec15 100644
--- a/system/core/CodeIgniter.php
+++ b/system/core/CodeIgniter.php
@@ -53,7 +53,7 @@
* Load the framework constants
* ------------------------------------------------------
*/
- if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants'.EXT))
+ if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants'.EXT))
{
require(APPPATH.'config/'.ENVIRONMENT.'/constants'.EXT);
}
diff --git a/system/core/Common.php b/system/core/Common.php
index f424a2cc9..d7054ebe6 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -208,19 +208,18 @@
return $_config[0];
}
- $file_path = APPPATH.'config/'.ENVIRONMENT.'/config'.EXT;
+ // Is the config file in the environment folder?
+ if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config'.EXT))
+ {
+ $file_path = APPPATH.'config/config'.EXT;
+ }
// Fetch the config file
if ( ! file_exists($file_path))
{
- $file_path = APPPATH.'config/config'.EXT;
-
- if ( ! file_exists($file_path))
- {
- exit('The configuration file does not exist.');
- }
+ exit('The configuration file does not exist.');
}
-
+
require($file_path);
// Does the $config array exist in the file?
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
diff --git a/system/core/Hooks.php b/system/core/Hooks.php
index d1e5586de..24fa1055b 100644
--- a/system/core/Hooks.php
+++ b/system/core/Hooks.php
@@ -65,7 +65,7 @@ class CI_Hooks {
// Grab the "hooks" definition file.
// If there are no hooks, we're done.
- if (is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks'.EXT))
+ if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks'.EXT))
{
include(APPPATH.'config/'.ENVIRONMENT.'/hooks'.EXT);
}
diff --git a/system/core/Loader.php b/system/core/Loader.php
index 278a868e6..e75805d0e 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -872,12 +872,12 @@ class CI_Loader {
// We test for both uppercase and lowercase, for servers that
// are case-sensitive with regard to file names. Check for environment
// first, global next
- if (file_exists($path .'config/'.ENVIRONMENT.'/'.strtolower($class).EXT))
+ if (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT.'/'.strtolower($class).EXT))
{
include_once($path .'config/'.ENVIRONMENT.'/'.strtolower($class).EXT);
break;
}
- elseif (file_exists($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).EXT))
+ elseif (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).EXT))
{
include_once($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).EXT);
break;
@@ -965,7 +965,7 @@ class CI_Loader {
*/
function _ci_autoloader()
{
- if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload'.EXT))
+ if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload'.EXT))
{
include_once(APPPATH.'config/'.ENVIRONMENT.'/autoload'.EXT);
}
diff --git a/system/core/Output.php b/system/core/Output.php
index 5ec096a47..bcba2577a 100644
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -42,7 +42,7 @@ class CI_Output {
$this->_zlib_oc = @ini_get('zlib.output_compression');
// Get mime types for later
- if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT))
+ if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT))
{
include APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT;
}
diff --git a/system/core/Router.php b/system/core/Router.php
index 2c78efe07..d451aab68 100644
--- a/system/core/Router.php
+++ b/system/core/Router.php
@@ -87,7 +87,7 @@ class CI_Router {
}
// Load the routes.php file.
- if (is_file(APPPATH.'config/'.ENVIRONMENT.'/routes'.EXT))
+ if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/routes'.EXT))
{
include(APPPATH.'config/'.ENVIRONMENT.'/routes'.EXT);
}