From 1b5ea4983d2489b1d10eed88c4adb71f8905fe62 Mon Sep 17 00:00:00 2001 From: "Aleksander Machniak (Kolab Systems)" Date: Mon, 4 Jul 2011 19:36:03 +0200 Subject: [PATCH] Initialize contactlist data object only when needed, for better performance of addressbook folders (with groups) list --- .../lib/rcube_kolab_contacts.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php index 137e9690..a19baec6 100644 --- a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php +++ b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php @@ -825,6 +825,16 @@ class rcube_kolab_contacts extends rcube_addressbook { if (!isset($this->contactstorage)) { $this->contactstorage = $this->storagefolder->getData(null); + } + } + + + /** + * Establishes a connection to the Kolab_Data object for accessing groups data + */ + private function _connect_groups() + { + if (!isset($this->liststorage)) { $this->liststorage = $this->storagefolder->getData('distributionlist'); } } @@ -837,7 +847,7 @@ class rcube_kolab_contacts extends rcube_addressbook { if (!isset($this->contacts)) { $this->_connect(); - + // read contacts $this->contacts = $this->id2uid = array(); foreach ((array)$this->contactstorage->getObjects() as $record) { @@ -872,8 +882,8 @@ class rcube_kolab_contacts extends rcube_addressbook private function _fetch_groups() { if (!isset($this->distlists)) { - $this->_connect(); - + $this->_connect_groups(); + $this->distlists = $this->groupmembers = array(); foreach ((array)$this->liststorage->getObjects() as $record) { // FIXME: folders without any distribution-list objects return contacts instead ?!