"fixing high minimize memory usage (important for huge number of accounts)"

This commit is contained in:
Ralf Becker 2009-03-05 15:20:34 +00:00
parent 26555a065c
commit a9830b0650

View File

@ -378,13 +378,16 @@ class accounts_sql
break; break;
} }
} }
$accounts = array();
if (!is_object($GLOBALS['egw']->contacts)) throw new exception('No $GLOBALS[egw]->contacts!'); if (!is_object($GLOBALS['egw']->contacts)) throw new exception('No $GLOBALS[egw]->contacts!');
if (($contacts =& $GLOBALS['egw']->contacts->search($criteria,false,$order,"account_lid,account_type,account_status,$this->table.account_id",
$accounts = array();
foreach((array) $GLOBALS['egw']->contacts->search($criteria,"1,n_given,n_family,email,id,created,modified,$this->table.account_id AS account_id",
$order,"account_lid,account_type,account_status",
$wildcard,false,'OR',$offset ? array($start,$offset) : is_null($start) ? false : $start, $wildcard,false,'OR',$offset ? array($start,$offset) : is_null($start) ? false : $start,
$filter,$this->contacts_join))) $filter,$this->contacts_join) as $contact)
{ {
foreach($contacts as $contact) if ($contact)
{ {
$accounts[] = array( $accounts[] = array(
'account_id' => ($contact['account_type'] == 'g' ? -1 : 1) * $contact['account_id'], 'account_id' => ($contact['account_type'] == 'g' ? -1 : 1) * $contact['account_id'],