@@ -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 | } |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | } |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | - $davCard->setUserId($davCard->getOwner() . ':' . $davCard->getContactId()); |
|
| 354 | + $davCard->setUserId($davCard->getOwner().':'.$davCard->getContactId()); |
|
| 355 | 355 | |
| 356 | 356 | return DavCard::TYPE_CONTACT; |
| 357 | 357 | } |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | ); |
| 397 | 397 | |
| 398 | 398 | $this->miscService->log( |
| 399 | - 'manage Circles from DavCard: ' . json_encode($fromCard) . ' - current: ' . json_encode($current) |
|
| 399 | + 'manage Circles from DavCard: '.json_encode($fromCard).' - current: '.json_encode($current) |
|
| 400 | 400 | ); |
| 401 | 401 | |
| 402 | 402 | $this->manageNewCircles($davCard, $fromCard, $current); |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | |
| 420 | 420 | $user = $this->userManager->get($davCard->getOwner()); |
| 421 | 421 | $circle = new Circle( |
| 422 | - $this->configService->contactsBackendType(), $group . ' - ' . $user->getDisplayName() |
|
| 422 | + $this->configService->contactsBackendType(), $group.' - '.$user->getDisplayName() |
|
| 423 | 423 | ); |
| 424 | 424 | $circle->setAltName($group); |
| 425 | 425 | $circle->generateUniqueId(); |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | $circle->setContactGroupName($group); |
| 428 | 428 | |
| 429 | 429 | $this->miscService->log( |
| 430 | - 'creating new Circle: ' . json_encode($circle) . ', with owner=' . $davCard->getOwner(), 0 |
|
| 430 | + 'creating new Circle: '.json_encode($circle).', with owner='.$davCard->getOwner(), 0 |
|
| 431 | 431 | ); |
| 432 | 432 | try { |
| 433 | 433 | $this->circlesRequest->createCircle($circle); |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | $member->setStatus(Member::STATUS_MEMBER); |
| 437 | 437 | $this->miscService->updateCachedName($member); |
| 438 | 438 | |
| 439 | - $this->miscService->log('creating new Member: ' . json_encode($member), 0); |
|
| 439 | + $this->miscService->log('creating new Member: '.json_encode($member), 0); |
|
| 440 | 440 | try { |
| 441 | 441 | $this->membersRequest->createMember($member); |
| 442 | 442 | } catch (MemberAlreadyExistsException $e) { |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | * @param DavCard $davCard |
| 452 | 452 | */ |
| 453 | 453 | private function assignCirclesToCard(DavCard $davCard) { |
| 454 | - $this->miscService->log('assigning Circles to DavCard Model: ' . json_encode($davCard), 0); |
|
| 454 | + $this->miscService->log('assigning Circles to DavCard Model: '.json_encode($davCard), 0); |
|
| 455 | 455 | foreach ($davCard->getGroups() as $group) { |
| 456 | 456 | try { |
| 457 | 457 | $davCard->addCircle( |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | } |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | - $this->miscService->log('assigned Circles to DavCard Model: ' . json_encode($davCard), 0); |
|
| 464 | + $this->miscService->log('assigned Circles to DavCard Model: '.json_encode($davCard), 0); |
|
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | |
@@ -506,12 +506,12 @@ discard block |
||
| 506 | 506 | * @return string |
| 507 | 507 | */ |
| 508 | 508 | public function getOwnerFromAddressBook(int $bookId): string { |
| 509 | - $this->miscService->log('Retrieving Owner from book:' . $bookId, 0); |
|
| 509 | + $this->miscService->log('Retrieving Owner from book:'.$bookId, 0); |
|
| 510 | 510 | $data = $this->cardDavBackend->getAddressBookById($bookId); |
| 511 | 511 | |
| 512 | 512 | // let's assume the format is principals/users/OWNER |
| 513 | 513 | $owner = substr($data['principaluri'], 17); |
| 514 | - $this->miscService->log('Retrieved Owner:' . $owner, 0); |
|
| 514 | + $this->miscService->log('Retrieved Owner:'.$owner, 0); |
|
| 515 | 515 | |
| 516 | 516 | return $owner; |
| 517 | 517 | } |
@@ -528,12 +528,12 @@ discard block |
||
| 528 | 528 | $this->manageDeprecatedContacts(); |
| 529 | 529 | $this->manageDeprecatedCircles(); |
| 530 | 530 | $users = $this->userManager->search(''); |
| 531 | - $this->miscService->log('initiating migration for ' . sizeof($users) . ' users', 0); |
|
| 531 | + $this->miscService->log('initiating migration for '.sizeof($users).' users', 0); |
|
| 532 | 532 | foreach ($users as $user) { |
| 533 | - $this->miscService->log('retrieving books for user=' . $user->getUID(), 0); |
|
| 534 | - $books = $this->cardDavBackend->getAddressBooksForUser('principals/users/' . $user->getUID()); |
|
| 533 | + $this->miscService->log('retrieving books for user='.$user->getUID(), 0); |
|
| 534 | + $books = $this->cardDavBackend->getAddressBooksForUser('principals/users/'.$user->getUID()); |
|
| 535 | 535 | |
| 536 | - $this->miscService->log('initiating migration for user=' . $user->getUID(), 0); |
|
| 536 | + $this->miscService->log('initiating migration for user='.$user->getUID(), 0); |
|
| 537 | 537 | foreach ($books as $book) { |
| 538 | 538 | $this->migrateBook($book['id']); |
| 539 | 539 | } |
@@ -546,16 +546,16 @@ discard block |
||
| 546 | 546 | private function manageDeprecatedContacts() { |
| 547 | 547 | $contacts = $this->membersRequest->getMembersByContactId(); |
| 548 | 548 | $this->miscService->log( |
| 549 | - 'Managing Deprecated Contacts, checking ' . sizeof($contacts) . ' known contacts in database', 0 |
|
| 549 | + 'Managing Deprecated Contacts, checking '.sizeof($contacts).' known contacts in database', 0 |
|
| 550 | 550 | ); |
| 551 | 551 | |
| 552 | 552 | foreach ($contacts as $contact) { |
| 553 | 553 | try { |
| 554 | 554 | $this->getDavCardFromMember($contact); |
| 555 | - $this->miscService->log('Contact is not deprecated: ' . json_encode($contact)); |
|
| 555 | + $this->miscService->log('Contact is not deprecated: '.json_encode($contact)); |
|
| 556 | 556 | } catch (MemberDoesNotExistException $e) { |
| 557 | 557 | $this->miscService->log( |
| 558 | - 'Contact is deprecated and will be removed: ' . json_encode($contact) |
|
| 558 | + 'Contact is deprecated and will be removed: '.json_encode($contact) |
|
| 559 | 559 | ); |
| 560 | 560 | $this->membersRequest->removeMember($contact); |
| 561 | 561 | } |
@@ -570,12 +570,12 @@ discard block |
||
| 570 | 570 | */ |
| 571 | 571 | private function manageDeprecatedCircles(int $bookId = 0) { |
| 572 | 572 | $knownBooks = [$bookId]; |
| 573 | - $this->miscService->log('Managing Deprecated Circles, using bookId: ' . $bookId, 0); |
|
| 573 | + $this->miscService->log('Managing Deprecated Circles, using bookId: '.$bookId, 0); |
|
| 574 | 574 | |
| 575 | 575 | if ($bookId > 0) { |
| 576 | 576 | $knownBooks = []; |
| 577 | 577 | $contacts = $this->membersRequest->getMembersByContactId(); |
| 578 | - $this->miscService->log(sizeof($contacts) . ' known members as contacts in Circles DB', 0); |
|
| 578 | + $this->miscService->log(sizeof($contacts).' known members as contacts in Circles DB', 0); |
|
| 579 | 579 | |
| 580 | 580 | foreach ($contacts as $contact) { |
| 581 | 581 | list($bookId,) = explode('/', $contact->getContactId(), 2); |
@@ -587,17 +587,17 @@ discard block |
||
| 587 | 587 | } |
| 588 | 588 | } |
| 589 | 589 | |
| 590 | - $this->miscService->log('Known books: ' . json_encode($knownBooks), 0); |
|
| 590 | + $this->miscService->log('Known books: '.json_encode($knownBooks), 0); |
|
| 591 | 591 | foreach ($knownBooks as $bookId) { |
| 592 | - $this->miscService->log('retrieving local Circles data for bookId=' . $bookId, 0); |
|
| 592 | + $this->miscService->log('retrieving local Circles data for bookId='.$bookId, 0); |
|
| 593 | 593 | $circles = $this->circlesRequest->getFromContactBook($bookId); |
| 594 | 594 | $this->miscService->log( |
| 595 | - 'Known circles for bookId=' . $bookId . ': ' . json_encode($circles), 0 |
|
| 595 | + 'Known circles for bookId='.$bookId.': '.json_encode($circles), 0 |
|
| 596 | 596 | ); |
| 597 | 597 | |
| 598 | 598 | $fromBook = $this->getExistingCirclesFromBook($bookId); |
| 599 | 599 | $this->miscService->log( |
| 600 | - 'Generated circles from bookId=' . $bookId . ': ' . json_encode($fromBook), 0 |
|
| 600 | + 'Generated circles from bookId='.$bookId.': '.json_encode($fromBook), 0 |
|
| 601 | 601 | ); |
| 602 | 602 | |
| 603 | 603 | foreach ($circles as $circle) { |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | } |
| 607 | 607 | |
| 608 | 608 | $this->miscService->log( |
| 609 | - $circle->getUniqueId() . ' is a deprecated Circle and will be destroyed', 0 |
|
| 609 | + $circle->getUniqueId().' is a deprecated Circle and will be destroyed', 0 |
|
| 610 | 610 | ); |
| 611 | 611 | |
| 612 | 612 | $this->membersRequest->removeAllFromCircle($circle->getUniqueId()); |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | $cards = $this->cardDavBackend->getCards($bookId); |
| 629 | 629 | |
| 630 | 630 | $this->miscService->log( |
| 631 | - 'retrieving existing circles from bookId=' . $bookId . ' in ' . sizeof($cards) . ' cards', 0 |
|
| 631 | + 'retrieving existing circles from bookId='.$bookId.' in '.sizeof($cards).' cards', 0 |
|
| 632 | 632 | ); |
| 633 | 633 | foreach ($cards as $card) { |
| 634 | 634 | $davCard = $this->generateDavCardFromCard($bookId, $card); |
@@ -636,7 +636,7 @@ discard block |
||
| 636 | 636 | $circles = array_merge($circles, $davCard->getCircles()); |
| 637 | 637 | } |
| 638 | 638 | |
| 639 | - $this->miscService->log('Found ' . sizeof($circles) . ' Circles from book=' . $bookId, 0); |
|
| 639 | + $this->miscService->log('Found '.sizeof($circles).' Circles from book='.$bookId, 0); |
|
| 640 | 640 | $existing = array_unique( |
| 641 | 641 | array_map( |
| 642 | 642 | function(Circle $circle) { |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | ); |
| 647 | 647 | |
| 648 | 648 | $this->miscService->log( |
| 649 | - 'retrieved existing circles from book=' . $bookId . ': ' . json_encode($existing), 0 |
|
| 649 | + 'retrieved existing circles from book='.$bookId.': '.json_encode($existing), 0 |
|
| 650 | 650 | ); |
| 651 | 651 | |
| 652 | 652 | return $existing; |
@@ -661,14 +661,14 @@ discard block |
||
| 661 | 661 | */ |
| 662 | 662 | public function getDavCardFromMember(Member $contact): DavCard { |
| 663 | 663 | list($bookId, $cardUri) = explode('/', $contact->getContactId(), 2); |
| 664 | - $this->miscService->log('Retrieving DavCard from book:' . $bookId . ', uri:' . $cardUri, 0); |
|
| 664 | + $this->miscService->log('Retrieving DavCard from book:'.$bookId.', uri:'.$cardUri, 0); |
|
| 665 | 665 | |
| 666 | 666 | $cards = $this->cardDavBackend->getCards($bookId); |
| 667 | - $this->miscService->log('Book contains ' . sizeof($cards) . ' cards', 0); |
|
| 667 | + $this->miscService->log('Book contains '.sizeof($cards).' cards', 0); |
|
| 668 | 668 | foreach ($cards as $card) { |
| 669 | 669 | if ($card['uri'] === $cardUri) { |
| 670 | 670 | $davCard = $this->generateDavCardFromCard($bookId, $card); |
| 671 | - $this->miscService->log('Retrieved DavCard: ' . json_encode($card)); |
|
| 671 | + $this->miscService->log('Retrieved DavCard: '.json_encode($card)); |
|
| 672 | 672 | |
| 673 | 673 | return $davCard; |
| 674 | 674 | } |
@@ -686,11 +686,11 @@ discard block |
||
| 686 | 686 | return; |
| 687 | 687 | } |
| 688 | 688 | |
| 689 | - $this->miscService->log('migrating book: ' . $bookId, 0); |
|
| 689 | + $this->miscService->log('migrating book: '.$bookId, 0); |
|
| 690 | 690 | $owner = $this->getOwnerFromAddressBook($bookId); |
| 691 | 691 | |
| 692 | 692 | $cards = $this->cardDavBackend->getCards($bookId); |
| 693 | - $this->miscService->log('found ' . sizeof($cards) . 'cards from book=' . $bookId, 0); |
|
| 693 | + $this->miscService->log('found '.sizeof($cards).'cards from book='.$bookId, 0); |
|
| 694 | 694 | |
| 695 | 695 | foreach ($cards as $card) { |
| 696 | 696 | $davCard = new DavCard(); |