From 9d0ab04e1e39bc93c59f60844dd2cf9176443028 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 24 Oct 2012 21:47:39 +0300 Subject: Fix #191 --- system/core/Loader.php | 8 ++++---- user_guide_src/source/changelog.rst | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/system/core/Loader.php b/system/core/Loader.php index 5de2e5dde..b316c8e1b 100644 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -318,9 +318,9 @@ class CI_Loader { /** * Database Loader * - * @param string the DB credentials - * @param bool whether to return the DB object - * @param bool whether to enable query builder (this allows us to override the config setting) + * @param mixed $params = '' the DB settings + * @param bool $return = FALSE whether to return the DB object + * @param bool $query_builder = NULL whether to enable query builder (overrides the config setting) * @return object */ public function database($params = '', $return = FALSE, $query_builder = NULL) @@ -329,7 +329,7 @@ class CI_Loader { $CI =& get_instance(); // Do we even need to load the database class? - if (class_exists('CI_DB') && $return === FALSE && $query_builder === NULL && isset($CI->db) && is_object($CI->db)) + if ($return === FALSE && $query_builder === NULL && isset($CI->db) && is_object($CI->db) && ! empty($CI->db->conn_id)) { return FALSE; } diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 92f6a03ef..ca46e9db1 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -377,6 +377,7 @@ Bug fixes for 3.0 - Fixed a bug (#1766) - :doc:`Query Builder ` didn't always take into account the *dbprefix* setting. - Fixed a bug (#779) - :doc:`URI Class ` didn't always trim slashes from the *uri_string* as shown in the documentation. - Fixed a bug (#134) - :doc:`Database Caching ` method ``delete_cache()`` didn't work in some cases due to *cachedir* not being initialized properly. +- Fixed a bug (#191) - :doc:`Loader Library ` ignored attempts for (re)loading databases to ``get_instance()->db`` even when the old database connection is dead. Version 2.1.3 ============= -- cgit v1.2.3-24-g4f1b