summaryrefslogtreecommitdiffstats
path: root/system/database/DB.php
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2011-02-16 20:03:49 +0100
committerPhil Sturgeon <email@philsturgeon.co.uk>2011-02-16 20:03:49 +0100
commit33ed0f37b6b8f2223cd3362bf8fca28102ab67c6 (patch)
tree99c613720a2fd8541764bb6fc893e0da28fa269b /system/database/DB.php
parent154da11c5bb4b7dc5c225f4fa018852ee45cc6eb (diff)
parentd8d1e24eee56d2466c91ecd72b3c8932eb3d0639 (diff)
Merged CodeIgniter Core changes and integrated rob1's secure cookie change into my secure cookie change.
Diffstat (limited to 'system/database/DB.php')
-rw-r--r--system/database/DB.php18
1 files changed, 16 insertions, 2 deletions
diff --git a/system/database/DB.php b/system/database/DB.php
index fb0516ba4..93ee3922a 100644
--- a/system/database/DB.php
+++ b/system/database/DB.php
@@ -27,7 +27,21 @@ 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);
+
+ $file_path = APPPATH.'config/'.ENVIRONMENT.'/database'.EXT;
+
+ if ( ! file_exists($file_path))
+ {
+ log_message('debug', 'Database config for '.ENVIRONMENT.' environment is not found. Trying global config.');
+ $file_path = APPPATH.'config/database'.EXT;
+
+ if ( ! file_exists($file_path))
+ {
+ continue;
+ }
+ }
+
+ include($file_path);
if ( ! isset($db) OR count($db) == 0)
{
@@ -74,7 +88,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")