From dea7e46a2d4bfa5006ce767d0658d9b3fe40f23f Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 16 Jul 2012 12:27:01 +0000 Subject: [PATCH] accounts_sql::members() 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 0175437b34..7462b9c348 100644 --- a/phpgwapi/inc/class.accounts_sql.inc.php +++ b/phpgwapi/inc/class.accounts_sql.inc.php @@ -274,14 +274,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, + 'JOIN '.acl::TABLE.' ON account_id=acl_owner' + ) as $row) { - $members[$uid] = $this->id2name($uid); + $members[$row['account_id']] = $row['account_lid']; } //echo "accounts::members($accountid)"; _debug_array($members); return $members;