lib/api
Aleksander Machniak
machniak at kolabsys.com
Mon Jul 8 13:07:35 CEST 2013
lib/api/kolab_api_service_form_value.php | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
New commits:
commit 29f14098a767477f7a483a094aed1926816dfc89
Author: Aleksander Machniak <alec at alec.pl>
Date: Mon Jul 8 13:05:57 2013 +0200
Performance improvement: skip groups_list() call if members list from
users_list() already contains enough records (=page_size).
diff --git a/lib/api/kolab_api_service_form_value.php b/lib/api/kolab_api_service_form_value.php
index 707fddb..26c1ed7 100644
--- a/lib/api/kolab_api_service_form_value.php
+++ b/lib/api/kolab_api_service_form_value.php
@@ -1202,14 +1202,16 @@ class kolab_api_service_form_value extends kolab_api_service
$service = $this->controller->get_service('users');
$result = $service->users_list(null, $data);
-
$list = $result['list'];
- $data['attributes'] = array('cn', 'mail');
+ // skip groups listing if the list if already full
+ if ($result['count'] < $data['page_size']) {
+ $data['attributes'] = array('cn', 'mail');
- $service = $this->controller->get_service('groups');
- $result = $service->groups_list(null, $data);
- $list = array_merge($list, $result['list']);
+ $service = $this->controller->get_service('groups');
+ $result = $service->groups_list(null, $data);
+ $list = array_merge($list, $result['list']);
+ }
// convert to key=>value array
foreach ($list as $idx => $value) {
More information about the commits
mailing list