summaryrefslogtreecommitdiffstats
path: root/system/database/DB.php
diff options
context:
space:
mode:
authorAhmad Anbar <aanbar@gmail.com>2015-02-08 17:29:52 +0100
committerAhmad Anbar <aanbar@gmail.com>2015-02-08 17:29:52 +0100
commited520408514fff6486788e1543589418d24d885e (patch)
tree07fd3194e9c6baf7aeaa9ccdd164e3fec4494922 /system/database/DB.php
parente5454f9b28f123a5549971f580255a065b2f8cc2 (diff)
parent266c93cc505ae9a8cafb41f9d9432b056de492e0 (diff)
Merge remote-tracking branch 'upstream/develop' into develop
Diffstat (limited to 'system/database/DB.php')
-rw-r--r--system/database/DB.php23
1 files changed, 14 insertions, 9 deletions
diff --git a/system/database/DB.php b/system/database/DB.php
index d411b679e..8ea7ca6fa 100644
--- a/system/database/DB.php
+++ b/system/database/DB.php
@@ -61,18 +61,23 @@ 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)
+
+ // Make packages contain database config files,
+ // given that the controller instance already exists
+ if (class_exists('CI_Controller', FALSE))
{
- if ($path !== APPPATH)
+ foreach (get_instance()->load->get_package_paths() as $path)
{
- if (file_exists($file_path = $path.'config/'.ENVIRONMENT.'/database.php'))
- {
- include($file_path);
- }
- elseif (file_exists($file_path = $path.'config/database.php'))
+ if ($path !== APPPATH)
{
- include($file_path);
+ 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);
+ }
}
}
}