From cee8075e2f8fdeb0d8516b5af8ae7cd7754ac513 Mon Sep 17 00:00:00 2001 From: joelcox Date: Sat, 15 Jan 2011 23:09:47 +0100 Subject: Split basic configuration in three environments, providing fallback to global --- system/core/Common.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/core/Common.php') diff --git a/system/core/Common.php b/system/core/Common.php index 6a3d5ac0a..48de161d2 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -209,13 +209,13 @@ } // Fetch the config file - if ( ! file_exists(APPPATH.'config/config'.EXT)) + if ( ! file_exists(APPPATH.'config/'.ENVIRONMENT.'/config'.EXT)) { exit('The configuration file does not exist.'); } else { - require(APPPATH.'config/config'.EXT); + require(APPPATH.'config/'.ENVIRONMENT.'/config'.EXT); } // Does the $config array exist in the file? -- cgit v1.2.3-24-g4f1b From 2035fd8f700c12ca6b21cacf9d1bbb111995a1af Mon Sep 17 00:00:00 2001 From: joelcox Date: Sun, 16 Jan 2011 16:50:36 +0100 Subject: Removed configs from environments and corrected for fallback --- system/core/Common.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'system/core/Common.php') diff --git a/system/core/Common.php b/system/core/Common.php index 48de161d2..5c441a56e 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -208,15 +208,20 @@ return $_config[0]; } + $file_path = APPPATH.'config/'.ENVIRONMENT.'/config'.EXT; + // Fetch the config file - if ( ! file_exists(APPPATH.'config/'.ENVIRONMENT.'/config'.EXT)) - { - exit('The configuration file does not exist.'); - } - else + if ( ! file_exists($file_path)) { - require(APPPATH.'config/'.ENVIRONMENT.'/config'.EXT); + $file_path = APPPATH.'config/config'.EXT; + + if ( ! file_exists($file_path)) + { + exit('The configuration file does not exist.'); + } } + + require($file_path); // Does the $config array exist in the file? if ( ! isset($config) OR ! is_array($config)) -- cgit v1.2.3-24-g4f1b