@@ -5,5 +5,5 @@ |
||
| 5 | 5 | require_once __DIR__.'/../../../lib/base.php'; |
| 6 | 6 | require_once __DIR__.'/../vendor/autoload.php'; |
| 7 | 7 | |
| 8 | -\OC::$loader->addValidRoot(OC::$SERVERROOT . '/tests'); |
|
| 8 | +\OC::$loader->addValidRoot(OC::$SERVERROOT.'/tests'); |
|
| 9 | 9 | \OC_App::loadApp('circles'); |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | } catch (Exception $e) { |
| 328 | 328 | $this->assertSame( |
| 329 | 329 | true, false, |
| 330 | - 'should have returned a MemberIsNotModeratorException - ' . $e->getMessage() |
|
| 330 | + 'should have returned a MemberIsNotModeratorException - '.$e->getMessage() |
|
| 331 | 331 | ); |
| 332 | 332 | } |
| 333 | 333 | |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | } catch (Exception $e) { |
| 342 | 342 | $this->assertSame( |
| 343 | 343 | true, false, |
| 344 | - 'should have returned a MemberIsNotModeratorException - ' . $e->getMessage() |
|
| 344 | + 'should have returned a MemberIsNotModeratorException - '.$e->getMessage() |
|
| 345 | 345 | ); |
| 346 | 346 | } |
| 347 | 347 | } |
@@ -173,19 +173,19 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | $webfinger = $this->getWebfinger($host, Application::APP_SUBJECT); |
| 175 | 175 | if ($this->input->getOption('all')) { |
| 176 | - $this->output->writeln('- Webfinger on <info>' . $host . '</info>'); |
|
| 176 | + $this->output->writeln('- Webfinger on <info>'.$host.'</info>'); |
|
| 177 | 177 | $this->output->writeln(json_encode($webfinger, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); |
| 178 | 178 | $this->output->writeln(''); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | if ($this->input->getOption('all')) { |
| 182 | 182 | $circleLink = $this->extractLink(Application::APP_REL, $webfinger); |
| 183 | - $this->output->writeln('- Information about Circles app on <info>' . $host . '</info>'); |
|
| 183 | + $this->output->writeln('- Information about Circles app on <info>'.$host.'</info>'); |
|
| 184 | 184 | $this->output->writeln(json_encode($circleLink, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); |
| 185 | 185 | $this->output->writeln(''); |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - $this->output->writeln('- Available services on <info>' . $host . '</info>'); |
|
| 188 | + $this->output->writeln('- Available services on <info>'.$host.'</info>'); |
|
| 189 | 189 | foreach ($webfinger->getLinks() as $link) { |
| 190 | 190 | $app = $link->getProperty('name'); |
| 191 | 191 | $ver = $link->getProperty('version'); |
@@ -193,14 +193,14 @@ discard block |
||
| 193 | 193 | $app .= ' '; |
| 194 | 194 | } |
| 195 | 195 | if ($ver !== '') { |
| 196 | - $ver = 'v' . $ver; |
|
| 196 | + $ver = 'v'.$ver; |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - $this->output->writeln(' * ' . $link->getRel() . ' ' . $app . $ver); |
|
| 199 | + $this->output->writeln(' * '.$link->getRel().' '.$app.$ver); |
|
| 200 | 200 | } |
| 201 | 201 | $this->output->writeln(''); |
| 202 | 202 | |
| 203 | - $this->output->writeln('- Resources related to Circles on <info>' . $host . '</info>'); |
|
| 203 | + $this->output->writeln('- Resources related to Circles on <info>'.$host.'</info>'); |
|
| 204 | 204 | $resource = $this->getResourceData($host, Application::APP_SUBJECT, Application::APP_REL); |
| 205 | 205 | $this->output->writeln(json_encode($resource, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); |
| 206 | 206 | $this->output->writeln(''); |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | |
| 209 | 209 | $tempUid = $resource->g('uid'); |
| 210 | 210 | $this->output->writeln( |
| 211 | - '- Confirming UID=' . $tempUid . ' from parsed Signatory at <info>' . $host . '</info>' |
|
| 211 | + '- Confirming UID='.$tempUid.' from parsed Signatory at <info>'.$host.'</info>' |
|
| 212 | 212 | ); |
| 213 | 213 | |
| 214 | 214 | try { |
@@ -217,15 +217,15 @@ discard block |
||
| 217 | 217 | $this->output->writeln(' * No SignatureException: <info>Identity authed</info>'); |
| 218 | 218 | } catch (SignatureException $e) { |
| 219 | 219 | $this->output->writeln( |
| 220 | - '<error>' . $host . ' cannot auth its identity: ' . $e->getMessage() . '</error>' |
|
| 220 | + '<error>'.$host.' cannot auth its identity: '.$e->getMessage().'</error>' |
|
| 221 | 221 | ); |
| 222 | 222 | |
| 223 | 223 | return; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - $this->output->writeln(' * Found <info>' . $remoteSignatory->getUid() . '</info>'); |
|
| 226 | + $this->output->writeln(' * Found <info>'.$remoteSignatory->getUid().'</info>'); |
|
| 227 | 227 | if ($remoteSignatory->getUid(true) !== $tempUid) { |
| 228 | - $this->output->writeln('<error>looks like ' . $host . ' is faking its identity'); |
|
| 228 | + $this->output->writeln('<error>looks like '.$host.' is faking its identity'); |
|
| 229 | 229 | |
| 230 | 230 | return; |
| 231 | 231 | } |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | $this->output->writeln(''); |
| 234 | 234 | |
| 235 | 235 | $testUrl = $resource->g('test'); |
| 236 | - $this->output->writeln('- Testing signed payload on <info>' . $testUrl . '</info>'); |
|
| 236 | + $this->output->writeln('- Testing signed payload on <info>'.$testUrl.'</info>'); |
|
| 237 | 237 | |
| 238 | 238 | try { |
| 239 | 239 | $localSignatory = $this->remoteStreamService->getAppSignatory(); |
@@ -255,18 +255,18 @@ discard block |
||
| 255 | 255 | $this->output->writeln(''); |
| 256 | 256 | |
| 257 | 257 | $this->output->writeln(' * Clear Signature: '); |
| 258 | - $this->output->writeln('<comment>' . $signedRequest->getClearSignature() . '</comment>'); |
|
| 258 | + $this->output->writeln('<comment>'.$signedRequest->getClearSignature().'</comment>'); |
|
| 259 | 259 | $this->output->writeln(''); |
| 260 | 260 | |
| 261 | 261 | $this->output->writeln(' * Signed Signature (base64 encoded): '); |
| 262 | 262 | $this->output->writeln( |
| 263 | - '<comment>' . base64_encode($signedRequest->getSignedSignature()) . '</comment>' |
|
| 263 | + '<comment>'.base64_encode($signedRequest->getSignedSignature()).'</comment>' |
|
| 264 | 264 | ); |
| 265 | 265 | $this->output->writeln(''); |
| 266 | 266 | |
| 267 | 267 | $result = $signedRequest->getOutgoingRequest()->getResult(); |
| 268 | 268 | $code = $result->getStatusCode(); |
| 269 | - $this->output->writeln(' * Result: ' . (($code === 200) ? '<info>' . $code . '</info>' : $code)); |
|
| 269 | + $this->output->writeln(' * Result: '.(($code === 200) ? '<info>'.$code.'</info>' : $code)); |
|
| 270 | 270 | $this->output->writeln( |
| 271 | 271 | json_encode(json_decode($result->getContent(), true), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) |
| 272 | 272 | ); |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | $stored = new RemoteInstance(); |
| 289 | 289 | $this->remoteStreamService->confirmValidRemote($remoteSignatory, $stored); |
| 290 | 290 | $this->output->writeln( |
| 291 | - '<info>The remote instance ' . $host |
|
| 291 | + '<info>The remote instance '.$host |
|
| 292 | 292 | . ' is already known with this current identity</info>' |
| 293 | 293 | ); |
| 294 | 294 | |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | |
| 299 | 299 | if ($remoteSignatory->getType() !== $stored->getType()) { |
| 300 | 300 | $this->output->writeln( |
| 301 | - '- updating type from ' . $stored->getType() . ' to ' |
|
| 301 | + '- updating type from '.$stored->getType().' to ' |
|
| 302 | 302 | . $remoteSignatory->getType() |
| 303 | 303 | ); |
| 304 | 304 | $this->remoteStreamService->update( |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | |
| 309 | 309 | if ($remoteSignatory->getInstance() !== $stored->getInstance()) { |
| 310 | 310 | $this->output->writeln( |
| 311 | - '- updating host from ' . $stored->getInstance() . ' to ' |
|
| 311 | + '- updating host from '.$stored->getInstance().' to ' |
|
| 312 | 312 | . $remoteSignatory->getInstance() |
| 313 | 313 | ); |
| 314 | 314 | $this->remoteStreamService->update( |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | } |
| 318 | 318 | if ($remoteSignatory->getId() !== $stored->getId()) { |
| 319 | 319 | $this->output->writeln( |
| 320 | - '- updating href/Id from ' . $stored->getId() . ' to ' |
|
| 320 | + '- updating href/Id from '.$stored->getId().' to ' |
|
| 321 | 321 | . $remoteSignatory->getId() |
| 322 | 322 | ); |
| 323 | 323 | $this->remoteStreamService->update($remoteSignatory, RemoteStreamService::UPDATE_HREF); |
@@ -341,10 +341,10 @@ discard block |
||
| 341 | 341 | $helper = $this->getHelper('question'); |
| 342 | 342 | |
| 343 | 343 | $this->output->writeln( |
| 344 | - 'The remote instance <info>' . $remoteSignatory->getInstance() . '</info> looks good.' |
|
| 344 | + 'The remote instance <info>'.$remoteSignatory->getInstance().'</info> looks good.' |
|
| 345 | 345 | ); |
| 346 | 346 | $question = new ConfirmationQuestion( |
| 347 | - 'Would you like to identify this remote instance as \'<comment>' . $remoteSignatory->getType() |
|
| 347 | + 'Would you like to identify this remote instance as \'<comment>'.$remoteSignatory->getType() |
|
| 348 | 348 | . '</comment>\' using interface \'<comment>' |
| 349 | 349 | . InterfaceService::$LIST_IFACE[$remoteSignatory->getInterface()] |
| 350 | 350 | . '</comment>\' ? (y/N) ', |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | $helper = $this->getHelper('question'); |
| 373 | 373 | |
| 374 | 374 | $this->output->writeln( |
| 375 | - 'The remote instance <info>' . $remoteSignatory->getInstance() |
|
| 375 | + 'The remote instance <info>'.$remoteSignatory->getInstance() |
|
| 376 | 376 | . '</info> is known but <error>its identity has changed.</error>' |
| 377 | 377 | ); |
| 378 | 378 | $this->output->writeln( |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | private function verifyGSInstances(): void { |
| 431 | 431 | $instances = $this->globalScaleService->getGlobalScaleInstances(); |
| 432 | 432 | $known = array_map( |
| 433 | - function (RemoteInstance $instance): string { |
|
| 433 | + function(RemoteInstance $instance): string { |
|
| 434 | 434 | return $instance->getInstance(); |
| 435 | 435 | }, $this->remoteRequest->getFromType(RemoteInstance::TYPE_GLOBALSCALE) |
| 436 | 436 | ); |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | return; |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | - $this->output->write('Adding <comment>' . $instance . '</comment>: '); |
|
| 453 | + $this->output->write('Adding <comment>'.$instance.'</comment>: '); |
|
| 454 | 454 | try { |
| 455 | 455 | $this->remoteStreamService->addRemoteInstance( |
| 456 | 456 | $instance, |
@@ -460,8 +460,8 @@ discard block |
||
| 460 | 460 | ); |
| 461 | 461 | $this->output->writeln('<info>ok</info>'); |
| 462 | 462 | } catch (Exception $e) { |
| 463 | - $msg = ($e->getMessage() === '') ? '' : ' (' . $e->getMessage() . ')'; |
|
| 464 | - $this->output->writeln('<error>' . get_class($e) . $msg . '</error>'); |
|
| 463 | + $msg = ($e->getMessage() === '') ? '' : ' ('.$e->getMessage().')'; |
|
| 464 | + $this->output->writeln('<error>'.get_class($e).$msg.'</error>'); |
|
| 465 | 465 | } |
| 466 | 466 | } |
| 467 | 467 | |
@@ -479,12 +479,12 @@ discard block |
||
| 479 | 479 | try { |
| 480 | 480 | $current = $this->remoteStreamService->retrieveRemoteInstance($instance->getInstance()); |
| 481 | 481 | if ($current->getUid(true) === $instance->getUid(true)) { |
| 482 | - $currentUid = '<info>' . $current->getUid(true) . '</info>'; |
|
| 482 | + $currentUid = '<info>'.$current->getUid(true).'</info>'; |
|
| 483 | 483 | } else { |
| 484 | - $currentUid = '<error>' . $current->getUid(true) . '</error>'; |
|
| 484 | + $currentUid = '<error>'.$current->getUid(true).'</error>'; |
|
| 485 | 485 | } |
| 486 | 486 | } catch (Exception $e) { |
| 487 | - $currentUid = '<error>' . $e->getMessage() . '</error>'; |
|
| 487 | + $currentUid = '<error>'.$e->getMessage().'</error>'; |
|
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | $table->appendRow( |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | } |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | - throw new Exception('Unknown type: ' . implode(', ', RemoteInstance::$LIST_TYPE)); |
|
| 514 | + throw new Exception('Unknown type: '.implode(', ', RemoteInstance::$LIST_TYPE)); |
|
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | /** |
@@ -524,6 +524,6 @@ discard block |
||
| 524 | 524 | } |
| 525 | 525 | } |
| 526 | 526 | |
| 527 | - throw new Exception('Unknown interface: ' . implode(', ', InterfaceService::$LIST_IFACE)); |
|
| 527 | + throw new Exception('Unknown interface: '.implode(', ', InterfaceService::$LIST_IFACE)); |
|
| 528 | 528 | } |
| 529 | 529 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | } catch (FederatedItemException $e) { |
| 156 | 156 | if ($input->getOption('status-code')) { |
| 157 | 157 | throw new FederatedItemException( |
| 158 | - ' [' . get_class($e) . ', ' . $e->getStatus() . ']' . "\n" . $e->getMessage() |
|
| 158 | + ' ['.get_class($e).', '.$e->getStatus().']'."\n".$e->getMessage() |
|
| 159 | 159 | ); |
| 160 | 160 | } |
| 161 | 161 | |
@@ -189,8 +189,8 @@ discard block |
||
| 189 | 189 | $value = array_search(strtoupper($item), $valid); |
| 190 | 190 | if (!$value) { |
| 191 | 191 | throw new InvalidArgumentException( |
| 192 | - 'Invalid config \'' . $item . '\'. Available values: ' |
|
| 193 | - . implode(', ', array_values($valid)) . '. ' |
|
| 192 | + 'Invalid config \''.$item.'\'. Available values: ' |
|
| 193 | + . implode(', ', array_values($valid)).'. ' |
|
| 194 | 194 | . 'To disable a config, start the value with an underscore' |
| 195 | 195 | ); |
| 196 | 196 | } |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | |
| 220 | 220 | array_walk( |
| 221 | 221 | $listing, |
| 222 | - function (string &$v): void { |
|
| 222 | + function(string &$v): void { |
|
| 223 | 223 | [, $long] = explode('|', $v); |
| 224 | 224 | $v = strtoupper(str_replace(' ', '', $long)); |
| 225 | 225 | } |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | $recipient = $share->getInitiator(); |
| 220 | 220 | $sharedTo = $recipient->getDisplayName(); |
| 221 | 221 | if (!$this->configService->isLocalInstance($recipient->getInstance())) { |
| 222 | - $sharedTo .= '@' . $recipient->getInstance(); |
|
| 222 | + $sharedTo .= '@'.$recipient->getInstance(); |
|
| 223 | 223 | } |
| 224 | 224 | } |
| 225 | 225 | $circle = $share->getCircle(); |
@@ -229,15 +229,15 @@ discard block |
||
| 229 | 229 | $share->getShareOwner(), |
| 230 | 230 | $share->getFileTarget(), |
| 231 | 231 | $share->getSharedBy(), |
| 232 | - $circle->getDisplayName() . ' (' . $share->getSharedWith() |
|
| 233 | - . ', ' . Circle::$DEF_SOURCE[$circle->getSource()] . ')' |
|
| 232 | + $circle->getDisplayName().' ('.$share->getSharedWith() |
|
| 233 | + . ', '.Circle::$DEF_SOURCE[$circle->getSource()].')' |
|
| 234 | 234 | ]; |
| 235 | 235 | |
| 236 | 236 | if (!$filterRecipient) { |
| 237 | 237 | $row = array_merge( |
| 238 | 238 | $row, [ |
| 239 | - $sharedTo . ' (' . $recipient->getSingleId() . ', ' |
|
| 240 | - . Circle::$DEF_SOURCE[$recipient->getBasedOn()->getSource()] . ')', |
|
| 239 | + $sharedTo.' ('.$recipient->getSingleId().', ' |
|
| 240 | + . Circle::$DEF_SOURCE[$recipient->getBasedOn()->getSource()].')', |
|
| 241 | 241 | (($share->getChildId() > 0) ? $share->getChildFileTarget( |
| 242 | 242 | ) : $share->getFileTarget()), |
| 243 | 243 | ] |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | continue; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - $replace['{' . $k . '}'] = $data[$k]['_parsed']; |
|
| 140 | + $replace['{'.$k.'}'] = $data[$k]['_parsed']; |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | $line = strtr($line, $replace); |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | return [ |
| 302 | 302 | 'type' => $member->getTypeName(), |
| 303 | 303 | 'id' => $member->getUserId(), |
| 304 | - 'name' => $member->getCachedName() . ' (' . $member->getTypeString() . ')', |
|
| 304 | + 'name' => $member->getCachedName().' ('.$member->getTypeString().')', |
|
| 305 | 305 | '_parsed' => $member->getCachedName() |
| 306 | 306 | ]; |
| 307 | 307 | } |
@@ -336,8 +336,8 @@ discard block |
||
| 336 | 336 | return [ |
| 337 | 337 | 'type' => 'circle', |
| 338 | 338 | 'id' => $link->getUniqueId(), |
| 339 | - 'name' => $link->getToken() . '@' . $link->getAddress(), |
|
| 340 | - '_parsed' => $link->getToken() . '@' . $link->getAddress() |
|
| 339 | + 'name' => $link->getToken().'@'.$link->getAddress(), |
|
| 340 | + '_parsed' => $link->getToken().'@'.$link->getAddress() |
|
| 341 | 341 | ]; |
| 342 | 342 | } |
| 343 | 343 | |
@@ -245,16 +245,16 @@ discard block |
||
| 245 | 245 | try { |
| 246 | 246 | $test = new ReflectionClass($class); |
| 247 | 247 | } catch (ReflectionException $e) { |
| 248 | - throw new FederatedEventException('ReflectionException with ' . $class . ': ' . $e->getMessage()); |
|
| 248 | + throw new FederatedEventException('ReflectionException with '.$class.': '.$e->getMessage()); |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | if (!in_array(IFederatedItem::class, $test->getInterfaceNames())) { |
| 252 | - throw new FederatedEventException($class . ' does not implements IFederatedItem'); |
|
| 252 | + throw new FederatedEventException($class.' does not implements IFederatedItem'); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | $item = OC::$server->get($class); |
| 256 | 256 | if (!($item instanceof IFederatedItem)) { |
| 257 | - throw new FederatedEventException($class . ' not an IFederatedItem'); |
|
| 257 | + throw new FederatedEventException($class.' not an IFederatedItem'); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | if ($item instanceof IFederatedItemHighSeverity) { |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | $knownInstances = $this->memberRequest->getMemberInstances($circle->getSingleId()); |
| 451 | 451 | $instances = array_filter( |
| 452 | 452 | array_map( |
| 453 | - function (RemoteInstance $instance) use ($knownInstances) { |
|
| 453 | + function(RemoteInstance $instance) use ($knownInstances) { |
|
| 454 | 454 | if (!in_array($instance->getInstance(), $knownInstances)) { |
| 455 | 455 | return null; |
| 456 | 456 | } |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | if ($event->hasMember() |
| 466 | 466 | && !$this->configService->isLocalInstance($event->getMember()->getInstance())) { |
| 467 | 467 | $currentInstances = array_map( |
| 468 | - function (RemoteInstance $instance): string { |
|
| 468 | + function(RemoteInstance $instance): string { |
|
| 469 | 469 | return $instance->getInstance(); |
| 470 | 470 | }, $instances |
| 471 | 471 | ); |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | public function onDeleteCard(GenericEvent $event) { |
| 163 | 163 | $davCard = $this->generateDavCard($event, true); |
| 164 | 164 | |
| 165 | - $this->miscService->log('Deleting Card: ' . json_encode($davCard), 1); |
|
| 165 | + $this->miscService->log('Deleting Card: '.json_encode($davCard), 1); |
|
| 166 | 166 | $this->membersRequest->removeMembersByContactId($davCard->getUniqueId(), DeprecatedMember::TYPE_USER); |
| 167 | 167 | $this->manageDeprecatedCircles($davCard->getAddressBookId()); |
| 168 | 168 | $this->manageDeprecatedMembers($davCard); |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | */ |
| 204 | 204 | private function generateDavCardFromCard(int $bookId, array $card): DavCard { |
| 205 | 205 | $this->miscService->log( |
| 206 | - 'generating DavCard Model from book=' . $bookId . ' from ' . json_encode($card), 0 |
|
| 206 | + 'generating DavCard Model from book='.$bookId.' from '.json_encode($card), 0 |
|
| 207 | 207 | ); |
| 208 | 208 | |
| 209 | 209 | $davCard = new DavCard(); |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | $davCard->setOwner($this->getOwnerFromAddressBook($bookId)); |
| 214 | 214 | $davCard->importFromDav($card['carddata']); |
| 215 | 215 | |
| 216 | - $this->miscService->log('generated DavCard Model: ' . json_encode($davCard), 0); |
|
| 216 | + $this->miscService->log('generated DavCard Model: '.json_encode($davCard), 0); |
|
| 217 | 217 | |
| 218 | 218 | return $davCard; |
| 219 | 219 | } |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | * |
| 225 | 225 | */ |
| 226 | 226 | private function manageDavCard(DavCard $davCard) { |
| 227 | - $this->miscService->log('Updating Card: ' . json_encode($davCard), 1); |
|
| 227 | + $this->miscService->log('Updating Card: '.json_encode($davCard), 1); |
|
| 228 | 228 | $this->manageCircles($davCard); |
| 229 | 229 | $this->manageContact($davCard); |
| 230 | 230 | } |
@@ -257,24 +257,24 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | private function manageDeprecatedMembers(DavCard $davCard) { |
| 259 | 259 | $this->miscService->log( |
| 260 | - 'Managing deprecated circles memberships from DavCard Model: ' . json_encode($davCard), 0 |
|
| 260 | + 'Managing deprecated circles memberships from DavCard Model: '.json_encode($davCard), 0 |
|
| 261 | 261 | ); |
| 262 | 262 | |
| 263 | 263 | $circles = array_map( |
| 264 | - function (DeprecatedCircle $circle) { |
|
| 264 | + function(DeprecatedCircle $circle) { |
|
| 265 | 265 | return $circle->getUniqueId(); |
| 266 | 266 | }, $davCard->getCircles() |
| 267 | 267 | ); |
| 268 | 268 | |
| 269 | 269 | $members = $this->membersRequest->getMembersByContactId($davCard->getUniqueId()); |
| 270 | 270 | $this->miscService->log( |
| 271 | - 'Found ' . sizeof($members) . ' memberships with contactId=' . $davCard->getUniqueId(), 0 |
|
| 271 | + 'Found '.sizeof($members).' memberships with contactId='.$davCard->getUniqueId(), 0 |
|
| 272 | 272 | ); |
| 273 | 273 | |
| 274 | 274 | foreach ($members as $member) { |
| 275 | 275 | if (!in_array($member->getCircleId(), $circles)) { |
| 276 | 276 | $this->miscService->log( |
| 277 | - 'Removing membership ' . $member->getMemberId() . ' from ' . $member->getCircleId(), 0 |
|
| 277 | + 'Removing membership '.$member->getMemberId().' from '.$member->getCircleId(), 0 |
|
| 278 | 278 | ); |
| 279 | 279 | $this->membersRequest->removeMember($member); |
| 280 | 280 | } |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | } |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | - $davCard->setUserId($davCard->getOwner() . ':' . $davCard->getContactId()); |
|
| 357 | + $davCard->setUserId($davCard->getOwner().':'.$davCard->getContactId()); |
|
| 358 | 358 | |
| 359 | 359 | return DavCard::TYPE_CONTACT; |
| 360 | 360 | } |
@@ -393,13 +393,13 @@ discard block |
||
| 393 | 393 | private function manageCircles(DavCard $davCard) { |
| 394 | 394 | $fromCard = $davCard->getGroups(); |
| 395 | 395 | $current = array_map( |
| 396 | - function (DeprecatedCircle $circle) { |
|
| 396 | + function(DeprecatedCircle $circle) { |
|
| 397 | 397 | return $circle->getContactGroupName(); |
| 398 | 398 | }, $this->getCirclesFromBook($davCard->getAddressBookId()) |
| 399 | 399 | ); |
| 400 | 400 | |
| 401 | 401 | $this->miscService->log( |
| 402 | - 'manage Circles from DavCard: ' . json_encode($fromCard) . ' - current: ' . json_encode($current) |
|
| 402 | + 'manage Circles from DavCard: '.json_encode($fromCard).' - current: '.json_encode($current) |
|
| 403 | 403 | ); |
| 404 | 404 | |
| 405 | 405 | $this->manageNewCircles($davCard, $fromCard, $current); |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | |
| 423 | 423 | $user = $this->userManager->get($davCard->getOwner()); |
| 424 | 424 | $circle = new DeprecatedCircle( |
| 425 | - $this->configService->contactsBackendType(), $group . ' - ' . $user->getDisplayName() |
|
| 425 | + $this->configService->contactsBackendType(), $group.' - '.$user->getDisplayName() |
|
| 426 | 426 | ); |
| 427 | 427 | $circle->setAltName($group); |
| 428 | 428 | $circle->generateUniqueId(); |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | $circle->setContactGroupName($group); |
| 431 | 431 | |
| 432 | 432 | $this->miscService->log( |
| 433 | - 'creating new Circle: ' . json_encode($circle) . ', with owner=' . $davCard->getOwner(), 0 |
|
| 433 | + 'creating new Circle: '.json_encode($circle).', with owner='.$davCard->getOwner(), 0 |
|
| 434 | 434 | ); |
| 435 | 435 | try { |
| 436 | 436 | $this->circlesRequest->createCircle($circle); |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | $owner->setStatus(DeprecatedMember::STATUS_MEMBER); |
| 440 | 440 | $this->membersService->updateCachedName($owner); |
| 441 | 441 | |
| 442 | - $this->miscService->log('creating new Member: ' . json_encode($owner), 0); |
|
| 442 | + $this->miscService->log('creating new Member: '.json_encode($owner), 0); |
|
| 443 | 443 | try { |
| 444 | 444 | $this->membersRequest->createMember($owner); |
| 445 | 445 | } catch (MemberAlreadyExistsException $e) { |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | * @param DavCard $davCard |
| 455 | 455 | */ |
| 456 | 456 | private function assignCirclesToCard(DavCard $davCard) { |
| 457 | - $this->miscService->log('assigning Circles to DavCard Model: ' . json_encode($davCard), 0); |
|
| 457 | + $this->miscService->log('assigning Circles to DavCard Model: '.json_encode($davCard), 0); |
|
| 458 | 458 | foreach ($davCard->getGroups() as $group) { |
| 459 | 459 | try { |
| 460 | 460 | $davCard->addCircle( |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | } |
| 465 | 465 | } |
| 466 | 466 | |
| 467 | - $this->miscService->log('assigned Circles to DavCard Model: ' . json_encode($davCard), 0); |
|
| 467 | + $this->miscService->log('assigned Circles to DavCard Model: '.json_encode($davCard), 0); |
|
| 468 | 468 | } |
| 469 | 469 | |
| 470 | 470 | |
@@ -509,12 +509,12 @@ discard block |
||
| 509 | 509 | * @return string |
| 510 | 510 | */ |
| 511 | 511 | public function getOwnerFromAddressBook(int $bookId): string { |
| 512 | - $this->miscService->log('Retrieving Owner from book:' . $bookId, 0); |
|
| 512 | + $this->miscService->log('Retrieving Owner from book:'.$bookId, 0); |
|
| 513 | 513 | $data = $this->cardDavBackend->getAddressBookById($bookId); |
| 514 | 514 | |
| 515 | 515 | // let's assume the format is principals/users/OWNER |
| 516 | 516 | $owner = substr($data['principaluri'], 17); |
| 517 | - $this->miscService->log('Retrieved Owner:' . $owner, 0); |
|
| 517 | + $this->miscService->log('Retrieved Owner:'.$owner, 0); |
|
| 518 | 518 | |
| 519 | 519 | return $owner; |
| 520 | 520 | } |
@@ -531,12 +531,12 @@ discard block |
||
| 531 | 531 | $this->manageDeprecatedContacts(); |
| 532 | 532 | $this->manageDeprecatedCircles(); |
| 533 | 533 | $users = $this->userManager->search(''); |
| 534 | - $this->miscService->log('initiating migration for ' . sizeof($users) . ' users', 0); |
|
| 534 | + $this->miscService->log('initiating migration for '.sizeof($users).' users', 0); |
|
| 535 | 535 | foreach ($users as $user) { |
| 536 | - $this->miscService->log('retrieving books for user=' . $user->getUID(), 0); |
|
| 537 | - $books = $this->cardDavBackend->getAddressBooksForUser('principals/users/' . $user->getUID()); |
|
| 536 | + $this->miscService->log('retrieving books for user='.$user->getUID(), 0); |
|
| 537 | + $books = $this->cardDavBackend->getAddressBooksForUser('principals/users/'.$user->getUID()); |
|
| 538 | 538 | |
| 539 | - $this->miscService->log('initiating migration for user=' . $user->getUID(), 0); |
|
| 539 | + $this->miscService->log('initiating migration for user='.$user->getUID(), 0); |
|
| 540 | 540 | foreach ($books as $book) { |
| 541 | 541 | $this->migrateBook($book['id']); |
| 542 | 542 | } |
@@ -549,16 +549,16 @@ discard block |
||
| 549 | 549 | private function manageDeprecatedContacts() { |
| 550 | 550 | $contacts = $this->membersRequest->getMembersByContactId(); |
| 551 | 551 | $this->miscService->log( |
| 552 | - 'Managing Deprecated Contacts, checking ' . sizeof($contacts) . ' known contacts in database', 0 |
|
| 552 | + 'Managing Deprecated Contacts, checking '.sizeof($contacts).' known contacts in database', 0 |
|
| 553 | 553 | ); |
| 554 | 554 | |
| 555 | 555 | foreach ($contacts as $contact) { |
| 556 | 556 | try { |
| 557 | 557 | $this->getDavCardFromMember($contact); |
| 558 | - $this->miscService->log('Contact is not deprecated: ' . json_encode($contact)); |
|
| 558 | + $this->miscService->log('Contact is not deprecated: '.json_encode($contact)); |
|
| 559 | 559 | } catch (MemberDoesNotExistException $e) { |
| 560 | 560 | $this->miscService->log( |
| 561 | - 'Contact is deprecated and will be removed: ' . json_encode($contact) |
|
| 561 | + 'Contact is deprecated and will be removed: '.json_encode($contact) |
|
| 562 | 562 | ); |
| 563 | 563 | $this->membersRequest->removeMember($contact); |
| 564 | 564 | } |
@@ -573,15 +573,15 @@ discard block |
||
| 573 | 573 | */ |
| 574 | 574 | private function manageDeprecatedCircles(int $bookId = 0) { |
| 575 | 575 | $knownBooks = [$bookId]; |
| 576 | - $this->miscService->log('Managing Deprecated Circles, using bookId: ' . $bookId, 0); |
|
| 576 | + $this->miscService->log('Managing Deprecated Circles, using bookId: '.$bookId, 0); |
|
| 577 | 577 | |
| 578 | 578 | if ($bookId > 0) { |
| 579 | 579 | $knownBooks = []; |
| 580 | 580 | $contacts = $this->membersRequest->getMembersByContactId(); |
| 581 | - $this->miscService->log(sizeof($contacts) . ' known members as contacts in Circles DB', 0); |
|
| 581 | + $this->miscService->log(sizeof($contacts).' known members as contacts in Circles DB', 0); |
|
| 582 | 582 | |
| 583 | 583 | foreach ($contacts as $contact) { |
| 584 | - [$bookId,] = explode('/', $contact->getContactId(), 2); |
|
| 584 | + [$bookId, ] = explode('/', $contact->getContactId(), 2); |
|
| 585 | 585 | if (in_array($bookId, $knownBooks)) { |
| 586 | 586 | continue; |
| 587 | 587 | } |
@@ -590,17 +590,17 @@ discard block |
||
| 590 | 590 | } |
| 591 | 591 | } |
| 592 | 592 | |
| 593 | - $this->miscService->log('Known books: ' . json_encode($knownBooks), 0); |
|
| 593 | + $this->miscService->log('Known books: '.json_encode($knownBooks), 0); |
|
| 594 | 594 | foreach ($knownBooks as $bookId) { |
| 595 | - $this->miscService->log('retrieving local Circles data for bookId=' . $bookId, 0); |
|
| 595 | + $this->miscService->log('retrieving local Circles data for bookId='.$bookId, 0); |
|
| 596 | 596 | $circles = $this->circlesRequest->getFromContactBook($bookId); |
| 597 | 597 | $this->miscService->log( |
| 598 | - 'Known circles for bookId=' . $bookId . ': ' . json_encode($circles), 0 |
|
| 598 | + 'Known circles for bookId='.$bookId.': '.json_encode($circles), 0 |
|
| 599 | 599 | ); |
| 600 | 600 | |
| 601 | 601 | $fromBook = $this->getExistingCirclesFromBook($bookId); |
| 602 | 602 | $this->miscService->log( |
| 603 | - 'Generated circles from bookId=' . $bookId . ': ' . json_encode($fromBook), 0 |
|
| 603 | + 'Generated circles from bookId='.$bookId.': '.json_encode($fromBook), 0 |
|
| 604 | 604 | ); |
| 605 | 605 | |
| 606 | 606 | foreach ($circles as $circle) { |
@@ -609,7 +609,7 @@ discard block |
||
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | $this->miscService->log( |
| 612 | - $circle->getUniqueId() . ' is a deprecated Circle and will be destroyed', 0 |
|
| 612 | + $circle->getUniqueId().' is a deprecated Circle and will be destroyed', 0 |
|
| 613 | 613 | ); |
| 614 | 614 | |
| 615 | 615 | $this->membersRequest->removeAllFromCircle($circle->getUniqueId()); |
@@ -631,7 +631,7 @@ discard block |
||
| 631 | 631 | $cards = $this->cardDavBackend->getCards($bookId); |
| 632 | 632 | |
| 633 | 633 | $this->miscService->log( |
| 634 | - 'retrieving existing circles from bookId=' . $bookId . ' in ' . sizeof($cards) . ' cards', 0 |
|
| 634 | + 'retrieving existing circles from bookId='.$bookId.' in '.sizeof($cards).' cards', 0 |
|
| 635 | 635 | ); |
| 636 | 636 | foreach ($cards as $card) { |
| 637 | 637 | $davCard = $this->generateDavCardFromCard($bookId, $card); |
@@ -639,17 +639,17 @@ discard block |
||
| 639 | 639 | $circles = array_merge($circles, $davCard->getCircles()); |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | - $this->miscService->log('Found ' . sizeof($circles) . ' Circles from book=' . $bookId, 0); |
|
| 642 | + $this->miscService->log('Found '.sizeof($circles).' Circles from book='.$bookId, 0); |
|
| 643 | 643 | $existing = array_unique( |
| 644 | 644 | array_map( |
| 645 | - function (DeprecatedCircle $circle) { |
|
| 645 | + function(DeprecatedCircle $circle) { |
|
| 646 | 646 | return $circle->getContactGroupName(); |
| 647 | 647 | }, $circles |
| 648 | 648 | ) |
| 649 | 649 | ); |
| 650 | 650 | |
| 651 | 651 | $this->miscService->log( |
| 652 | - 'retrieved existing circles from book=' . $bookId . ': ' . json_encode($existing), 0 |
|
| 652 | + 'retrieved existing circles from book='.$bookId.': '.json_encode($existing), 0 |
|
| 653 | 653 | ); |
| 654 | 654 | |
| 655 | 655 | return $existing; |
@@ -664,14 +664,14 @@ discard block |
||
| 664 | 664 | */ |
| 665 | 665 | public function getDavCardFromMember(DeprecatedMember $contact): DavCard { |
| 666 | 666 | [$bookId, $cardUri] = explode('/', $contact->getContactId(), 2); |
| 667 | - $this->miscService->log('Retrieving DavCard from book:' . $bookId . ', uri:' . $cardUri, 0); |
|
| 667 | + $this->miscService->log('Retrieving DavCard from book:'.$bookId.', uri:'.$cardUri, 0); |
|
| 668 | 668 | |
| 669 | 669 | $cards = $this->cardDavBackend->getCards($bookId); |
| 670 | - $this->miscService->log('Book contains ' . sizeof($cards) . ' cards', 0); |
|
| 670 | + $this->miscService->log('Book contains '.sizeof($cards).' cards', 0); |
|
| 671 | 671 | foreach ($cards as $card) { |
| 672 | 672 | if ($card['uri'] === $cardUri) { |
| 673 | 673 | $davCard = $this->generateDavCardFromCard($bookId, $card); |
| 674 | - $this->miscService->log('Retrieved DavCard: ' . json_encode($card)); |
|
| 674 | + $this->miscService->log('Retrieved DavCard: '.json_encode($card)); |
|
| 675 | 675 | |
| 676 | 676 | return $davCard; |
| 677 | 677 | } |
@@ -689,11 +689,11 @@ discard block |
||
| 689 | 689 | return; |
| 690 | 690 | } |
| 691 | 691 | |
| 692 | - $this->miscService->log('migrating book: ' . $bookId, 0); |
|
| 692 | + $this->miscService->log('migrating book: '.$bookId, 0); |
|
| 693 | 693 | $owner = $this->getOwnerFromAddressBook($bookId); |
| 694 | 694 | |
| 695 | 695 | $cards = $this->cardDavBackend->getCards($bookId); |
| 696 | - $this->miscService->log('found ' . sizeof($cards) . 'cards from book=' . $bookId, 0); |
|
| 696 | + $this->miscService->log('found '.sizeof($cards).'cards from book='.$bookId, 0); |
|
| 697 | 697 | |
| 698 | 698 | foreach ($cards as $card) { |
| 699 | 699 | $davCard = new DavCard(); |
@@ -251,7 +251,7 @@ |
||
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | $members = array_map( |
| 254 | - function (FederatedUser $federatedUser) use ($patron) { |
|
| 254 | + function(FederatedUser $federatedUser) use ($patron) { |
|
| 255 | 255 | $member = new Member(); |
| 256 | 256 | $member->importFromIFederatedUser($federatedUser); |
| 257 | 257 | $member->setInvitedBy($patron); |