diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-12-04 11:50:11 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-12-04 11:51:45 +0100 |
commit | 6af858c41b777e7324f0832bededdb4b99a8187c (patch) | |
tree | 5905509580ab521ba10d9c96d30e270a29601dd3 /apps | |
parent | af8bcb3a4d0496224fd1de6d0a6a8b19ff30e530 (diff) | |
download | nextcloud-server-6af858c41b777e7324f0832bededdb4b99a8187c.tar.gz nextcloud-server-6af858c41b777e7324f0832bededdb4b99a8187c.zip |
Delete no longer existing users from system addressbook
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dav/command/syncsystemaddressbook.php | 12 |
1 files changed, 12 insertions, 0 deletions
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(''); } |