summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/database/DB_driver.php24
1 files changed, 17 insertions, 7 deletions
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index c757277ce..44c864e64 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -90,13 +90,6 @@ abstract class CI_DB_driver {
log_message('debug', 'Database Driver Class Initialized');
}
- // --------------------------------------------------------------------
-
- public function __destruct()
- {
- $this->close();
- }
-
// --------------------------------------------------------------------
/**
@@ -1397,6 +1390,23 @@ abstract class CI_DB_driver {
{
}
+ // --------------------------------------------------------------------
+
+ /**
+ * Destructor
+ *
+ * Closes the database connection, if needed.
+ *
+ * @return void
+ */
+ public function __destruct()
+ {
+ if ($this->conn_id && ! $this->pconnect)
+ {
+ $this->close();
+ }
+ }
+
}
/* End of file DB_driver.php */