From 457373bf3ff3c875a8626824c2068aed7a4c989e Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Wed, 15 Sep 2010 09:36:17 -0400
Subject: [PATCH] - Fix: close() method of addressbook object(s) is not called in shutdown function
---
program/include/rcmail.php | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index 0a7c15d..e911119 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -45,6 +45,7 @@
public $comm_path = './';
private $texts;
+ private $books = array();
/**
@@ -279,6 +280,10 @@
else { // $id == 'sql'
$contacts = new rcube_contacts($this->db, $this->user->ID);
}
+
+ // add to the 'books' array for shutdown function
+ if (!in_array($contacts, $this->books))
+ $this->books[] = $contacts;
return $contacts;
}
@@ -974,8 +979,9 @@
if (is_object($this->smtp))
$this->smtp->disconnect();
- if (is_object($this->contacts))
- $this->contacts->close();
+ foreach ($this->books as $book)
+ if (is_object($book))
+ $book->close();
// before closing the database connection, write session data
if ($_SERVER['REMOTE_ADDR'])
--
Gitblit v1.9.1