@@ -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,14 +419,14 @@ 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->setContactAddressBook($davCard->getAddressBookId()); |
| 426 | 426 | $circle->setContactGroupName($group); |
| 427 | 427 | |
| 428 | 428 | $this->miscService->log( |
| 429 | - 'creating new Circle: ' . json_encode($circle) . ', with owner=' . $davCard->getOwner(), 0 |
|
| 429 | + 'creating new Circle: '.json_encode($circle).', with owner='.$davCard->getOwner(), 0 |
|
| 430 | 430 | ); |
| 431 | 431 | try { |
| 432 | 432 | $this->circlesRequest->createCircle($circle); |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | $member->setStatus(Member::STATUS_MEMBER); |
| 436 | 436 | $this->miscService->updateCachedName($member); |
| 437 | 437 | |
| 438 | - $this->miscService->log('creating new Member: ' . json_encode($member), 0); |
|
| 438 | + $this->miscService->log('creating new Member: '.json_encode($member), 0); |
|
| 439 | 439 | try { |
| 440 | 440 | $this->membersRequest->createMember($member); |
| 441 | 441 | } catch (MemberAlreadyExistsException $e) { |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | * @param DavCard $davCard |
| 451 | 451 | */ |
| 452 | 452 | private function assignCirclesToCard(DavCard $davCard) { |
| 453 | - $this->miscService->log('assigning Circles to DavCard Model: ' . json_encode($davCard), 0); |
|
| 453 | + $this->miscService->log('assigning Circles to DavCard Model: '.json_encode($davCard), 0); |
|
| 454 | 454 | foreach ($davCard->getGroups() as $group) { |
| 455 | 455 | try { |
| 456 | 456 | $davCard->addCircle( |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | } |
| 461 | 461 | } |
| 462 | 462 | |
| 463 | - $this->miscService->log('assigned Circles to DavCard Model: ' . json_encode($davCard), 0); |
|
| 463 | + $this->miscService->log('assigned Circles to DavCard Model: '.json_encode($davCard), 0); |
|
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | |
@@ -505,12 +505,12 @@ discard block |
||
| 505 | 505 | * @return string |
| 506 | 506 | */ |
| 507 | 507 | public function getOwnerFromAddressBook(int $bookId): string { |
| 508 | - $this->miscService->log('Retrieving Owner from book:' . $bookId, 0); |
|
| 508 | + $this->miscService->log('Retrieving Owner from book:'.$bookId, 0); |
|
| 509 | 509 | $data = $this->cardDavBackend->getAddressBookById($bookId); |
| 510 | 510 | |
| 511 | 511 | // let's assume the format is principals/users/OWNER |
| 512 | 512 | $owner = substr($data['principaluri'], 17); |
| 513 | - $this->miscService->log('Retrieved Owner:' . $owner, 0); |
|
| 513 | + $this->miscService->log('Retrieved Owner:'.$owner, 0); |
|
| 514 | 514 | |
| 515 | 515 | return $owner; |
| 516 | 516 | } |
@@ -527,12 +527,12 @@ discard block |
||
| 527 | 527 | $this->manageDeprecatedContacts(); |
| 528 | 528 | $this->manageDeprecatedCircles(); |
| 529 | 529 | $users = $this->userManager->search(''); |
| 530 | - $this->miscService->log('initiating migration for ' . sizeof($users) . ' users', 0); |
|
| 530 | + $this->miscService->log('initiating migration for '.sizeof($users).' users', 0); |
|
| 531 | 531 | foreach ($users as $user) { |
| 532 | - $this->miscService->log('retrieving books for user=' . $user->getUID(), 0); |
|
| 533 | - $books = $this->cardDavBackend->getAddressBooksForUser('principals/users/' . $user->getUID()); |
|
| 532 | + $this->miscService->log('retrieving books for user='.$user->getUID(), 0); |
|
| 533 | + $books = $this->cardDavBackend->getAddressBooksForUser('principals/users/'.$user->getUID()); |
|
| 534 | 534 | |
| 535 | - $this->miscService->log('initiating migration for user=' . $user->getUID(), 0); |
|
| 535 | + $this->miscService->log('initiating migration for user='.$user->getUID(), 0); |
|
| 536 | 536 | foreach ($books as $book) { |
| 537 | 537 | $this->migrateBook($book['id']); |
| 538 | 538 | } |
@@ -545,16 +545,16 @@ discard block |
||
| 545 | 545 | private function manageDeprecatedContacts() { |
| 546 | 546 | $contacts = $this->membersRequest->getMembersByContactId(); |
| 547 | 547 | $this->miscService->log( |
| 548 | - 'Managing Deprecated Contacts, checking ' . sizeof($contacts) . ' known contacts in database', 0 |
|
| 548 | + 'Managing Deprecated Contacts, checking '.sizeof($contacts).' known contacts in database', 0 |
|
| 549 | 549 | ); |
| 550 | 550 | |
| 551 | 551 | foreach ($contacts as $contact) { |
| 552 | 552 | try { |
| 553 | 553 | $this->getDavCardFromMember($contact); |
| 554 | - $this->miscService->log('Contact is not deprecated: ' . json_encode($contact)); |
|
| 554 | + $this->miscService->log('Contact is not deprecated: '.json_encode($contact)); |
|
| 555 | 555 | } catch (MemberDoesNotExistException $e) { |
| 556 | 556 | $this->miscService->log( |
| 557 | - 'Contact is deprecated and will be removed: ' . json_encode($contact) |
|
| 557 | + 'Contact is deprecated and will be removed: '.json_encode($contact) |
|
| 558 | 558 | ); |
| 559 | 559 | $this->membersRequest->removeMember($contact); |
| 560 | 560 | } |
@@ -569,12 +569,12 @@ discard block |
||
| 569 | 569 | */ |
| 570 | 570 | private function manageDeprecatedCircles(int $bookId = 0) { |
| 571 | 571 | $knownBooks = [$bookId]; |
| 572 | - $this->miscService->log('Managing Deprecated Circles, using bookId: ' . $bookId, 0); |
|
| 572 | + $this->miscService->log('Managing Deprecated Circles, using bookId: '.$bookId, 0); |
|
| 573 | 573 | |
| 574 | 574 | if ($bookId > 0) { |
| 575 | 575 | $knownBooks = []; |
| 576 | 576 | $contacts = $this->membersRequest->getMembersByContactId(); |
| 577 | - $this->miscService->log(sizeof($contacts) . ' known members as contacts in Circles DB', 0); |
|
| 577 | + $this->miscService->log(sizeof($contacts).' known members as contacts in Circles DB', 0); |
|
| 578 | 578 | |
| 579 | 579 | foreach ($contacts as $contact) { |
| 580 | 580 | list($bookId,) = explode('/', $contact->getContactId(), 2); |
@@ -586,17 +586,17 @@ discard block |
||
| 586 | 586 | } |
| 587 | 587 | } |
| 588 | 588 | |
| 589 | - $this->miscService->log('Known books: ' . json_encode($knownBooks), 0); |
|
| 589 | + $this->miscService->log('Known books: '.json_encode($knownBooks), 0); |
|
| 590 | 590 | foreach ($knownBooks as $bookId) { |
| 591 | - $this->miscService->log('retrieving local Circles data for bookId=' . $bookId, 0); |
|
| 591 | + $this->miscService->log('retrieving local Circles data for bookId='.$bookId, 0); |
|
| 592 | 592 | $circles = $this->circlesRequest->getFromContactBook($bookId); |
| 593 | 593 | $this->miscService->log( |
| 594 | - 'Known circles for bookId=' . $bookId . ': ' . json_encode($circles), 0 |
|
| 594 | + 'Known circles for bookId='.$bookId.': '.json_encode($circles), 0 |
|
| 595 | 595 | ); |
| 596 | 596 | |
| 597 | 597 | $fromBook = $this->getExistingCirclesFromBook($bookId); |
| 598 | 598 | $this->miscService->log( |
| 599 | - 'Generated circles from bookId=' . $bookId . ': ' . json_encode($fromBook), 0 |
|
| 599 | + 'Generated circles from bookId='.$bookId.': '.json_encode($fromBook), 0 |
|
| 600 | 600 | ); |
| 601 | 601 | |
| 602 | 602 | foreach ($circles as $circle) { |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | } |
| 606 | 606 | |
| 607 | 607 | $this->miscService->log( |
| 608 | - $circle->getUniqueId() . ' is a deprecated Circle and will be destroyed', 0 |
|
| 608 | + $circle->getUniqueId().' is a deprecated Circle and will be destroyed', 0 |
|
| 609 | 609 | ); |
| 610 | 610 | |
| 611 | 611 | $this->membersRequest->removeAllFromCircle($circle->getUniqueId()); |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | $cards = $this->cardDavBackend->getCards($bookId); |
| 628 | 628 | |
| 629 | 629 | $this->miscService->log( |
| 630 | - 'retrieving existing circles from bookId=' . $bookId . ' in ' . sizeof($cards) . ' cards', 0 |
|
| 630 | + 'retrieving existing circles from bookId='.$bookId.' in '.sizeof($cards).' cards', 0 |
|
| 631 | 631 | ); |
| 632 | 632 | foreach ($cards as $card) { |
| 633 | 633 | $davCard = $this->generateDavCardFromCard($bookId, $card); |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | $circles = array_merge($circles, $davCard->getCircles()); |
| 636 | 636 | } |
| 637 | 637 | |
| 638 | - $this->miscService->log('Found ' . sizeof($circles) . ' Circles from book=' . $bookId, 0); |
|
| 638 | + $this->miscService->log('Found '.sizeof($circles).' Circles from book='.$bookId, 0); |
|
| 639 | 639 | $existing = array_unique( |
| 640 | 640 | array_map( |
| 641 | 641 | function(Circle $circle) { |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | ); |
| 646 | 646 | |
| 647 | 647 | $this->miscService->log( |
| 648 | - 'retrieved existing circles from book=' . $bookId . ': ' . json_encode($existing), 0 |
|
| 648 | + 'retrieved existing circles from book='.$bookId.': '.json_encode($existing), 0 |
|
| 649 | 649 | ); |
| 650 | 650 | |
| 651 | 651 | return $existing; |
@@ -660,14 +660,14 @@ discard block |
||
| 660 | 660 | */ |
| 661 | 661 | public function getDavCardFromMember(Member $contact): DavCard { |
| 662 | 662 | list($bookId, $cardUri) = explode('/', $contact->getContactId(), 2); |
| 663 | - $this->miscService->log('Retrieving DavCard from book:' . $bookId . ', uri:' . $cardUri, 0); |
|
| 663 | + $this->miscService->log('Retrieving DavCard from book:'.$bookId.', uri:'.$cardUri, 0); |
|
| 664 | 664 | |
| 665 | 665 | $cards = $this->cardDavBackend->getCards($bookId); |
| 666 | - $this->miscService->log('Book contains ' . sizeof($cards) . ' cards', 0); |
|
| 666 | + $this->miscService->log('Book contains '.sizeof($cards).' cards', 0); |
|
| 667 | 667 | foreach ($cards as $card) { |
| 668 | 668 | if ($card['uri'] === $cardUri) { |
| 669 | 669 | $davCard = $this->generateDavCardFromCard($bookId, $card); |
| 670 | - $this->miscService->log('Retrieved DavCard: ' . json_encode($card)); |
|
| 670 | + $this->miscService->log('Retrieved DavCard: '.json_encode($card)); |
|
| 671 | 671 | |
| 672 | 672 | return $davCard; |
| 673 | 673 | } |
@@ -685,11 +685,11 @@ discard block |
||
| 685 | 685 | return; |
| 686 | 686 | } |
| 687 | 687 | |
| 688 | - $this->miscService->log('migrating book: ' . $bookId, 0); |
|
| 688 | + $this->miscService->log('migrating book: '.$bookId, 0); |
|
| 689 | 689 | $owner = $this->getOwnerFromAddressBook($bookId); |
| 690 | 690 | |
| 691 | 691 | $cards = $this->cardDavBackend->getCards($bookId); |
| 692 | - $this->miscService->log('found ' . sizeof($cards) . 'cards from book=' . $bookId, 0); |
|
| 692 | + $this->miscService->log('found '.sizeof($cards).'cards from book='.$bookId, 0); |
|
| 693 | 693 | |
| 694 | 694 | foreach ($cards as $card) { |
| 695 | 695 | $davCard = new DavCard(); |
@@ -191,8 +191,8 @@ |
||
| 191 | 191 | |
| 192 | 192 | |
| 193 | 193 | /** |
| 194 | - * @param Circle|null $circle |
|
| 195 | - * @param Member|null $member |
|
| 194 | + * @param Circle $circle |
|
| 195 | + * @param Member $member |
|
| 196 | 196 | * @param array $links |
| 197 | 197 | * @param string $password |
| 198 | 198 | */ |
@@ -116,13 +116,13 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | $this->miscService->log( |
| 119 | - 'updating member :' . json_encode($member) . ' from ' . json_encode($knownMember), 2 |
|
| 119 | + 'updating member :'.json_encode($member).' from '.json_encode($knownMember), 2 |
|
| 120 | 120 | ); |
| 121 | 121 | $this->membersRequest->updateMemberLevel($member); |
| 122 | 122 | } catch (MemberDoesNotExistException $e) { |
| 123 | 123 | try { |
| 124 | 124 | $this->miscService->log( |
| 125 | - 'creating member :' . json_encode($member), 2 |
|
| 125 | + 'creating member :'.json_encode($member), 2 |
|
| 126 | 126 | ); |
| 127 | 127 | $this->membersRequest->createMember($member); |
| 128 | 128 | } catch (MemberAlreadyExistsException $e) { |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | try { |
| 141 | 141 | $this->getMember($knownItem, $circle->getMembers(), $source); |
| 142 | 142 | } catch (MemberDoesNotExistException $e) { |
| 143 | - $this->miscService->log('removing deprecated member :' . json_encode($knownItem), 2); |
|
| 143 | + $this->miscService->log('removing deprecated member :'.json_encode($knownItem), 2); |
|
| 144 | 144 | $this->membersRequest->removeMember($knownItem); |
| 145 | 145 | $this->gsSharesRequest->removeGSSharesFromMember($knownItem); |
| 146 | 146 | } |
@@ -134,9 +134,9 @@ discard block |
||
| 134 | 134 | $test->setAsync(true); |
| 135 | 135 | $token = $this->gsUpstreamService->newEvent($test); |
| 136 | 136 | |
| 137 | - $output->writeln('- Async request is sent, now waiting ' . $this->delay . ' seconds'); |
|
| 137 | + $output->writeln('- Async request is sent, now waiting '.$this->delay.' seconds'); |
|
| 138 | 138 | sleep($this->delay); |
| 139 | - $output->writeln('- Pause is over, checking results for ' . $token); |
|
| 139 | + $output->writeln('- Pause is over, checking results for '.$token); |
|
| 140 | 140 | |
| 141 | 141 | $wrappers = $this->gsUpstreamService->getEventsByToken($token); |
| 142 | 142 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | foreach ($instances as $instance) { |
| 149 | - $output->write($instance . ' '); |
|
| 149 | + $output->write($instance.' '); |
|
| 150 | 150 | if (array_key_exists($instance, $result) |
| 151 | 151 | && $result[$instance]->getResult() |
| 152 | 152 | ->gInt('status') === 1) { |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | private function testLocalAddress(OutputInterface $output): bool { |
| 173 | 173 | $absolute = $this->urlGenerator->linkToRouteAbsolute('core.CSRFToken.index'); |
| 174 | - $output->write('- Simple request on ' . $absolute . ': '); |
|
| 174 | + $output->write('- Simple request on '.$absolute.': '); |
|
| 175 | 175 | |
| 176 | 176 | $request = new Request('', Request::TYPE_GET); |
| 177 | 177 | $request->setAddressFromUrl($absolute); |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | if ($request->getResultCode() === 200) { |
| 188 | 188 | $color = 'info'; |
| 189 | 189 | } |
| 190 | - $output->writeln('<' . $color . '>' . $request->getResultCode() . '</' . $color . '>'); |
|
| 190 | + $output->writeln('<'.$color.'>'.$request->getResultCode().'</'.$color.'>'); |
|
| 191 | 191 | |
| 192 | 192 | if ($request->getResultCode() === 200) { |
| 193 | 193 | return true; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | } catch (Exception $e) { |
| 152 | 152 | $this->miscService->log( |
| 153 | - get_class($e) . ' on new event: ' . $e->getMessage() . ' - ' . json_encode($event), 1 |
|
| 153 | + get_class($e).' on new event: '.$e->getMessage().' - '.json_encode($event), 1 |
|
| 154 | 154 | ); |
| 155 | 155 | throw $e; |
| 156 | 156 | } |
@@ -246,13 +246,13 @@ discard block |
||
| 246 | 246 | $request->setDataSerialize($event); |
| 247 | 247 | |
| 248 | 248 | $result = $this->retrieveJson($request); |
| 249 | - $this->miscService->log('result ' . json_encode($result), 0); |
|
| 249 | + $this->miscService->log('result '.json_encode($result), 0); |
|
| 250 | 250 | if ($this->getInt('status', $result) === 0) { |
| 251 | 251 | throw new GlobalScaleEventException($this->get('error', $result)); |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | $updatedData = $this->getArray('event', $result); |
| 255 | - $this->miscService->log('updatedEvent: ' . json_encode($updatedData), 0); |
|
| 255 | + $this->miscService->log('updatedEvent: '.json_encode($updatedData), 0); |
|
| 256 | 256 | if (!empty($updatedData)) { |
| 257 | 257 | $updated = new GSEvent(); |
| 258 | 258 | try { |