From: Thomas Müller Date: Fri, 4 Dec 2015 10:50:11 +0000 (+0100) Subject: Delete no longer existing users from system addressbook X-Git-Tag: v9.0beta1~579^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6af858c41b777e7324f0832bededdb4b99a8187c;p=nextcloud-server.git Delete no longer existing users from system addressbook --- diff --git a/apps/dav/command/syncsystemaddressbook.php b/apps/dav/command/syncsystemaddressbook.php index bb2896abc60..162ab362892 100644 --- a/apps/dav/command/syncsystemaddressbook.php +++ b/apps/dav/command/syncsystemaddressbook.php @@ -88,6 +88,18 @@ class SyncSystemAddressBook extends Command { } $progress->advance(); }); + + // remove no longer existing + $allCards = $this->backend->getCards($systemAddressBook['id']); + foreach($allCards as $card) { + $vCard = Reader::read($card['carddata']); + $uid = $vCard->UID->getValue(); + // load backend and see if user exists + if (!$this->userManager->userExists($uid)) { + $this->backend->deleteCard($systemAddressBook['id'], $card['uri']); + } + } + $progress->finish(); $output->writeln(''); }