summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-12-04 13:44:40 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-12-04 13:44:40 +0100
commit98bb8372f7f0ab1f669cdd92d439814e1b6aaa1a (patch)
treefe55e5155901cc5f0efa1fde936647804e93b9a4
parent5750a85e84c09dbb759ff2c1f0e60b1f047acca6 (diff)
parent6af858c41b777e7324f0832bededdb4b99a8187c (diff)
downloadnextcloud-server-98bb8372f7f0ab1f669cdd92d439814e1b6aaa1a.tar.gz
nextcloud-server-98bb8372f7f0ab1f669cdd92d439814e1b6aaa1a.zip
Merge pull request #20947 from owncloud/delete-users-from-system-addressbook
Delete no longer existing users from system addressbook
-rw-r--r--apps/dav/command/syncsystemaddressbook.php12
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('');
}