Skip to content

Commit 36237d8

Browse files
author
Root
committed
Move closing of database connection to CI_DB_driver->__destruct - bcit-ci#1376
1 parent 1d79efe commit 36237d8

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

system/core/CodeIgniter.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -393,15 +393,5 @@ function &get_instance()
393393
*/
394394
$EXT->call_hook('post_system');
395395

396-
/*
397-
* ------------------------------------------------------
398-
* Close the DB connection if one exists
399-
* ------------------------------------------------------
400-
*/
401-
if (class_exists('CI_DB') && isset($CI->db) && ! $CI->db->pconnect)
402-
{
403-
$CI->db->close();
404-
}
405-
406396
/* End of file CodeIgniter.php */
407397
/* Location: ./system/core/CodeIgniter.php */

system/database/DB_driver.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ public function __construct($params)
9292

9393
// --------------------------------------------------------------------
9494

95+
public function __destruct()
96+
{
97+
$this->close();
98+
}
99+
100+
// --------------------------------------------------------------------
101+
95102
/**
96103
* Initialize Database Settings
97104
*

0 commit comments

Comments
 (0)