plugins/kolab_delegation
Aleksander Machniak
machniak at kolabsys.com
Mon Dec 17 19:04:16 CET 2012
plugins/kolab_delegation/kolab_delegation_engine.php | 23 +++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
New commits:
commit acd574b65015afea76df6ab30ab802a3e09c1f72
Author: Aleksander Machniak <machniak at kolabsys.com>
Date: Mon Dec 17 19:03:47 2012 +0100
Small performance fix - cache identities list in-memory
diff --git a/plugins/kolab_delegation/kolab_delegation_engine.php b/plugins/kolab_delegation/kolab_delegation_engine.php
index aefaeeb..1d3505c 100644
--- a/plugins/kolab_delegation/kolab_delegation_engine.php
+++ b/plugins/kolab_delegation/kolab_delegation_engine.php
@@ -516,6 +516,21 @@ class kolab_delegation_engine
}
/**
+ * Returns current user identities
+ *
+ * @return array List of identities
+ */
+ public function user_identities()
+ {
+ // cache result in-memory, we need it more than once
+ if ($this->identities === null) {
+ $this->identities = $this->rc->user->list_identities();
+ }
+
+ return $this->identities;
+ }
+
+ /**
* Update LDAP record of current user
*
* @param array User data
@@ -559,7 +574,7 @@ class kolab_delegation_engine
$other_ns = $storage->get_namespace('other');
$folders = $storage->list_folders();
$use_subs = $this->rc->config->get('kolab_use_subscriptions');
- $identities = $this->rc->user->list_identities();
+ $identities = $this->user_identities();
$emails = array();
$uids = array();
@@ -693,7 +708,7 @@ class kolab_delegation_engine
return;
}
- $identities = $this->rc->user->list_identities();
+ $identities = $this->user_identities();
$emails = $_SESSION['delegators'][$context];
foreach ($identities as $ident) {
@@ -723,10 +738,10 @@ class kolab_delegation_engine
}
// return only user addresses (exclude all delegators addresses)
else if (!empty($_SESSION['delegators'])) {
- $identities = $this->rc->user->list_identities();
+ $identities = $this->user_identities();
$emails[] = $this->rc->user->get_username();
- foreach ($this->rc->user->list_identities() as $identity) {
+ foreach ($identities as $identity) {
$emails[] = $identity['email'];
}
More information about the commits
mailing list