From 296ad60cb04621b80babe181282935e47528ae9d Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 17 Jul 2012 14:08:40 +0000 Subject: [PATCH] use single sql query with join to acl table instead calling id2name for each account, as it is quicker and uses less memory --- phpgwapi/inc/class.accounts_sql.inc.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/phpgwapi/inc/class.accounts_sql.inc.php b/phpgwapi/inc/class.accounts_sql.inc.php index bf7a9a832b..bbb88be291 100644 --- a/phpgwapi/inc/class.accounts_sql.inc.php +++ b/phpgwapi/inc/class.accounts_sql.inc.php @@ -273,14 +273,18 @@ class accounts_sql */ function members($account_id) { - if (!($uids = $GLOBALS['egw']->acl->get_ids_for_location($account_id, 1, 'phpgw_group'))) - { - return array(); - } + if (!is_numeric($account_id)) $account_id = $this-name2id($account_id); + $members = array(); - foreach ($uids as $uid) + foreach($this->db->select($this->table, 'account_id,account_lid', + $this->db->expression(acl::TABLE, array( + 'acl_appname' => 'phpgw_group', + 'acl_location' => $account_id, + )), __LINE__, __FILE__, false, '', false, 0, + 'JOIN '.acl::TABLE.' ON account_id=acl_account' + ) as $row) { - $members[$uid] = $this->id2name($uid); + $members[$row['account_id']] = $row['account_lid']; } //echo "accounts::members($accountid)"; _debug_array($members); return $members;