@@ -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,14 +418,14 @@ 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->setAltName($group); |
| 424 | 424 | $circle->setContactAddressBook($davCard->getAddressBookId()); |
| 425 | 425 | $circle->setContactGroupName($group); |
| 426 | 426 | |
| 427 | 427 | $this->miscService->log( |
| 428 | - 'creating new Circle: ' . json_encode($circle) . ', with owner=' . $davCard->getOwner(), 0 |
|
| 428 | + 'creating new Circle: '.json_encode($circle).', with owner='.$davCard->getOwner(), 0 |
|
| 429 | 429 | ); |
| 430 | 430 | try { |
| 431 | 431 | $this->circlesRequest->createCircle($circle); |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | $member->setLevel(Member::LEVEL_OWNER); |
| 434 | 434 | $member->setStatus(Member::STATUS_MEMBER); |
| 435 | 435 | |
| 436 | - $this->miscService->log('creating new Member: ' . json_encode($member), 0); |
|
| 436 | + $this->miscService->log('creating new Member: '.json_encode($member), 0); |
|
| 437 | 437 | try { |
| 438 | 438 | $this->membersRequest->createMember($member); |
| 439 | 439 | } catch (MemberAlreadyExistsException $e) { |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | * @param DavCard $davCard |
| 449 | 449 | */ |
| 450 | 450 | private function assignCirclesToCard(DavCard $davCard) { |
| 451 | - $this->miscService->log('assigning Circles to DavCard Model: ' . json_encode($davCard), 0); |
|
| 451 | + $this->miscService->log('assigning Circles to DavCard Model: '.json_encode($davCard), 0); |
|
| 452 | 452 | foreach ($davCard->getGroups() as $group) { |
| 453 | 453 | try { |
| 454 | 454 | $davCard->addCircle( |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | } |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | - $this->miscService->log('assigned Circles to DavCard Model: ' . json_encode($davCard), 0); |
|
| 461 | + $this->miscService->log('assigned Circles to DavCard Model: '.json_encode($davCard), 0); |
|
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | |
@@ -503,12 +503,12 @@ discard block |
||
| 503 | 503 | * @return string |
| 504 | 504 | */ |
| 505 | 505 | public function getOwnerFromAddressBook(int $bookId): string { |
| 506 | - $this->miscService->log('Retrieving Owner from book:' . $bookId, 0); |
|
| 506 | + $this->miscService->log('Retrieving Owner from book:'.$bookId, 0); |
|
| 507 | 507 | $data = $this->cardDavBackend->getAddressBookById($bookId); |
| 508 | 508 | |
| 509 | 509 | // let's assume the format is principals/users/OWNER |
| 510 | 510 | $owner = substr($data['principaluri'], 17); |
| 511 | - $this->miscService->log('Retrieved Owner:' . $owner, 0); |
|
| 511 | + $this->miscService->log('Retrieved Owner:'.$owner, 0); |
|
| 512 | 512 | |
| 513 | 513 | return $owner; |
| 514 | 514 | } |
@@ -525,12 +525,12 @@ discard block |
||
| 525 | 525 | $this->manageDeprecatedContacts(); |
| 526 | 526 | $this->manageDeprecatedCircles(); |
| 527 | 527 | $users = $this->userManager->search(''); |
| 528 | - $this->miscService->log('initiating migration for ' . sizeof($users) . ' users', 0); |
|
| 528 | + $this->miscService->log('initiating migration for '.sizeof($users).' users', 0); |
|
| 529 | 529 | foreach ($users as $user) { |
| 530 | - $this->miscService->log('retrieving books for user=' . $user->getUID(), 0); |
|
| 531 | - $books = $this->cardDavBackend->getAddressBooksForUser('principals/users/' . $user->getUID()); |
|
| 530 | + $this->miscService->log('retrieving books for user='.$user->getUID(), 0); |
|
| 531 | + $books = $this->cardDavBackend->getAddressBooksForUser('principals/users/'.$user->getUID()); |
|
| 532 | 532 | |
| 533 | - $this->miscService->log('initiating migration for user=' . $user->getUID(), 0); |
|
| 533 | + $this->miscService->log('initiating migration for user='.$user->getUID(), 0); |
|
| 534 | 534 | foreach ($books as $book) { |
| 535 | 535 | $this->migrateBook($book['id']); |
| 536 | 536 | } |
@@ -543,16 +543,16 @@ discard block |
||
| 543 | 543 | private function manageDeprecatedContacts() { |
| 544 | 544 | $contacts = $this->membersRequest->getMembersByContactId(); |
| 545 | 545 | $this->miscService->log( |
| 546 | - 'Managing Deprecated Contacts, checking ' . sizeof($contacts) . ' known contacts in database', 0 |
|
| 546 | + 'Managing Deprecated Contacts, checking '.sizeof($contacts).' known contacts in database', 0 |
|
| 547 | 547 | ); |
| 548 | 548 | |
| 549 | 549 | foreach ($contacts as $contact) { |
| 550 | 550 | try { |
| 551 | 551 | $this->getDavCardFromMember($contact); |
| 552 | - $this->miscService->log('Contact is not deprecated: ' . json_encode($contact)); |
|
| 552 | + $this->miscService->log('Contact is not deprecated: '.json_encode($contact)); |
|
| 553 | 553 | } catch (MemberDoesNotExistException $e) { |
| 554 | 554 | $this->miscService->log( |
| 555 | - 'Contact is deprecated and will be removed: ' . json_encode($contact) |
|
| 555 | + 'Contact is deprecated and will be removed: '.json_encode($contact) |
|
| 556 | 556 | ); |
| 557 | 557 | $this->membersRequest->removeMember($contact); |
| 558 | 558 | } |
@@ -567,12 +567,12 @@ discard block |
||
| 567 | 567 | */ |
| 568 | 568 | private function manageDeprecatedCircles(int $bookId = 0) { |
| 569 | 569 | $knownBooks = [$bookId]; |
| 570 | - $this->miscService->log('Managing Deprecated Circles, using bookId: ' . $bookId, 0); |
|
| 570 | + $this->miscService->log('Managing Deprecated Circles, using bookId: '.$bookId, 0); |
|
| 571 | 571 | |
| 572 | 572 | if ($bookId > 0) { |
| 573 | 573 | $knownBooks = []; |
| 574 | 574 | $contacts = $this->membersRequest->getMembersByContactId(); |
| 575 | - $this->miscService->log(sizeof($contacts) . ' known members as contacts in Circles DB', 0); |
|
| 575 | + $this->miscService->log(sizeof($contacts).' known members as contacts in Circles DB', 0); |
|
| 576 | 576 | |
| 577 | 577 | foreach ($contacts as $contact) { |
| 578 | 578 | list($bookId,) = explode('/', $contact->getContactId(), 2); |
@@ -584,17 +584,17 @@ discard block |
||
| 584 | 584 | } |
| 585 | 585 | } |
| 586 | 586 | |
| 587 | - $this->miscService->log('Known books: ' . json_encode($knownBooks), 0); |
|
| 587 | + $this->miscService->log('Known books: '.json_encode($knownBooks), 0); |
|
| 588 | 588 | foreach ($knownBooks as $bookId) { |
| 589 | - $this->miscService->log('retrieving local Circles data for bookId=' . $bookId, 0); |
|
| 589 | + $this->miscService->log('retrieving local Circles data for bookId='.$bookId, 0); |
|
| 590 | 590 | $circles = $this->circlesRequest->getFromContactBook($bookId); |
| 591 | 591 | $this->miscService->log( |
| 592 | - 'Known circles for bookId=' . $bookId . ': ' . json_encode($circles), 0 |
|
| 592 | + 'Known circles for bookId='.$bookId.': '.json_encode($circles), 0 |
|
| 593 | 593 | ); |
| 594 | 594 | |
| 595 | 595 | $fromBook = $this->getExistingCirclesFromBook($bookId); |
| 596 | 596 | $this->miscService->log( |
| 597 | - 'Generated circles from bookId=' . $bookId . ': ' . json_encode($fromBook), 0 |
|
| 597 | + 'Generated circles from bookId='.$bookId.': '.json_encode($fromBook), 0 |
|
| 598 | 598 | ); |
| 599 | 599 | |
| 600 | 600 | foreach ($circles as $circle) { |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | $this->miscService->log( |
| 606 | - $circle->getUniqueId() . ' is a deprecated Circle and will be destroyed', 0 |
|
| 606 | + $circle->getUniqueId().' is a deprecated Circle and will be destroyed', 0 |
|
| 607 | 607 | ); |
| 608 | 608 | |
| 609 | 609 | $this->membersRequest->removeAllFromCircle($circle->getUniqueId()); |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | $cards = $this->cardDavBackend->getCards($bookId); |
| 626 | 626 | |
| 627 | 627 | $this->miscService->log( |
| 628 | - 'retrieving existing circles from bookId=' . $bookId . ' in ' . sizeof($cards) . ' cards', 0 |
|
| 628 | + 'retrieving existing circles from bookId='.$bookId.' in '.sizeof($cards).' cards', 0 |
|
| 629 | 629 | ); |
| 630 | 630 | foreach ($cards as $card) { |
| 631 | 631 | $davCard = $this->generateDavCardFromCard($bookId, $card); |
@@ -633,7 +633,7 @@ discard block |
||
| 633 | 633 | $circles = array_merge($circles, $davCard->getCircles()); |
| 634 | 634 | } |
| 635 | 635 | |
| 636 | - $this->miscService->log('Found ' . sizeof($circles) . ' Circles from book=' . $bookId, 0); |
|
| 636 | + $this->miscService->log('Found '.sizeof($circles).' Circles from book='.$bookId, 0); |
|
| 637 | 637 | $existing = array_unique( |
| 638 | 638 | array_map( |
| 639 | 639 | function(Circle $circle) { |
@@ -643,7 +643,7 @@ discard block |
||
| 643 | 643 | ); |
| 644 | 644 | |
| 645 | 645 | $this->miscService->log( |
| 646 | - 'retrieved existing circles from book=' . $bookId . ': ' . json_encode($existing), 0 |
|
| 646 | + 'retrieved existing circles from book='.$bookId.': '.json_encode($existing), 0 |
|
| 647 | 647 | ); |
| 648 | 648 | |
| 649 | 649 | return $existing; |
@@ -658,14 +658,14 @@ discard block |
||
| 658 | 658 | */ |
| 659 | 659 | public function getDavCardFromMember(Member $contact): DavCard { |
| 660 | 660 | list($bookId, $cardUri) = explode('/', $contact->getContactId(), 2); |
| 661 | - $this->miscService->log('Retrieving DavCard from book:' . $bookId . ', uri:' . $cardUri, 0); |
|
| 661 | + $this->miscService->log('Retrieving DavCard from book:'.$bookId.', uri:'.$cardUri, 0); |
|
| 662 | 662 | |
| 663 | 663 | $cards = $this->cardDavBackend->getCards($bookId); |
| 664 | - $this->miscService->log('Book contains ' . sizeof($cards) . ' cards', 0); |
|
| 664 | + $this->miscService->log('Book contains '.sizeof($cards).' cards', 0); |
|
| 665 | 665 | foreach ($cards as $card) { |
| 666 | 666 | if ($card['uri'] === $cardUri) { |
| 667 | 667 | $davCard = $this->generateDavCardFromCard($bookId, $card); |
| 668 | - $this->miscService->log('Retrieved DavCard: ' . json_encode($card)); |
|
| 668 | + $this->miscService->log('Retrieved DavCard: '.json_encode($card)); |
|
| 669 | 669 | |
| 670 | 670 | return $davCard; |
| 671 | 671 | } |
@@ -683,11 +683,11 @@ discard block |
||
| 683 | 683 | return; |
| 684 | 684 | } |
| 685 | 685 | |
| 686 | - $this->miscService->log('migrating book: ' . $bookId, 0); |
|
| 686 | + $this->miscService->log('migrating book: '.$bookId, 0); |
|
| 687 | 687 | $owner = $this->getOwnerFromAddressBook($bookId); |
| 688 | 688 | |
| 689 | 689 | $cards = $this->cardDavBackend->getCards($bookId); |
| 690 | - $this->miscService->log('found ' . sizeof($cards) . 'cards from book=' . $bookId, 0); |
|
| 690 | + $this->miscService->log('found '.sizeof($cards).'cards from book='.$bookId, 0); |
|
| 691 | 691 | |
| 692 | 692 | foreach ($cards as $card) { |
| 693 | 693 | $davCard = new DavCard(); |