Delete no longer existing users from system addressbook

This commit is contained in:
Thomas Müller 2015-12-04 11:50:11 +01:00
parent af8bcb3a4d
commit 6af858c41b

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