]> source.dussan.org Git - nextcloud-server.git/commitdiff
Try to conserve some memory. Should fix oc-1106 for stable4.
authorThomas Tanghus <thomas@tanghus.net>
Mon, 25 Jun 2012 15:16:34 +0000 (17:16 +0200)
committerThomas Tanghus <thomas@tanghus.net>
Mon, 25 Jun 2012 15:16:34 +0000 (17:16 +0200)
apps/contacts/ajax/contacts.php
apps/contacts/index.php

index 37d396cd83a1bbca67fc83b6c8ad65e498b0026b..45c54f90bceb939f832de256c59b34fcb2474ecd 100644 (file)
@@ -11,7 +11,14 @@ OCP\JSON::checkLoggedIn();
 OCP\JSON::checkAppEnabled('contacts');
 
 $ids = OC_Contacts_Addressbook::activeIds(OCP\USER::getUser());
-$contacts = OC_Contacts_VCard::all($ids);
+$allcontacts = OC_Contacts_VCard::all($ids);
+$contacts = array();
+foreach($allcontacts as $contact) { // try to conserve some memory
+       $contacts[] = array('id' => $contact['id'], 'addressbookid' => $contact['addressbookid'], 'fullname' => $contact['fullname']);
+}
+unset($allcontacts);
+$addressbooks = OC_Contacts_Addressbook::active(OCP\USER::getUser());
+
 $tmpl = new OCP\Template("contacts", "part.contacts");
 $tmpl->assign('contacts', $contacts);
 $page = $tmpl->fetchPage();
index 74b7c43c556c19f53256c433170ad8fbbc5a18af..994539e9fce1a912137dced03cc43433a0315ef9 100644 (file)
@@ -14,8 +14,12 @@ OCP\App::checkAppEnabled('contacts');
 
 // Get active address books. This creates a default one if none exists.
 $ids = OC_Contacts_Addressbook::activeIds(OCP\USER::getUser());
-$contacts = OC_Contacts_VCard::all($ids);
-
+$allcontacts = OC_Contacts_VCard::all($ids);
+$contacts = array();
+foreach($allcontacts as $contact) { // try to conserve some memory
+       $contacts[] = array('id' => $contact['id'], 'addressbookid' => $contact['addressbookid'], 'fullname' => $contact['fullname']);
+}
+unset($allcontacts);
 $addressbooks = OC_Contacts_Addressbook::active(OCP\USER::getUser());
 
 // Load the files we need