From: Friendika Date: Wed, 6 Jul 2011 00:45:33 +0000 (-0700) Subject: explicitly close db connections - do not rely on process exit X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1a4a6b5ff90d0d557ed6ea1a1045f9713c83bbbd;p=friendica.git explicitly close db connections - do not rely on process exit --- diff --git a/boot.php b/boot.php index c95e24dc1c..5efba4acc7 100644 --- a/boot.php +++ b/boot.php @@ -989,6 +989,7 @@ function autoname($len) { if(! function_exists('killme')) { function killme() { session_write_close(); + closedb(); exit; }} diff --git a/include/dba.php b/include/dba.php index 49b325cf7b..32f1ac3edb 100644 --- a/include/dba.php +++ b/include/dba.php @@ -212,4 +212,13 @@ function dbesc_array(&$arr) { if(is_array($arr) && count($arr)) { array_walk($arr,'dbesc_array_cb'); } -}} \ No newline at end of file +}} + + +if(! function_exists('closedb')) { +function closedb() { + global $db; + if($db && $db->connected) + $db->close(); +}} + diff --git a/index.php b/index.php index 2e24c5b015..a0a0bc7795 100644 --- a/index.php +++ b/index.php @@ -326,4 +326,5 @@ else require_once(str_replace($lang . '/', '', $template)); session_write_close(); +closedb(); exit;