Merge pull request #20947 from owncloud/delete-users-from-system-addressbook

Delete no longer existing users from system addressbook
This commit is contained in:
Thomas Müller 2015-12-04 13:44:40 +01:00
commit 98bb8372f7
1 changed files with 12 additions and 0 deletions

View File

@ -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('');
}