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

This commit is contained in:
Ralf Becker 2009-03-05 15:17:45 +00:00
parent ca46d97abd
commit dd41d422e9

View File

@ -379,13 +379,16 @@ class accounts_sql
} }
} }
$criteria[] = "egw_addressbook.account_id is not null "; $criteria[] = "egw_addressbook.account_id is not null ";
$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'],