@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | */ |
| 262 | 262 | #[Override] |
| 263 | 263 | public function propPatch($path, PropPatch $propPatch): void { |
| 264 | - $propPatch->handleRemaining(function (array $changedProps) use ($path) { |
|
| 264 | + $propPatch->handleRemaining(function(array $changedProps) use ($path) { |
|
| 265 | 265 | return $this->updateProperties($path, $changedProps); |
| 266 | 266 | }); |
| 267 | 267 | } |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | * Prefetch all user properties in a directory |
| 358 | 358 | */ |
| 359 | 359 | private function cacheDirectory(string $path, Directory $node): void { |
| 360 | - $prefix = ltrim($path . '/', '/'); |
|
| 360 | + $prefix = ltrim($path.'/', '/'); |
|
| 361 | 361 | $query = $this->connection->getQueryBuilder(); |
| 362 | 362 | $query->select('name', 'p.propertypath', 'p.propertyname', 'p.propertyvalue', 'p.valuetype') |
| 363 | 363 | ->from('filecache', 'f') |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | $propsByPath = []; |
| 378 | 378 | |
| 379 | 379 | while ($row = $result->fetchAssociative()) { |
| 380 | - $childPath = $prefix . $row['name']; |
|
| 380 | + $childPath = $prefix.$row['name']; |
|
| 381 | 381 | if (!isset($propsByPath[$childPath])) { |
| 382 | 382 | $propsByPath[$childPath] = []; |
| 383 | 383 | } |
@@ -396,16 +396,16 @@ discard block |
||
| 396 | 396 | if ($calendar instanceof Calendar) { |
| 397 | 397 | $user = str_replace('principals/users/', '', $calendar->getPrincipalURI()); |
| 398 | 398 | if (!isset($users[$user])) { |
| 399 | - $users[$user] = ['calendars/' . $user]; |
|
| 399 | + $users[$user] = ['calendars/'.$user]; |
|
| 400 | 400 | } |
| 401 | - $users[$user][] = 'calendars/' . $user . '/' . $calendar->getUri(); |
|
| 401 | + $users[$user][] = 'calendars/'.$user.'/'.$calendar->getUri(); |
|
| 402 | 402 | } elseif ($calendar instanceof Inbox || $calendar instanceof Outbox || $calendar instanceof TrashbinHome || $calendar instanceof ExternalCalendar) { |
| 403 | 403 | if ($calendar->getOwner()) { |
| 404 | 404 | $user = str_replace('principals/users/', '', $calendar->getOwner()); |
| 405 | 405 | if (!isset($users[$user])) { |
| 406 | - $users[$user] = ['calendars/' . $user]; |
|
| 406 | + $users[$user] = ['calendars/'.$user]; |
|
| 407 | 407 | } |
| 408 | - $users[$user][] = 'calendars/' . $user . '/' . $calendar->getName(); |
|
| 408 | + $users[$user][] = 'calendars/'.$user.'/'.$calendar->getName(); |
|
| 409 | 409 | } |
| 410 | 410 | } |
| 411 | 411 | } |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | self::checkIsArrayOfScalar($name, $item); |
| 573 | 573 | } elseif ($item !== null && !is_scalar($item)) { |
| 574 | 574 | throw new DavException( |
| 575 | - "Property \"$name\" has an invalid value of array containing " . gettype($item), |
|
| 575 | + "Property \"$name\" has an invalid value of array containing ".gettype($item), |
|
| 576 | 576 | ); |
| 577 | 577 | } |
| 578 | 578 | } |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | $this->validateProperty($path, $name, $value); |
| 598 | 598 | } catch (DavException $e) { |
| 599 | 599 | throw new DavException( |
| 600 | - "Property \"$name\" has an invalid value: " . $e->getMessage(), |
|
| 600 | + "Property \"$name\" has an invalid value: ".$e->getMessage(), |
|
| 601 | 601 | 0, |
| 602 | 602 | $e, |
| 603 | 603 | ); |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | self::checkIsArrayOfScalar($name, $value); |
| 618 | 618 | } elseif (!is_object($value)) { |
| 619 | 619 | throw new DavException( |
| 620 | - "Property \"$name\" has an invalid value of type " . gettype($value), |
|
| 620 | + "Property \"$name\" has an invalid value of type ".gettype($value), |
|
| 621 | 621 | ); |
| 622 | 622 | } else { |
| 623 | 623 | if (!str_starts_with($value::class, 'Sabre\\DAV\\Xml\\Property\\') |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | && !str_starts_with($value::class, 'Sabre\\CardDAV\\Xml\\Property\\') |
| 626 | 626 | && !str_starts_with($value::class, 'OCA\\DAV\\')) { |
| 627 | 627 | throw new DavException( |
| 628 | - "Property \"$name\" has an invalid value of class " . $value::class, |
|
| 628 | + "Property \"$name\" has an invalid value of class ".$value::class, |
|
| 629 | 629 | ); |
| 630 | 630 | } |
| 631 | 631 | } |
@@ -674,7 +674,7 @@ discard block |
||
| 674 | 674 | |
| 675 | 675 | try { |
| 676 | 676 | // Build path relative to the dav base URI to be used later to find the node |
| 677 | - $value = new LocalHref($this->server->calculateUri($href) . '/'); |
|
| 677 | + $value = new LocalHref($this->server->calculateUri($href).'/'); |
|
| 678 | 678 | } catch (DavException\Forbidden) { |
| 679 | 679 | // Not existing calendars will be handled later when the value is validated |
| 680 | 680 | } |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function run($argument) { |
| 43 | - $offset = (int)$argument['offset']; |
|
| 44 | - $stopAt = (int)$argument['stopAt']; |
|
| 43 | + $offset = (int) $argument['offset']; |
|
| 44 | + $stopAt = (int) $argument['stopAt']; |
|
| 45 | 45 | |
| 46 | - $this->logger->info('Building calendar reminder index (' . $offset . '/' . $stopAt . ')'); |
|
| 46 | + $this->logger->info('Building calendar reminder index ('.$offset.'/'.$stopAt.')'); |
|
| 47 | 47 | |
| 48 | 48 | $offset = $this->buildIndex($offset, $stopAt); |
| 49 | 49 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | 'offset' => $offset, |
| 55 | 55 | 'stopAt' => $stopAt |
| 56 | 56 | ]); |
| 57 | - $this->logger->info('Scheduled a new BuildReminderIndexBackgroundJob with offset ' . $offset); |
|
| 57 | + $this->logger->info('Scheduled a new BuildReminderIndexBackgroundJob with offset '.$offset); |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | $result = $query->executeQuery(); |
| 77 | 77 | while ($row = $result->fetchAssociative()) { |
| 78 | - $offset = (int)$row['id']; |
|
| 78 | + $offset = (int) $row['id']; |
|
| 79 | 79 | if (is_resource($row['calendardata'])) { |
| 80 | 80 | $row['calendardata'] = stream_get_contents($row['calendardata']); |
| 81 | 81 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))); |
| 78 | 78 | |
| 79 | 79 | $result = $query->executeQuery(); |
| 80 | - $column = (int)$result->fetchOne(); |
|
| 80 | + $column = (int) $result->fetchOne(); |
|
| 81 | 81 | $result->closeCursor(); |
| 82 | 82 | return $column; |
| 83 | 83 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * @return array |
| 101 | 101 | */ |
| 102 | 102 | public function getAddressBooksForUser($principalUri) { |
| 103 | - return $this->atomic(function () use ($principalUri) { |
|
| 103 | + return $this->atomic(function() use ($principalUri) { |
|
| 104 | 104 | $principalUriOriginal = $principalUri; |
| 105 | 105 | $principalUri = $this->convertPrincipal($principalUri, true); |
| 106 | 106 | $select = $this->db->getQueryBuilder(); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | 'uri' => $row['uri'], |
| 118 | 118 | 'principaluri' => $this->convertPrincipal($row['principaluri'], false), |
| 119 | 119 | '{DAV:}displayname' => $row['displayname'], |
| 120 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
| 120 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
| 121 | 121 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
| 122 | 122 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 123 | 123 | ]; |
@@ -148,13 +148,13 @@ discard block |
||
| 148 | 148 | ->andWhere($select->expr()->notIn('s.id', $select->createFunction($subSelect->getSQL()), IQueryBuilder::PARAM_INT_ARRAY)); |
| 149 | 149 | $result = $select->executeQuery(); |
| 150 | 150 | |
| 151 | - $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
| 151 | + $readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only'; |
|
| 152 | 152 | while ($row = $result->fetchAssociative()) { |
| 153 | 153 | if ($row['principaluri'] === $principalUri) { |
| 154 | 154 | continue; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - $readOnly = (int)$row['access'] === Backend::ACCESS_READ; |
|
| 157 | + $readOnly = (int) $row['access'] === Backend::ACCESS_READ; |
|
| 158 | 158 | if (isset($addressBooks[$row['id']])) { |
| 159 | 159 | if ($readOnly) { |
| 160 | 160 | // New share can not have more permissions then the old one. |
@@ -168,18 +168,18 @@ discard block |
||
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | [, $name] = \Sabre\Uri\split($row['principaluri']); |
| 171 | - $uri = $row['uri'] . '_shared_by_' . $name; |
|
| 172 | - $displayName = $row['displayname'] . ' (' . ($this->userManager->getDisplayName($name) ?? $name ?? '') . ')'; |
|
| 171 | + $uri = $row['uri'].'_shared_by_'.$name; |
|
| 172 | + $displayName = $row['displayname'].' ('.($this->userManager->getDisplayName($name) ?? $name ?? '').')'; |
|
| 173 | 173 | |
| 174 | 174 | $addressBooks[$row['id']] = [ |
| 175 | 175 | 'id' => $row['id'], |
| 176 | 176 | 'uri' => $uri, |
| 177 | 177 | 'principaluri' => $principalUriOriginal, |
| 178 | 178 | '{DAV:}displayname' => $displayName, |
| 179 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
| 179 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
| 180 | 180 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
| 181 | 181 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 182 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $row['principaluri'], |
|
| 182 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $row['principaluri'], |
|
| 183 | 183 | $readOnlyPropertyName => $readOnly, |
| 184 | 184 | ]; |
| 185 | 185 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | 'uri' => $row['uri'], |
| 208 | 208 | 'principaluri' => $this->convertPrincipal($row['principaluri'], false), |
| 209 | 209 | '{DAV:}displayname' => $row['displayname'], |
| 210 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
| 210 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
| 211 | 211 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
| 212 | 212 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 213 | 213 | ]; |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | 'uri' => $row['uri'], |
| 240 | 240 | 'principaluri' => $row['principaluri'], |
| 241 | 241 | '{DAV:}displayname' => $row['displayname'], |
| 242 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
| 242 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
| 243 | 243 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
| 244 | 244 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 245 | 245 | ]; |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | 'uri' => $row['uri'], |
| 270 | 270 | 'principaluri' => $row['principaluri'], |
| 271 | 271 | '{DAV:}displayname' => $row['displayname'], |
| 272 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
| 272 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
| 273 | 273 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
| 274 | 274 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 275 | 275 | |
@@ -277,8 +277,8 @@ discard block |
||
| 277 | 277 | |
| 278 | 278 | // system address books are always read only |
| 279 | 279 | if ($principal === 'principals/system/system') { |
| 280 | - $addressBook['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'] = $row['principaluri']; |
|
| 281 | - $addressBook['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'] = true; |
|
| 280 | + $addressBook['{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'] = $row['principaluri']; |
|
| 281 | + $addressBook['{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only'] = true; |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | $this->addOwnerPrincipal($addressBook); |
@@ -305,22 +305,22 @@ discard block |
||
| 305 | 305 | public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch) { |
| 306 | 306 | $supportedProperties = [ |
| 307 | 307 | '{DAV:}displayname', |
| 308 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description', |
|
| 308 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description', |
|
| 309 | 309 | ]; |
| 310 | 310 | |
| 311 | - $propPatch->handle($supportedProperties, function ($mutations) use ($addressBookId) { |
|
| 311 | + $propPatch->handle($supportedProperties, function($mutations) use ($addressBookId) { |
|
| 312 | 312 | $updates = []; |
| 313 | 313 | foreach ($mutations as $property => $newValue) { |
| 314 | 314 | switch ($property) { |
| 315 | 315 | case '{DAV:}displayname': |
| 316 | 316 | $updates['displayname'] = $newValue; |
| 317 | 317 | break; |
| 318 | - case '{' . Plugin::NS_CARDDAV . '}addressbook-description': |
|
| 318 | + case '{'.Plugin::NS_CARDDAV.'}addressbook-description': |
|
| 319 | 319 | $updates['description'] = $newValue; |
| 320 | 320 | break; |
| 321 | 321 | } |
| 322 | 322 | } |
| 323 | - [$addressBookRow, $shares] = $this->atomic(function () use ($addressBookId, $updates) { |
|
| 323 | + [$addressBookRow, $shares] = $this->atomic(function() use ($addressBookId, $updates) { |
|
| 324 | 324 | $query = $this->db->getQueryBuilder(); |
| 325 | 325 | $query->update('addressbooks'); |
| 326 | 326 | |
@@ -332,12 +332,12 @@ discard block |
||
| 332 | 332 | |
| 333 | 333 | $this->addChange($addressBookId, '', 2); |
| 334 | 334 | |
| 335 | - $addressBookRow = $this->getAddressBookById((int)$addressBookId); |
|
| 336 | - $shares = $this->getShares((int)$addressBookId); |
|
| 335 | + $addressBookRow = $this->getAddressBookById((int) $addressBookId); |
|
| 336 | + $shares = $this->getShares((int) $addressBookId); |
|
| 337 | 337 | return [$addressBookRow, $shares]; |
| 338 | 338 | }, $this->db); |
| 339 | 339 | |
| 340 | - $this->dispatcher->dispatchTyped(new AddressBookUpdatedEvent((int)$addressBookId, $addressBookRow, $shares, $mutations)); |
|
| 340 | + $this->dispatcher->dispatchTyped(new AddressBookUpdatedEvent((int) $addressBookId, $addressBookRow, $shares, $mutations)); |
|
| 341 | 341 | |
| 342 | 342 | return true; |
| 343 | 343 | }); |
@@ -371,11 +371,11 @@ discard block |
||
| 371 | 371 | case '{DAV:}displayname': |
| 372 | 372 | $values['displayname'] = $newValue; |
| 373 | 373 | break; |
| 374 | - case '{' . Plugin::NS_CARDDAV . '}addressbook-description': |
|
| 374 | + case '{'.Plugin::NS_CARDDAV.'}addressbook-description': |
|
| 375 | 375 | $values['description'] = $newValue; |
| 376 | 376 | break; |
| 377 | 377 | default: |
| 378 | - throw new BadRequest('Unknown property: ' . $property); |
|
| 378 | + throw new BadRequest('Unknown property: '.$property); |
|
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | $values['displayname'] = $url; |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | - [$addressBookId, $addressBookRow] = $this->atomic(function () use ($values) { |
|
| 388 | + [$addressBookId, $addressBookRow] = $this->atomic(function() use ($values) { |
|
| 389 | 389 | $query = $this->db->getQueryBuilder(); |
| 390 | 390 | $query->insert('addressbooks') |
| 391 | 391 | ->values([ |
@@ -417,8 +417,8 @@ discard block |
||
| 417 | 417 | * @return void |
| 418 | 418 | */ |
| 419 | 419 | public function deleteAddressBook($addressBookId) { |
| 420 | - $this->atomic(function () use ($addressBookId): void { |
|
| 421 | - $addressBookId = (int)$addressBookId; |
|
| 420 | + $this->atomic(function() use ($addressBookId): void { |
|
| 421 | + $addressBookId = (int) $addressBookId; |
|
| 422 | 422 | $addressBookData = $this->getAddressBookById($addressBookId); |
| 423 | 423 | $shares = $this->getShares($addressBookId); |
| 424 | 424 | |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | |
| 483 | 483 | $result = $query->executeQuery(); |
| 484 | 484 | while ($row = $result->fetchAssociative()) { |
| 485 | - $row['etag'] = '"' . $row['etag'] . '"'; |
|
| 485 | + $row['etag'] = '"'.$row['etag'].'"'; |
|
| 486 | 486 | |
| 487 | 487 | $modified = false; |
| 488 | 488 | $row['carddata'] = $this->readBlob($row['carddata'], $modified); |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | if (!$row) { |
| 523 | 523 | return false; |
| 524 | 524 | } |
| 525 | - $row['etag'] = '"' . $row['etag'] . '"'; |
|
| 525 | + $row['etag'] = '"'.$row['etag'].'"'; |
|
| 526 | 526 | |
| 527 | 527 | $modified = false; |
| 528 | 528 | $row['carddata'] = $this->readBlob($row['carddata'], $modified); |
@@ -564,7 +564,7 @@ discard block |
||
| 564 | 564 | $result = $query->executeQuery(); |
| 565 | 565 | |
| 566 | 566 | while ($row = $result->fetchAssociative()) { |
| 567 | - $row['etag'] = '"' . $row['etag'] . '"'; |
|
| 567 | + $row['etag'] = '"'.$row['etag'].'"'; |
|
| 568 | 568 | |
| 569 | 569 | $modified = false; |
| 570 | 570 | $row['carddata'] = $this->readBlob($row['carddata'], $modified); |
@@ -608,7 +608,7 @@ discard block |
||
| 608 | 608 | public function createCard($addressBookId, $cardUri, $cardData, bool $checkAlreadyExists = true) { |
| 609 | 609 | $etag = md5($cardData); |
| 610 | 610 | $uid = $this->getUID($cardData); |
| 611 | - return $this->atomic(function () use ($addressBookId, $cardUri, $cardData, $checkAlreadyExists, $etag, $uid) { |
|
| 611 | + return $this->atomic(function() use ($addressBookId, $cardUri, $cardData, $checkAlreadyExists, $etag, $uid) { |
|
| 612 | 612 | if ($checkAlreadyExists) { |
| 613 | 613 | $q = $this->db->getQueryBuilder(); |
| 614 | 614 | $q->select('uid') |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | ->andWhere($q->expr()->eq('uid', $q->createNamedParameter($uid))) |
| 618 | 618 | ->setMaxResults(1); |
| 619 | 619 | $result = $q->executeQuery(); |
| 620 | - $count = (bool)$result->fetchOne(); |
|
| 620 | + $count = (bool) $result->fetchOne(); |
|
| 621 | 621 | $result->closeCursor(); |
| 622 | 622 | if ($count) { |
| 623 | 623 | throw new \Sabre\DAV\Exception\BadRequest('VCard object with uid already exists in this addressbook collection.'); |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | $objectRow = $this->getCard($addressBookId, $cardUri); |
| 649 | 649 | $this->dispatcher->dispatchTyped(new CardCreatedEvent($addressBookId, $addressBookData, $shares, $objectRow)); |
| 650 | 650 | |
| 651 | - return '"' . $etag . '"'; |
|
| 651 | + return '"'.$etag.'"'; |
|
| 652 | 652 | }, $this->db); |
| 653 | 653 | } |
| 654 | 654 | |
@@ -681,13 +681,13 @@ discard block |
||
| 681 | 681 | $uid = $this->getUID($cardData); |
| 682 | 682 | $etag = md5($cardData); |
| 683 | 683 | |
| 684 | - return $this->atomic(function () use ($addressBookId, $cardUri, $cardData, $uid, $etag) { |
|
| 684 | + return $this->atomic(function() use ($addressBookId, $cardUri, $cardData, $uid, $etag) { |
|
| 685 | 685 | $query = $this->db->getQueryBuilder(); |
| 686 | 686 | |
| 687 | 687 | // check for recently stored etag and stop if it is the same |
| 688 | 688 | $etagCacheKey = "$addressBookId#$cardUri"; |
| 689 | 689 | if (isset($this->etagCache[$etagCacheKey]) && $this->etagCache[$etagCacheKey] === $etag) { |
| 690 | - return '"' . $etag . '"'; |
|
| 690 | + return '"'.$etag.'"'; |
|
| 691 | 691 | } |
| 692 | 692 | |
| 693 | 693 | $query->update($this->dbCardsTable) |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | $shares = $this->getShares($addressBookId); |
| 710 | 710 | $objectRow = $this->getCard($addressBookId, $cardUri); |
| 711 | 711 | $this->dispatcher->dispatchTyped(new CardUpdatedEvent($addressBookId, $addressBookData, $shares, $objectRow)); |
| 712 | - return '"' . $etag . '"'; |
|
| 712 | + return '"'.$etag.'"'; |
|
| 713 | 713 | }, $this->db); |
| 714 | 714 | } |
| 715 | 715 | |
@@ -717,12 +717,12 @@ discard block |
||
| 717 | 717 | * @throws Exception |
| 718 | 718 | */ |
| 719 | 719 | public function moveCard(int $sourceAddressBookId, string $sourceObjectUri, int $targetAddressBookId, string $tragetObjectUri): bool { |
| 720 | - return $this->atomic(function () use ($sourceAddressBookId, $sourceObjectUri, $targetAddressBookId, $tragetObjectUri) { |
|
| 720 | + return $this->atomic(function() use ($sourceAddressBookId, $sourceObjectUri, $targetAddressBookId, $tragetObjectUri) { |
|
| 721 | 721 | $card = $this->getCard($sourceAddressBookId, $sourceObjectUri); |
| 722 | 722 | if (empty($card)) { |
| 723 | 723 | return false; |
| 724 | 724 | } |
| 725 | - $sourceObjectId = (int)$card['id']; |
|
| 725 | + $sourceObjectId = (int) $card['id']; |
|
| 726 | 726 | |
| 727 | 727 | $query = $this->db->getQueryBuilder(); |
| 728 | 728 | $query->update('cards') |
@@ -765,7 +765,7 @@ discard block |
||
| 765 | 765 | * @return bool |
| 766 | 766 | */ |
| 767 | 767 | public function deleteCard($addressBookId, $cardUri) { |
| 768 | - return $this->atomic(function () use ($addressBookId, $cardUri) { |
|
| 768 | + return $this->atomic(function() use ($addressBookId, $cardUri) { |
|
| 769 | 769 | $addressBookData = $this->getAddressBookById($addressBookId); |
| 770 | 770 | $shares = $this->getShares($addressBookId); |
| 771 | 771 | $objectRow = $this->getCard($addressBookId, $cardUri); |
@@ -855,7 +855,7 @@ discard block |
||
| 855 | 855 | $maxLimit = $this->config->getSystemValueInt('carddav_sync_request_truncation', 2500); |
| 856 | 856 | $limit = ($limit === null) ? $maxLimit : min($limit, $maxLimit); |
| 857 | 857 | // Current synctoken |
| 858 | - return $this->atomic(function () use ($addressBookId, $syncToken, $syncLevel, $limit) { |
|
| 858 | + return $this->atomic(function() use ($addressBookId, $syncToken, $syncLevel, $limit) { |
|
| 859 | 859 | $qb = $this->db->getQueryBuilder(); |
| 860 | 860 | $qb->select('synctoken') |
| 861 | 861 | ->from('addressbooks') |
@@ -899,7 +899,7 @@ discard block |
||
| 899 | 899 | } else { |
| 900 | 900 | $lastID = $values[array_key_last($values)]['id']; |
| 901 | 901 | $result['added'] = array_column($values, 'uri'); |
| 902 | - $result['syncToken'] = count($result['added']) >= $limit ? "init_{$lastID}_$initialSyncToken" : $initialSyncToken ; |
|
| 902 | + $result['syncToken'] = count($result['added']) >= $limit ? "init_{$lastID}_$initialSyncToken" : $initialSyncToken; |
|
| 903 | 903 | $result['result_truncated'] = count($result['added']) >= $limit; |
| 904 | 904 | } |
| 905 | 905 | } elseif ($syncToken) { |
@@ -983,7 +983,7 @@ discard block |
||
| 983 | 983 | } |
| 984 | 984 | $lastID = $values[array_key_last($values)]['id']; |
| 985 | 985 | if (count($values) >= $limit) { |
| 986 | - $result['syncToken'] = 'init_' . $lastID . '_' . $currentToken; |
|
| 986 | + $result['syncToken'] = 'init_'.$lastID.'_'.$currentToken; |
|
| 987 | 987 | $result['result_truncated'] = true; |
| 988 | 988 | } |
| 989 | 989 | |
@@ -1004,13 +1004,13 @@ discard block |
||
| 1004 | 1004 | * @return void |
| 1005 | 1005 | */ |
| 1006 | 1006 | protected function addChange(int $addressBookId, string $objectUri, int $operation): void { |
| 1007 | - $this->atomic(function () use ($addressBookId, $objectUri, $operation): void { |
|
| 1007 | + $this->atomic(function() use ($addressBookId, $objectUri, $operation): void { |
|
| 1008 | 1008 | $query = $this->db->getQueryBuilder(); |
| 1009 | 1009 | $query->select('synctoken') |
| 1010 | 1010 | ->from('addressbooks') |
| 1011 | 1011 | ->where($query->expr()->eq('id', $query->createNamedParameter($addressBookId))); |
| 1012 | 1012 | $result = $query->executeQuery(); |
| 1013 | - $syncToken = (int)$result->fetchOne(); |
|
| 1013 | + $syncToken = (int) $result->fetchOne(); |
|
| 1014 | 1014 | $result->closeCursor(); |
| 1015 | 1015 | |
| 1016 | 1016 | $query = $this->db->getQueryBuilder(); |
@@ -1079,7 +1079,7 @@ discard block |
||
| 1079 | 1079 | * @param list<string> $remove |
| 1080 | 1080 | */ |
| 1081 | 1081 | public function updateShares(IShareable $shareable, array $add, array $remove): void { |
| 1082 | - $this->atomic(function () use ($shareable, $add, $remove): void { |
|
| 1082 | + $this->atomic(function() use ($shareable, $add, $remove): void { |
|
| 1083 | 1083 | $addressBookId = $shareable->getResourceId(); |
| 1084 | 1084 | $addressBookData = $this->getAddressBookById($addressBookId); |
| 1085 | 1085 | $oldShares = $this->getShares($addressBookId); |
@@ -1113,7 +1113,7 @@ discard block |
||
| 1113 | 1113 | * @return array an array of contacts which are arrays of key-value-pairs |
| 1114 | 1114 | */ |
| 1115 | 1115 | public function search($addressBookId, $pattern, $searchProperties, $options = []): array { |
| 1116 | - return $this->atomic(function () use ($addressBookId, $pattern, $searchProperties, $options) { |
|
| 1116 | + return $this->atomic(function() use ($addressBookId, $pattern, $searchProperties, $options) { |
|
| 1117 | 1117 | return $this->searchByAddressBookIds([$addressBookId], $pattern, $searchProperties, $options); |
| 1118 | 1118 | }, $this->db); |
| 1119 | 1119 | } |
@@ -1131,9 +1131,9 @@ discard block |
||
| 1131 | 1131 | string $pattern, |
| 1132 | 1132 | array $searchProperties, |
| 1133 | 1133 | array $options = []): array { |
| 1134 | - return $this->atomic(function () use ($principalUri, $pattern, $searchProperties, $options) { |
|
| 1135 | - $addressBookIds = array_map(static function ($row):int { |
|
| 1136 | - return (int)$row['id']; |
|
| 1134 | + return $this->atomic(function() use ($principalUri, $pattern, $searchProperties, $options) { |
|
| 1135 | + $addressBookIds = array_map(static function($row):int { |
|
| 1136 | + return (int) $row['id']; |
|
| 1137 | 1137 | }, $this->getAddressBooksForUser($principalUri)); |
| 1138 | 1138 | |
| 1139 | 1139 | return $this->searchByAddressBookIds($addressBookIds, $pattern, $searchProperties, $options); |
@@ -1168,7 +1168,7 @@ discard block |
||
| 1168 | 1168 | $useWildcards = !\array_key_exists('wildcard', $options) || $options['wildcard'] !== false; |
| 1169 | 1169 | |
| 1170 | 1170 | if ($escapePattern) { |
| 1171 | - $searchProperties = array_filter($searchProperties, function ($property) use ($pattern) { |
|
| 1171 | + $searchProperties = array_filter($searchProperties, function($property) use ($pattern) { |
|
| 1172 | 1172 | if ($property === 'EMAIL' && str_contains($pattern, ' ')) { |
| 1173 | 1173 | // There can be no spaces in emails |
| 1174 | 1174 | return false; |
@@ -1201,7 +1201,7 @@ discard block |
||
| 1201 | 1201 | } elseif (!$escapePattern) { |
| 1202 | 1202 | $query2->andWhere($query2->expr()->ilike('cp.value', $query2->createNamedParameter($pattern))); |
| 1203 | 1203 | } else { |
| 1204 | - $query2->andWhere($query2->expr()->ilike('cp.value', $query2->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%'))); |
|
| 1204 | + $query2->andWhere($query2->expr()->ilike('cp.value', $query2->createNamedParameter('%'.$this->db->escapeLikeParameter($pattern).'%'))); |
|
| 1205 | 1205 | } |
| 1206 | 1206 | } |
| 1207 | 1207 | if (isset($options['limit'])) { |
@@ -1212,7 +1212,7 @@ discard block |
||
| 1212 | 1212 | } |
| 1213 | 1213 | |
| 1214 | 1214 | if (isset($options['person'])) { |
| 1215 | - $query2->andWhere($query2->expr()->ilike('cp.value', $query2->createNamedParameter('%' . $this->db->escapeLikeParameter($options['person']) . '%'))); |
|
| 1215 | + $query2->andWhere($query2->expr()->ilike('cp.value', $query2->createNamedParameter('%'.$this->db->escapeLikeParameter($options['person']).'%'))); |
|
| 1216 | 1216 | } |
| 1217 | 1217 | if (isset($options['since']) || isset($options['until'])) { |
| 1218 | 1218 | $query2->join('cp', $this->dbCardsPropertiesTable, 'cp_bday', 'cp.cardid = cp_bday.cardid'); |
@@ -1240,8 +1240,8 @@ discard block |
||
| 1240 | 1240 | $result = $query2->executeQuery(); |
| 1241 | 1241 | $matches = $result->fetchAllAssociative(); |
| 1242 | 1242 | $result->closeCursor(); |
| 1243 | - $matches = array_map(function ($match) { |
|
| 1244 | - return (int)$match['cardid']; |
|
| 1243 | + $matches = array_map(function($match) { |
|
| 1244 | + return (int) $match['cardid']; |
|
| 1245 | 1245 | }, $matches); |
| 1246 | 1246 | |
| 1247 | 1247 | $cardResults = []; |
@@ -1258,8 +1258,8 @@ discard block |
||
| 1258 | 1258 | } |
| 1259 | 1259 | |
| 1260 | 1260 | $cards = array_merge(...$cardResults); |
| 1261 | - return array_map(function ($array) { |
|
| 1262 | - $array['addressbookid'] = (int)$array['addressbookid']; |
|
| 1261 | + return array_map(function($array) { |
|
| 1262 | + $array['addressbookid'] = (int) $array['addressbookid']; |
|
| 1263 | 1263 | $modified = false; |
| 1264 | 1264 | $array['carddata'] = $this->readBlob($array['carddata'], $modified); |
| 1265 | 1265 | if ($modified) { |
@@ -1305,7 +1305,7 @@ discard block |
||
| 1305 | 1305 | $result->closeCursor(); |
| 1306 | 1306 | |
| 1307 | 1307 | if (!isset($uri['uri'])) { |
| 1308 | - throw new \InvalidArgumentException('Card does not exists: ' . $id); |
|
| 1308 | + throw new \InvalidArgumentException('Card does not exists: '.$id); |
|
| 1309 | 1309 | } |
| 1310 | 1310 | |
| 1311 | 1311 | return $uri['uri']; |
@@ -1330,7 +1330,7 @@ discard block |
||
| 1330 | 1330 | |
| 1331 | 1331 | if (is_array($contact)) { |
| 1332 | 1332 | $modified = false; |
| 1333 | - $contact['etag'] = '"' . $contact['etag'] . '"'; |
|
| 1333 | + $contact['etag'] = '"'.$contact['etag'].'"'; |
|
| 1334 | 1334 | $contact['carddata'] = $this->readBlob($contact['carddata'], $modified); |
| 1335 | 1335 | if ($modified) { |
| 1336 | 1336 | $contact['size'] = strlen($contact['carddata']); |
@@ -1365,7 +1365,7 @@ discard block |
||
| 1365 | 1365 | * @param string $vCardSerialized |
| 1366 | 1366 | */ |
| 1367 | 1367 | protected function updateProperties($addressBookId, $cardUri, $vCardSerialized) { |
| 1368 | - $this->atomic(function () use ($addressBookId, $cardUri, $vCardSerialized): void { |
|
| 1368 | + $this->atomic(function() use ($addressBookId, $cardUri, $vCardSerialized): void { |
|
| 1369 | 1369 | $cardId = $this->getCardId($addressBookId, $cardUri); |
| 1370 | 1370 | $vCard = $this->readCard($vCardSerialized); |
| 1371 | 1371 | |
@@ -1440,10 +1440,10 @@ discard block |
||
| 1440 | 1440 | $result->closeCursor(); |
| 1441 | 1441 | |
| 1442 | 1442 | if (!isset($cardIds['id'])) { |
| 1443 | - throw new \InvalidArgumentException('Card does not exists: ' . $uri); |
|
| 1443 | + throw new \InvalidArgumentException('Card does not exists: '.$uri); |
|
| 1444 | 1444 | } |
| 1445 | 1445 | |
| 1446 | - return (int)$cardIds['id']; |
|
| 1446 | + return (int) $cardIds['id']; |
|
| 1447 | 1447 | } |
| 1448 | 1448 | |
| 1449 | 1449 | /** |
@@ -1471,7 +1471,7 @@ discard block |
||
| 1471 | 1471 | ->from('addressbookchanges'); |
| 1472 | 1472 | |
| 1473 | 1473 | $result = $query->executeQuery(); |
| 1474 | - $maxId = (int)$result->fetchOne(); |
|
| 1474 | + $maxId = (int) $result->fetchOne(); |
|
| 1475 | 1475 | $result->closeCursor(); |
| 1476 | 1476 | if (!$maxId || $maxId < $keep) { |
| 1477 | 1477 | return 0; |
@@ -1498,8 +1498,8 @@ discard block |
||
| 1498 | 1498 | } |
| 1499 | 1499 | |
| 1500 | 1500 | private function addOwnerPrincipal(array &$addressbookInfo): void { |
| 1501 | - $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
| 1502 | - $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
| 1501 | + $ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'; |
|
| 1502 | + $displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname'; |
|
| 1503 | 1503 | if (isset($addressbookInfo[$ownerPrincipalKey])) { |
| 1504 | 1504 | $uri = $addressbookInfo[$ownerPrincipalKey]; |
| 1505 | 1505 | } else { |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $result->closeCursor(); |
| 70 | 70 | |
| 71 | 71 | if ($count !== false) { |
| 72 | - $count = (int)$count; |
|
| 72 | + $count = (int) $count; |
|
| 73 | 73 | } else { |
| 74 | 74 | $count = 0; |
| 75 | 75 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | while ($row = $result->fetchAssociative()) { |
| 92 | 92 | $username = $this->getPrincipal($row['principaluri']); |
| 93 | 93 | if (!$this->userManager->userExists($username)) { |
| 94 | - $this->orphanSubscriptionIds[] = (int)$row['id']; |
|
| 94 | + $this->orphanSubscriptionIds[] = (int) $row['id']; |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | $result->closeCursor(); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $offset = $argument['offset']; |
| 32 | 32 | $stopAt = $argument['stopAt']; |
| 33 | 33 | |
| 34 | - $this->logger->info('Indexing social profile data (' . $offset . '/' . $stopAt . ')'); |
|
| 34 | + $this->logger->info('Indexing social profile data ('.$offset.'/'.$stopAt.')'); |
|
| 35 | 35 | |
| 36 | 36 | $offset = $this->buildIndex($offset, $stopAt); |
| 37 | 37 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | 'offset' => $offset, |
| 43 | 43 | 'stopAt' => $stopAt |
| 44 | 44 | ]); |
| 45 | - $this->logger->info('New social profile indexing job scheduled with offset ' . $offset); |
|
| 45 | + $this->logger->info('New social profile indexing job scheduled with offset '.$offset); |
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | ->from('cards', 'c') |
| 61 | 61 | ->orderBy('id', 'ASC') |
| 62 | 62 | ->where($query->expr()->like('carddata', $query->createNamedParameter('%SOCIALPROFILE%'))) |
| 63 | - ->andWhere($query->expr()->gt('id', $query->createNamedParameter((int)$offset, IQueryBuilder::PARAM_INT))) |
|
| 63 | + ->andWhere($query->expr()->gt('id', $query->createNamedParameter((int) $offset, IQueryBuilder::PARAM_INT))) |
|
| 64 | 64 | ->setMaxResults(100); |
| 65 | 65 | $social_cards = $query->executeQuery()->fetchAllAssociative(); |
| 66 | 66 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | $section = \str_contains($this->getTableName(), 'user') ? 'u/' : 'g/'; |
| 81 | - $this->localNameToDnCache = $this->cacheFactory->createLocal('ldap/map/' . $section); |
|
| 81 | + $this->localNameToDnCache = $this->cacheFactory->createLocal('ldap/map/'.$section); |
|
| 82 | 82 | |
| 83 | 83 | // We use the cache as well to store whether it shall be used. If the |
| 84 | 84 | // answer was no, we unset it again. |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $row = $result->fetchAssociative(); |
| 102 | 102 | $result->closeCursor(); |
| 103 | 103 | |
| 104 | - $use = (int)$row['count'] <= self::LOCAL_CACHE_OBJECT_THRESHOLD; |
|
| 104 | + $use = (int) $row['count'] <= self::LOCAL_CACHE_OBJECT_THRESHOLD; |
|
| 105 | 105 | $this->localNameToDnCache->set('use', $use, self::LOCAL_USER_COUNT_TTL); |
| 106 | 106 | return $use; |
| 107 | 107 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | /** |
| 176 | 176 | * Gets the LDAP DN based on the provided name. |
| 177 | 177 | */ |
| 178 | - public function getDNByName(string $name): string|false { |
|
| 178 | + public function getDNByName(string $name): string | false { |
|
| 179 | 179 | $dn = array_search($name, $this->cache, true); |
| 180 | 180 | if ($dn === false) { |
| 181 | 181 | $dn = $this->localNameToDnCache?->get($name); |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | public function setDNbyUUID($fdn, $uuid) { |
| 201 | 201 | $oldDn = $this->getDnByUUID($uuid); |
| 202 | 202 | $statement = $this->dbc->prepare(' |
| 203 | - UPDATE `' . $this->getTableName() . '` |
|
| 203 | + UPDATE `' . $this->getTableName().'` |
|
| 204 | 204 | SET `ldap_dn_hash` = ?, `ldap_dn` = ? |
| 205 | 205 | WHERE `directory_uuid` = ? |
| 206 | 206 | '); |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | */ |
| 233 | 233 | public function setUUIDbyDN($uuid, $fdn): bool { |
| 234 | 234 | $statement = $this->dbc->prepare(' |
| 235 | - UPDATE `' . $this->getTableName() . '` |
|
| 235 | + UPDATE `' . $this->getTableName().'` |
|
| 236 | 236 | SET `directory_uuid` = ? |
| 237 | 237 | WHERE `ldap_dn_hash` = ? |
| 238 | 238 | '); |
@@ -335,12 +335,12 @@ discard block |
||
| 335 | 335 | public function getNamesBySearch(string $search, string $prefixMatch = '', string $postfixMatch = ''): array { |
| 336 | 336 | $statement = $this->dbc->prepare(' |
| 337 | 337 | SELECT `owncloud_name` |
| 338 | - FROM `' . $this->getTableName() . '` |
|
| 338 | + FROM `' . $this->getTableName().'` |
|
| 339 | 339 | WHERE `owncloud_name` LIKE ? |
| 340 | 340 | '); |
| 341 | 341 | |
| 342 | 342 | try { |
| 343 | - $res = $statement->execute([$prefixMatch . $this->dbc->escapeLikeParameter($search) . $postfixMatch]); |
|
| 343 | + $res = $statement->execute([$prefixMatch.$this->dbc->escapeLikeParameter($search).$postfixMatch]); |
|
| 344 | 344 | } catch (Exception $e) { |
| 345 | 345 | return []; |
| 346 | 346 | } |
@@ -425,12 +425,12 @@ discard block |
||
| 425 | 425 | |
| 426 | 426 | try { |
| 427 | 427 | $result = $this->dbc->insertIfNotExist($this->getTableName(), $row); |
| 428 | - if ((bool)$result === true) { |
|
| 428 | + if ((bool) $result === true) { |
|
| 429 | 429 | $this->cache[$fdn] = $name; |
| 430 | 430 | $this->localNameToDnCache?->set($name, $fdn, self::LOCAL_CACHE_TTL); |
| 431 | 431 | } |
| 432 | 432 | // insertIfNotExist returns values as int |
| 433 | - return (bool)$result; |
|
| 433 | + return (bool) $result; |
|
| 434 | 434 | } catch (\Exception $e) { |
| 435 | 435 | return false; |
| 436 | 436 | } |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | */ |
| 445 | 445 | public function unmap($name) { |
| 446 | 446 | $statement = $this->dbc->prepare(' |
| 447 | - DELETE FROM `' . $this->getTableName() . '` |
|
| 447 | + DELETE FROM `' . $this->getTableName().'` |
|
| 448 | 448 | WHERE `owncloud_name` = ?'); |
| 449 | 449 | |
| 450 | 450 | $dn = array_search($name, $this->cache); |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | public function clear() { |
| 465 | 465 | $sql = $this->dbc |
| 466 | 466 | ->getDatabasePlatform() |
| 467 | - ->getTruncateTableSQL('`' . $this->getTableName() . '`'); |
|
| 467 | + ->getTruncateTableSQL('`'.$this->getTableName().'`'); |
|
| 468 | 468 | try { |
| 469 | 469 | $this->dbc->executeQuery($sql); |
| 470 | 470 | $this->localNameToDnCache?->clear(); |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | $res = $query->executeQuery(); |
| 514 | 514 | $count = $res->fetchOne(); |
| 515 | 515 | $res->closeCursor(); |
| 516 | - return (int)$count; |
|
| 516 | + return (int) $count; |
|
| 517 | 517 | } |
| 518 | 518 | |
| 519 | 519 | public function countInvalidated(): int { |
@@ -524,6 +524,6 @@ discard block |
||
| 524 | 524 | $res = $query->executeQuery(); |
| 525 | 525 | $count = $res->fetchOne(); |
| 526 | 526 | $res->closeCursor(); |
| 527 | - return (int)$count; |
|
| 527 | + return (int) $count; |
|
| 528 | 528 | } |
| 529 | 529 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | if ($remoteShare) { |
| 141 | 141 | try { |
| 142 | 142 | $ownerCloudId = $this->cloudIdManager->getCloudId($remoteShare['owner'], $remoteShare['remote']); |
| 143 | - $shareId = $this->addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $ownerCloudId->getId(), $permissions, 'tmp_token_' . time(), $shareType, $expirationDate); |
|
| 143 | + $shareId = $this->addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $ownerCloudId->getId(), $permissions, 'tmp_token_'.time(), $shareType, $expirationDate); |
|
| 144 | 144 | $share->setId($shareId); |
| 145 | 145 | [$token, $remoteId] = $this->askOwnerToReShare($shareWith, $share, $shareId); |
| 146 | 146 | // remote share was create successfully if we get a valid token as return |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | $result = $qResult->fetchAllAssociative(); |
| 275 | 275 | $qResult->closeCursor(); |
| 276 | 276 | |
| 277 | - if (isset($result[0]) && (int)$result[0]['remote_id'] > 0) { |
|
| 277 | + if (isset($result[0]) && (int) $result[0]['remote_id'] > 0) { |
|
| 278 | 278 | return $result[0]; |
| 279 | 279 | } |
| 280 | 280 | |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | public function getRemoteId(IShare $share): string { |
| 409 | 409 | $query = $this->dbConnection->getQueryBuilder(); |
| 410 | 410 | $query->select('remote_id')->from('federated_reshares') |
| 411 | - ->where($query->expr()->eq('share_id', $query->createNamedParameter((int)$share->getId()))); |
|
| 411 | + ->where($query->expr()->eq('share_id', $query->createNamedParameter((int) $share->getId()))); |
|
| 412 | 412 | $result = $query->executeQuery(); |
| 413 | 413 | $data = $result->fetchAssociative(); |
| 414 | 414 | $result->closeCursor(); |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | throw new ShareNotFound(); |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | - return (string)$data['remote_id']; |
|
| 420 | + return (string) $data['remote_id']; |
|
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | /** |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | $cursor->closeCursor(); |
| 672 | 672 | |
| 673 | 673 | if ($data === false) { |
| 674 | - throw new ShareNotFound('Can not find share with ID: ' . $id); |
|
| 674 | + throw new ShareNotFound('Can not find share with ID: '.$id); |
|
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | try { |
@@ -814,16 +814,16 @@ discard block |
||
| 814 | 814 | */ |
| 815 | 815 | private function createShareObject($data) { |
| 816 | 816 | $share = new Share($this->rootFolder, $this->userManager); |
| 817 | - $share->setId((int)$data['id']) |
|
| 818 | - ->setShareType((int)$data['share_type']) |
|
| 819 | - ->setPermissions((int)$data['permissions']) |
|
| 817 | + $share->setId((int) $data['id']) |
|
| 818 | + ->setShareType((int) $data['share_type']) |
|
| 819 | + ->setPermissions((int) $data['permissions']) |
|
| 820 | 820 | ->setTarget($data['file_target']) |
| 821 | - ->setMailSend((bool)$data['mail_send']) |
|
| 822 | - ->setStatus((int)$data['accepted']) |
|
| 821 | + ->setMailSend((bool) $data['mail_send']) |
|
| 822 | + ->setStatus((int) $data['accepted']) |
|
| 823 | 823 | ->setToken($data['token']); |
| 824 | 824 | |
| 825 | 825 | $shareTime = new \DateTime(); |
| 826 | - $shareTime->setTimestamp((int)$data['stime']); |
|
| 826 | + $shareTime->setTimestamp((int) $data['stime']); |
|
| 827 | 827 | $share->setShareTime($shareTime); |
| 828 | 828 | $share->setSharedWith($data['share_with']); |
| 829 | 829 | |
@@ -833,13 +833,13 @@ discard block |
||
| 833 | 833 | } else { |
| 834 | 834 | //OLD SHARE |
| 835 | 835 | $share->setSharedBy($data['uid_owner']); |
| 836 | - $path = $this->getNode($share->getSharedBy(), (int)$data['file_source']); |
|
| 836 | + $path = $this->getNode($share->getSharedBy(), (int) $data['file_source']); |
|
| 837 | 837 | |
| 838 | 838 | $owner = $path->getOwner(); |
| 839 | 839 | $share->setShareOwner($owner->getUID()); |
| 840 | 840 | } |
| 841 | 841 | |
| 842 | - $share->setNodeId((int)$data['file_source']); |
|
| 842 | + $share->setNodeId((int) $data['file_source']); |
|
| 843 | 843 | $share->setNodeType($data['item_type']); |
| 844 | 844 | |
| 845 | 845 | $share->setProviderId($this->identifier()); |
@@ -38,19 +38,19 @@ |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | while ($mount = $mounts->fetchAssociative()) { |
| 41 | - $config = $this->getStorageConfig((int)$mount['mount_id']); |
|
| 41 | + $config = $this->getStorageConfig((int) $mount['mount_id']); |
|
| 42 | 42 | $hostname = $config['hostname']; |
| 43 | 43 | $bucket = $config['bucket']; |
| 44 | 44 | $key = $config['key']; |
| 45 | - $oldId = Storage::adjustStorageId('amazon::' . $bucket); |
|
| 46 | - $newId = Storage::adjustStorageId('amazon::external::' . md5($hostname . ':' . $bucket . ':' . $key)); |
|
| 45 | + $oldId = Storage::adjustStorageId('amazon::'.$bucket); |
|
| 46 | + $newId = Storage::adjustStorageId('amazon::external::'.md5($hostname.':'.$bucket.':'.$key)); |
|
| 47 | 47 | try { |
| 48 | 48 | $qb->setParameter('oldId', $oldId); |
| 49 | 49 | $qb->setParameter('newId', $newId); |
| 50 | 50 | $qb->executeStatement(); |
| 51 | - $this->logger->info('Migrated s3 storage id for mount with id ' . $mount['mount_id'] . ' to ' . $newId); |
|
| 51 | + $this->logger->info('Migrated s3 storage id for mount with id '.$mount['mount_id'].' to '.$newId); |
|
| 52 | 52 | } catch (Exception $e) { |
| 53 | - $this->logger->error('Failed to migrate external s3 storage id for mount with id ' . $mount['mount_id'], [ |
|
| 53 | + $this->logger->error('Failed to migrate external s3 storage id for mount with id '.$mount['mount_id'], [ |
|
| 54 | 54 | 'exception' => $e |
| 55 | 55 | ]); |
| 56 | 56 | } |
@@ -157,7 +157,7 @@ |
||
| 157 | 157 | $result = $query->executeQuery(); |
| 158 | 158 | while ($row = $result->fetchAssociative()) { |
| 159 | 159 | $deletedInLastChunk++; |
| 160 | - $deletedEntries += $deleteQuery->setParameter('storageid', (int)$row['storage_id']) |
|
| 160 | + $deletedEntries += $deleteQuery->setParameter('storageid', (int) $row['storage_id']) |
|
| 161 | 161 | ->executeStatement(); |
| 162 | 162 | } |
| 163 | 163 | $result->closeCursor(); |