From d6d1858e5cdc0caa3f20e558c67c0a27f9a65796 Mon Sep 17 00:00:00 2001 From: Rene Brokholm Date: Thu, 5 Jul 2012 08:32:39 +0200 Subject: I added so the DB.php is aware of database config files in packages. This way if a package is containing a database.php file in its config folder this will be parset alongside the aplication/config/database.php file. --- system/database/DB.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'system') diff --git a/system/database/DB.php b/system/database/DB.php index 00d14b43e..fd5cf5516 100644 --- a/system/database/DB.php +++ b/system/database/DB.php @@ -47,6 +47,21 @@ function &DB($params = '', $query_builder_override = NULL) } include($file_path); + //make packages contain database config files + foreach(get_instance()->load->get_package_paths() as $path) + { + if ($path != APPPATH) + { + if ( file_exists($file_path = $path.'config/'.ENVIRONMENT.'/database.php')) + { + include($file_path); + } + elseif ( file_exists($file_path = $path.'config/database.php')) + { + include($file_path); + } + } + } if ( ! isset($db) OR count($db) === 0) { @@ -166,4 +181,4 @@ function &DB($params = '', $query_builder_override = NULL) } /* End of file DB.php */ -/* Location: ./system/database/DB.php */ \ No newline at end of file +/* Location: ./system/database/DB.php */ -- cgit v1.2.3-24-g4f1b From f5a8530cc937d193aa928bc25f2970eae772d6ef Mon Sep 17 00:00:00 2001 From: Rene Brokholm Date: Thu, 5 Jul 2012 09:05:32 +0200 Subject: code cleanup and changelog added --- system/database/DB.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'system') diff --git a/system/database/DB.php b/system/database/DB.php index fd5cf5516..3044ce517 100644 --- a/system/database/DB.php +++ b/system/database/DB.php @@ -49,19 +49,19 @@ function &DB($params = '', $query_builder_override = NULL) include($file_path); //make packages contain database config files foreach(get_instance()->load->get_package_paths() as $path) - { - if ($path != APPPATH) - { - if ( file_exists($file_path = $path.'config/'.ENVIRONMENT.'/database.php')) - { - include($file_path); - } - elseif ( file_exists($file_path = $path.'config/database.php')) - { - include($file_path); - } - } - } + { + if ($path !== APPPATH) + { + if (file_exists ($file_path = $path.'config/'.ENVIRONMENT.'/database.php')) + { + include ($file_path); + } + elseif ( file_exists ($file_path = $path.'config/database.php')) + { + include ($file_path); + } + } + } if ( ! isset($db) OR count($db) === 0) { -- cgit v1.2.3-24-g4f1b