summaryrefslogtreecommitdiffstats
path: root/system/database/DB.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@server-speed.net>2011-04-10 10:39:31 +0200
committerFlorian Pritz <bluewind@server-speed.net>2011-04-10 10:39:31 +0200
commit1bdc9c8903eb2db33fdb8174d61e15100dfbbca8 (patch)
treeb0c645ad99e04f34817fc4e6385792111db42274 /system/database/DB.php
parent413d0cdac49257089a0790f6ac92973a36a6b69f (diff)
update to CI 2.0.2
Signed-off-by: Florian Pritz <bluewind@server-speed.net>
Diffstat (limited to 'system/database/DB.php')
-rwxr-xr-xsystem/database/DB.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/system/database/DB.php b/system/database/DB.php
index fb0516ba4..8bf1ba8ba 100755
--- a/system/database/DB.php
+++ b/system/database/DB.php
@@ -27,7 +27,16 @@ function &DB($params = '', $active_record_override = NULL)
// Load the DB config file if a DSN string wasn't passed
if (is_string($params) AND strpos($params, '://') === FALSE)
{
- include(APPPATH.'config/database'.EXT);
+ // Is the config file in the environment folder?
+ if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/database'.EXT))
+ {
+ if ( ! file_exists($file_path = APPPATH.'config/database'.EXT))
+ {
+ show_error('The configuration file database'.EXT.' does not exist.');
+ }
+ }
+
+ include($file_path);
if ( ! isset($db) OR count($db) == 0)
{
@@ -74,7 +83,7 @@ function &DB($params = '', $active_record_override = NULL)
{
parse_str($dns['query'], $extra);
- foreach($extra as $key => $val)
+ foreach ($extra as $key => $val)
{
// booleans please
if (strtoupper($val) == "TRUE")