summaryrefslogtreecommitdiffstats
path: root/apps/contacts/lib/app.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/contacts/lib/app.php')
-rw-r--r--apps/contacts/lib/app.php29
1 files changed, 16 insertions, 13 deletions
diff --git a/apps/contacts/lib/app.php b/apps/contacts/lib/app.php
index 25461877e62..689149367fa 100644
--- a/apps/contacts/lib/app.php
+++ b/apps/contacts/lib/app.php
@@ -41,7 +41,7 @@ class OC_Contacts_App {
$card = OC_Contacts_VCard::find( $id );
if( $card === false ) {
OCP\Util::writeLog('contacts', 'Contact could not be found: '.$id, OCP\Util::ERROR);
- OCP\JSON::error(array('data' => array( 'message' => self::$l10n->t('Contact could not be found.').' '.$id)));
+ OCP\JSON::error(array('data' => array( 'message' => self::$l10n->t('Contact could not be found.').' '.print_r($id, true))));
exit();
}
@@ -61,11 +61,11 @@ class OC_Contacts_App {
if(!is_null($vcard) && !$vcard->__isset('N')) {
$version = OCP\App::getAppVersion('contacts');
if($version >= 5) {
- OCP\Util::writeLog('contacts','OC_Contacts_App::getContactVCard. Deprecated check for missing N field', OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', 'OC_Contacts_App::getContactVCard. Deprecated check for missing N field', OCP\Util::DEBUG);
}
- OCP\Util::writeLog('contacts','getContactVCard, Missing N field', OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', 'getContactVCard, Missing N field', OCP\Util::DEBUG);
if($vcard->__isset('FN')) {
- OCP\Util::writeLog('contacts','getContactVCard, found FN field: '.$vcard->__get('FN'), OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', 'getContactVCard, found FN field: '.$vcard->__get('FN'), OCP\Util::DEBUG);
$n = implode(';', array_reverse(array_slice(explode(' ', $vcard->__get('FN')), 0, 2))).';;;';
$vcard->setString('N', $n);
OC_Contacts_VCard::edit( $id, $vcard);
@@ -196,16 +196,19 @@ class OC_Contacts_App {
foreach($vcaddressbooks as $vcaddressbook) {
$vcaddressbookids[] = $vcaddressbook['id'];
}
- $vccontacts = OC_Contacts_VCard::all($vcaddressbookids);
- }
- }
- if(is_array($vccontacts) && count($vccontacts) > 0) {
- $cards = array();
- foreach($vccontacts as $vccontact) {
- $cards[] = $vccontact['carddata'];
+ $start = 0;
+ $batchsize = 10;
+ while($vccontacts = OC_Contacts_VCard::all($vcaddressbookids, $start, $batchsize)){
+ $cards = array();
+ foreach($vccontacts as $vccontact) {
+ $cards[] = $vccontact['carddata'];
+ }
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', scanning: '.$batchsize.' starting from '.$start, OCP\Util::DEBUG);
+ // only reset on first batch.
+ self::getVCategories()->rescan($cards, true, ($start == 0 ? true : false));
+ $start += $batchsize;
+ }
}
-
- self::$categories->rescan($cards);
}
}