@@ -119,9 +119,9 @@ discard block |
||
| 119 | 119 | $tCards = $tBooks = 0; |
| 120 | 120 | $knownBooks = []; |
| 121 | 121 | foreach ($users as $user) { |
| 122 | - $books = $this->cardDavBackend->getAddressBooksForUser('principals/users/' . $user->getUID()); |
|
| 122 | + $books = $this->cardDavBackend->getAddressBooksForUser('principals/users/'.$user->getUID()); |
|
| 123 | 123 | $output->writeln( |
| 124 | - '- User <info>' . $user->getUID() . '</info> have ' . sizeof($books) . ' address books:' |
|
| 124 | + '- User <info>'.$user->getUID().'</info> have '.sizeof($books).' address books:' |
|
| 125 | 125 | ); |
| 126 | 126 | |
| 127 | 127 | $tBooks += sizeof($books); |
@@ -137,11 +137,11 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | $shared = ''; |
| 139 | 139 | if ($owner !== $user->getUID()) { |
| 140 | - $shared = ' (shared by <info>' . $owner . '</info>)'; |
|
| 140 | + $shared = ' (shared by <info>'.$owner.'</info>)'; |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | $output->writeln( |
| 144 | - ' <comment>*</comment> book #' . $bookId . $shared . ' contains ' |
|
| 144 | + ' <comment>*</comment> book #'.$bookId.$shared.' contains ' |
|
| 145 | 145 | . sizeof($cards) |
| 146 | 146 | . ' entries' |
| 147 | 147 | ); |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | $output->writeln(''); |
| 154 | - $output->writeln('with a total of ' . $tBooks . ' address books and ' . $tCards . ' contact entries'); |
|
| 154 | + $output->writeln('with a total of '.$tBooks.' address books and '.$tCards.' contact entries'); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | public function onDeleteCard(GenericEvent $event) { |
| 159 | 159 | $davCard = $this->generateDavCard($event, true); |
| 160 | 160 | |
| 161 | - $this->miscService->log('Deleting Card: ' . json_encode($davCard), 1); |
|
| 161 | + $this->miscService->log('Deleting Card: '.json_encode($davCard), 1); |
|
| 162 | 162 | $this->membersRequest->removeMembersByContactId($davCard->getUniqueId(), Member::TYPE_USER); |
| 163 | 163 | $this->manageDeprecatedCircles($davCard->getAddressBookId()); |
| 164 | 164 | $this->manageDeprecatedMembers($davCard); |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | */ |
| 200 | 200 | private function generateDavCardFromCard(int $bookId, array $card): DavCard { |
| 201 | 201 | $this->miscService->log( |
| 202 | - 'generating DavCard Model from book=' . $bookId . ' from ' . json_encode($card), 0 |
|
| 202 | + 'generating DavCard Model from book='.$bookId.' from '.json_encode($card), 0 |
|
| 203 | 203 | ); |
| 204 | 204 | |
| 205 | 205 | $davCard = new DavCard(); |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $davCard->setOwner($this->getOwnerFromAddressBook($bookId)); |
| 210 | 210 | $davCard->importFromDav($card['carddata']); |
| 211 | 211 | |
| 212 | - $this->miscService->log('generated DavCard Model: ' . json_encode($davCard), 0); |
|
| 212 | + $this->miscService->log('generated DavCard Model: '.json_encode($davCard), 0); |
|
| 213 | 213 | |
| 214 | 214 | return $davCard; |
| 215 | 215 | } |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | * |
| 221 | 221 | */ |
| 222 | 222 | private function manageDavCard(DavCard $davCard) { |
| 223 | - $this->miscService->log('Updating Card: ' . json_encode($davCard), 1); |
|
| 223 | + $this->miscService->log('Updating Card: '.json_encode($davCard), 1); |
|
| 224 | 224 | $this->manageCircles($davCard); |
| 225 | 225 | $this->manageContact($davCard); |
| 226 | 226 | } |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | private function manageDeprecatedMembers(DavCard $davCard) { |
| 256 | 256 | $this->miscService->log( |
| 257 | - 'Managing deprecated circles memberships from DavCard Model: ' . json_encode($davCard), 0 |
|
| 257 | + 'Managing deprecated circles memberships from DavCard Model: '.json_encode($davCard), 0 |
|
| 258 | 258 | ); |
| 259 | 259 | |
| 260 | 260 | $circles = array_map( |
@@ -265,13 +265,13 @@ discard block |
||
| 265 | 265 | |
| 266 | 266 | $members = $this->membersRequest->getMembersByContactId($davCard->getUniqueId()); |
| 267 | 267 | $this->miscService->log( |
| 268 | - 'Found ' . sizeof($members) . ' memberships with contactId=' . $davCard->getUniqueId(), 0 |
|
| 268 | + 'Found '.sizeof($members).' memberships with contactId='.$davCard->getUniqueId(), 0 |
|
| 269 | 269 | ); |
| 270 | 270 | |
| 271 | 271 | foreach ($members as $member) { |
| 272 | 272 | if (!in_array($member->getCircleId(), $circles)) { |
| 273 | 273 | $this->miscService->log( |
| 274 | - 'Removing membership ' . $member->getMemberId() . ' from ' . $member->getCircleId(), 0 |
|
| 274 | + 'Removing membership '.$member->getMemberId().' from '.$member->getCircleId(), 0 |
|
| 275 | 275 | ); |
| 276 | 276 | $this->membersRequest->removeMember($member); |
| 277 | 277 | } |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | } |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | - $davCard->setUserId($davCard->getOwner() . ':' . $davCard->getContactId()); |
|
| 353 | + $davCard->setUserId($davCard->getOwner().':'.$davCard->getContactId()); |
|
| 354 | 354 | |
| 355 | 355 | return DavCard::TYPE_CONTACT; |
| 356 | 356 | } |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | ); |
| 396 | 396 | |
| 397 | 397 | $this->miscService->log( |
| 398 | - 'manage Circles from DavCard: ' . json_encode($fromCard) . ' - current: ' . json_encode($current) |
|
| 398 | + 'manage Circles from DavCard: '.json_encode($fromCard).' - current: '.json_encode($current) |
|
| 399 | 399 | ); |
| 400 | 400 | |
| 401 | 401 | $this->manageNewCircles($davCard, $fromCard, $current); |
@@ -418,13 +418,13 @@ discard block |
||
| 418 | 418 | |
| 419 | 419 | $user = $this->userManager->get($davCard->getOwner()); |
| 420 | 420 | $circle = new Circle( |
| 421 | - $this->configService->contactsBackendType(), $group . ' - ' . $user->getDisplayName() |
|
| 421 | + $this->configService->contactsBackendType(), $group.' - '.$user->getDisplayName() |
|
| 422 | 422 | ); |
| 423 | 423 | $circle->setContactAddressBook($davCard->getAddressBookId()); |
| 424 | 424 | $circle->setContactGroupName($group); |
| 425 | 425 | |
| 426 | 426 | $this->miscService->log( |
| 427 | - 'creating new Circle: ' . json_encode($circle) . ', with owner=' . $davCard->getOwner(), 0 |
|
| 427 | + 'creating new Circle: '.json_encode($circle).', with owner='.$davCard->getOwner(), 0 |
|
| 428 | 428 | ); |
| 429 | 429 | try { |
| 430 | 430 | $this->circlesRequest->createCircle($circle, $davCard->getOwner()); |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | $member->setLevel(Member::LEVEL_OWNER); |
| 433 | 433 | $member->setStatus(Member::STATUS_MEMBER); |
| 434 | 434 | |
| 435 | - $this->miscService->log('creating new Member: ' . json_encode($member), 0); |
|
| 435 | + $this->miscService->log('creating new Member: '.json_encode($member), 0); |
|
| 436 | 436 | try { |
| 437 | 437 | $this->membersRequest->createMember($member); |
| 438 | 438 | } catch (MemberAlreadyExistsException $e) { |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | * @param DavCard $davCard |
| 448 | 448 | */ |
| 449 | 449 | private function assignCirclesToCard(DavCard $davCard) { |
| 450 | - $this->miscService->log('assigning Circles to DavCard Model: ' . json_encode($davCard), 0); |
|
| 450 | + $this->miscService->log('assigning Circles to DavCard Model: '.json_encode($davCard), 0); |
|
| 451 | 451 | foreach ($davCard->getGroups() as $group) { |
| 452 | 452 | try { |
| 453 | 453 | $davCard->addCircle( |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | } |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | - $this->miscService->log('assigned Circles to DavCard Model: ' . json_encode($davCard), 0); |
|
| 460 | + $this->miscService->log('assigned Circles to DavCard Model: '.json_encode($davCard), 0); |
|
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | |
@@ -502,12 +502,12 @@ discard block |
||
| 502 | 502 | * @return string |
| 503 | 503 | */ |
| 504 | 504 | public function getOwnerFromAddressBook(int $bookId): string { |
| 505 | - $this->miscService->log('Retrieving Owner from book:' . $bookId, 0); |
|
| 505 | + $this->miscService->log('Retrieving Owner from book:'.$bookId, 0); |
|
| 506 | 506 | $data = $this->cardDavBackend->getAddressBookById($bookId); |
| 507 | 507 | |
| 508 | 508 | // let's assume the format is principals/users/OWNER |
| 509 | 509 | $owner = substr($data['principaluri'], 17); |
| 510 | - $this->miscService->log('Retrieved Owner:' . $owner, 0); |
|
| 510 | + $this->miscService->log('Retrieved Owner:'.$owner, 0); |
|
| 511 | 511 | |
| 512 | 512 | return $owner; |
| 513 | 513 | } |
@@ -524,12 +524,12 @@ discard block |
||
| 524 | 524 | $this->manageDeprecatedContacts(); |
| 525 | 525 | $this->manageDeprecatedCircles(); |
| 526 | 526 | $users = $this->userManager->search(''); |
| 527 | - $this->miscService->log('initiating migration for ' . sizeof($users) . ' users', 0); |
|
| 527 | + $this->miscService->log('initiating migration for '.sizeof($users).' users', 0); |
|
| 528 | 528 | foreach ($users as $user) { |
| 529 | - $this->miscService->log('retrieving books for user=' . $user->getUID(), 0); |
|
| 530 | - $books = $this->cardDavBackend->getAddressBooksForUser('principals/users/' . $user->getUID()); |
|
| 529 | + $this->miscService->log('retrieving books for user='.$user->getUID(), 0); |
|
| 530 | + $books = $this->cardDavBackend->getAddressBooksForUser('principals/users/'.$user->getUID()); |
|
| 531 | 531 | |
| 532 | - $this->miscService->log('initiating migration for user=' . $user->getUID(), 0); |
|
| 532 | + $this->miscService->log('initiating migration for user='.$user->getUID(), 0); |
|
| 533 | 533 | foreach ($books as $book) { |
| 534 | 534 | $this->migrateBook($book['id']); |
| 535 | 535 | } |
@@ -542,16 +542,16 @@ discard block |
||
| 542 | 542 | private function manageDeprecatedContacts() { |
| 543 | 543 | $contacts = $this->membersRequest->getMembersByContactId(); |
| 544 | 544 | $this->miscService->log( |
| 545 | - 'Managing Deprecated Contacts, checking ' . sizeof($contacts) . ' known contacts in database', 0 |
|
| 545 | + 'Managing Deprecated Contacts, checking '.sizeof($contacts).' known contacts in database', 0 |
|
| 546 | 546 | ); |
| 547 | 547 | |
| 548 | 548 | foreach ($contacts as $contact) { |
| 549 | 549 | try { |
| 550 | 550 | $this->getDavCardFromMember($contact); |
| 551 | - $this->miscService->log('Contact is not deprecated: ' . json_encode($contact)); |
|
| 551 | + $this->miscService->log('Contact is not deprecated: '.json_encode($contact)); |
|
| 552 | 552 | } catch (MemberDoesNotExistException $e) { |
| 553 | 553 | $this->miscService->log( |
| 554 | - 'Contact is deprecated and will be removed: ' . json_encode($contact) |
|
| 554 | + 'Contact is deprecated and will be removed: '.json_encode($contact) |
|
| 555 | 555 | ); |
| 556 | 556 | $this->membersRequest->removeMember($contact); |
| 557 | 557 | } |
@@ -566,12 +566,12 @@ discard block |
||
| 566 | 566 | */ |
| 567 | 567 | private function manageDeprecatedCircles(int $bookId = 0) { |
| 568 | 568 | $knownBooks = [$bookId]; |
| 569 | - $this->miscService->log('Managing Deprecated Circles, using bookId: ' . $bookId, 0); |
|
| 569 | + $this->miscService->log('Managing Deprecated Circles, using bookId: '.$bookId, 0); |
|
| 570 | 570 | |
| 571 | 571 | if ($bookId > 0) { |
| 572 | 572 | $knownBooks = []; |
| 573 | 573 | $contacts = $this->membersRequest->getMembersByContactId(); |
| 574 | - $this->miscService->log(sizeof($contacts) . ' known members as contacts in Circles DB', 0); |
|
| 574 | + $this->miscService->log(sizeof($contacts).' known members as contacts in Circles DB', 0); |
|
| 575 | 575 | |
| 576 | 576 | foreach ($contacts as $contact) { |
| 577 | 577 | list($bookId,) = explode('/', $contact->getContactId(), 2); |
@@ -583,17 +583,17 @@ discard block |
||
| 583 | 583 | } |
| 584 | 584 | } |
| 585 | 585 | |
| 586 | - $this->miscService->log('Known books: ' . json_encode($knownBooks), 0); |
|
| 586 | + $this->miscService->log('Known books: '.json_encode($knownBooks), 0); |
|
| 587 | 587 | foreach ($knownBooks as $bookId) { |
| 588 | - $this->miscService->log('retrieving local Circles data for bookId=' . $bookId, 0); |
|
| 588 | + $this->miscService->log('retrieving local Circles data for bookId='.$bookId, 0); |
|
| 589 | 589 | $circles = $this->circlesRequest->getFromContactBook($bookId); |
| 590 | 590 | $this->miscService->log( |
| 591 | - 'Known circles for bookId=' . $bookId . ': ' . json_encode($circles), 0 |
|
| 591 | + 'Known circles for bookId='.$bookId.': '.json_encode($circles), 0 |
|
| 592 | 592 | ); |
| 593 | 593 | |
| 594 | 594 | $fromBook = $this->getExistingCirclesFromBook($bookId); |
| 595 | 595 | $this->miscService->log( |
| 596 | - 'Generated circles from bookId=' . $bookId . ': ' . json_encode($fromBook), 0 |
|
| 596 | + 'Generated circles from bookId='.$bookId.': '.json_encode($fromBook), 0 |
|
| 597 | 597 | ); |
| 598 | 598 | |
| 599 | 599 | foreach ($circles as $circle) { |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | $this->miscService->log( |
| 605 | - $circle->getUniqueId() . ' is a deprecated Circle and will be destroyed', 0 |
|
| 605 | + $circle->getUniqueId().' is a deprecated Circle and will be destroyed', 0 |
|
| 606 | 606 | ); |
| 607 | 607 | |
| 608 | 608 | $this->membersRequest->removeAllFromCircle($circle->getUniqueId()); |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | $cards = $this->cardDavBackend->getCards($bookId); |
| 625 | 625 | |
| 626 | 626 | $this->miscService->log( |
| 627 | - 'retrieving existing circles from bookId=' . $bookId . ' in ' . sizeof($cards) . ' cards', 0 |
|
| 627 | + 'retrieving existing circles from bookId='.$bookId.' in '.sizeof($cards).' cards', 0 |
|
| 628 | 628 | ); |
| 629 | 629 | foreach ($cards as $card) { |
| 630 | 630 | $davCard = $this->generateDavCardFromCard($bookId, $card); |
@@ -632,7 +632,7 @@ discard block |
||
| 632 | 632 | $circles = array_merge($circles, $davCard->getCircles()); |
| 633 | 633 | } |
| 634 | 634 | |
| 635 | - $this->miscService->log('Found ' . sizeof($circles) . ' Circles from book=' . $bookId, 0); |
|
| 635 | + $this->miscService->log('Found '.sizeof($circles).' Circles from book='.$bookId, 0); |
|
| 636 | 636 | $existing = array_unique( |
| 637 | 637 | array_map( |
| 638 | 638 | function(Circle $circle) { |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | ); |
| 643 | 643 | |
| 644 | 644 | $this->miscService->log( |
| 645 | - 'retrieved existing circles from book=' . $bookId . ': ' . json_encode($existing), 0 |
|
| 645 | + 'retrieved existing circles from book='.$bookId.': '.json_encode($existing), 0 |
|
| 646 | 646 | ); |
| 647 | 647 | |
| 648 | 648 | return $existing; |
@@ -657,14 +657,14 @@ discard block |
||
| 657 | 657 | */ |
| 658 | 658 | public function getDavCardFromMember(Member $contact): DavCard { |
| 659 | 659 | list($bookId, $cardUri) = explode('/', $contact->getContactId(), 2); |
| 660 | - $this->miscService->log('Retrieving DavCard from book:' . $bookId . ', uri:' . $cardUri, 0); |
|
| 660 | + $this->miscService->log('Retrieving DavCard from book:'.$bookId.', uri:'.$cardUri, 0); |
|
| 661 | 661 | |
| 662 | 662 | $cards = $this->cardDavBackend->getCards($bookId); |
| 663 | - $this->miscService->log('Book contains ' . sizeof($cards) . ' cards', 0); |
|
| 663 | + $this->miscService->log('Book contains '.sizeof($cards).' cards', 0); |
|
| 664 | 664 | foreach ($cards as $card) { |
| 665 | 665 | if ($card['uri'] === $cardUri) { |
| 666 | 666 | $davCard = $this->generateDavCardFromCard($bookId, $card); |
| 667 | - $this->miscService->log('Retrieved DavCard: ' . json_encode($card)); |
|
| 667 | + $this->miscService->log('Retrieved DavCard: '.json_encode($card)); |
|
| 668 | 668 | |
| 669 | 669 | return $davCard; |
| 670 | 670 | } |
@@ -682,11 +682,11 @@ discard block |
||
| 682 | 682 | return; |
| 683 | 683 | } |
| 684 | 684 | |
| 685 | - $this->miscService->log('migrating book: ' . $bookId, 0); |
|
| 685 | + $this->miscService->log('migrating book: '.$bookId, 0); |
|
| 686 | 686 | $owner = $this->getOwnerFromAddressBook($bookId); |
| 687 | 687 | |
| 688 | 688 | $cards = $this->cardDavBackend->getCards($bookId); |
| 689 | - $this->miscService->log('found ' . sizeof($cards) . 'cards from book=' . $bookId, 0); |
|
| 689 | + $this->miscService->log('found '.sizeof($cards).'cards from book='.$bookId, 0); |
|
| 690 | 690 | |
| 691 | 691 | foreach ($cards as $card) { |
| 692 | 692 | $davCard = new DavCard(); |