@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | $path = $this->getPath(); |
| 459 | - [$storageType,] = explode('::', $this->getStorage(), 2); |
|
| 459 | + [$storageType, ] = explode('::', $this->getStorage(), 2); |
|
| 460 | 460 | |
| 461 | 461 | if ($path === '') { |
| 462 | 462 | // we only accept empty path on external storage |
@@ -508,29 +508,29 @@ discard block |
||
| 508 | 508 | * @throws FileCacheNotFoundException |
| 509 | 509 | */ |
| 510 | 510 | public function importFromDatabase(array $data, string $prefix = ''): IQueryRow { |
| 511 | - if ($this->getInt($prefix . 'fileid', $data) === 0) { |
|
| 511 | + if ($this->getInt($prefix.'fileid', $data) === 0) { |
|
| 512 | 512 | throw new FileCacheNotFoundException(); |
| 513 | 513 | } |
| 514 | 514 | |
| 515 | - $this->setId($this->getInt($prefix . 'fileid', $data)); |
|
| 516 | - $this->setPath($this->get($prefix . 'path', $data)); |
|
| 517 | - $this->setPermissions($this->getInt($prefix . 'permissions', $data)); |
|
| 518 | - $this->setStorageId($this->getInt($prefix . 'storage', $data)); |
|
| 519 | - $this->setPathHash($this->get($prefix . 'path_hash', $data)); |
|
| 520 | - $this->setParent($this->getInt($prefix . 'parent', $data)); |
|
| 521 | - $this->setName($this->get($prefix . 'name', $data)); |
|
| 522 | - $this->setMimeType($this->getInt($prefix . 'mimetype', $data)); |
|
| 523 | - $this->setMimePart($this->getInt($prefix . 'mimepart', $data)); |
|
| 524 | - $this->setSize($this->getInt($prefix . 'size', $data)); |
|
| 525 | - $this->setMTime($this->getInt($prefix . 'mtime', $data)); |
|
| 526 | - $this->setStorageMTime($this->getInt($prefix . 'storage_mtime', $data)); |
|
| 527 | - $this->setEncrypted($this->getBool($prefix . 'encrypted', $data)); |
|
| 528 | - $this->setUnencryptedSize($this->getInt($prefix . 'unencrypted_size', $data)); |
|
| 529 | - $this->setEtag($this->get($prefix . 'etag', $data)); |
|
| 530 | - $this->setChecksum($this->get($prefix . 'checksum', $data)); |
|
| 515 | + $this->setId($this->getInt($prefix.'fileid', $data)); |
|
| 516 | + $this->setPath($this->get($prefix.'path', $data)); |
|
| 517 | + $this->setPermissions($this->getInt($prefix.'permissions', $data)); |
|
| 518 | + $this->setStorageId($this->getInt($prefix.'storage', $data)); |
|
| 519 | + $this->setPathHash($this->get($prefix.'path_hash', $data)); |
|
| 520 | + $this->setParent($this->getInt($prefix.'parent', $data)); |
|
| 521 | + $this->setName($this->get($prefix.'name', $data)); |
|
| 522 | + $this->setMimeType($this->getInt($prefix.'mimetype', $data)); |
|
| 523 | + $this->setMimePart($this->getInt($prefix.'mimepart', $data)); |
|
| 524 | + $this->setSize($this->getInt($prefix.'size', $data)); |
|
| 525 | + $this->setMTime($this->getInt($prefix.'mtime', $data)); |
|
| 526 | + $this->setStorageMTime($this->getInt($prefix.'storage_mtime', $data)); |
|
| 527 | + $this->setEncrypted($this->getBool($prefix.'encrypted', $data)); |
|
| 528 | + $this->setUnencryptedSize($this->getInt($prefix.'unencrypted_size', $data)); |
|
| 529 | + $this->setEtag($this->get($prefix.'etag', $data)); |
|
| 530 | + $this->setChecksum($this->get($prefix.'checksum', $data)); |
|
| 531 | 531 | |
| 532 | 532 | // small hack as there is no reason to call a recursive method for a single entry from the table |
| 533 | - $this->setStorage($this->get($prefix . CoreQueryBuilder::STORAGES . '_id', $data)); |
|
| 533 | + $this->setStorage($this->get($prefix.CoreQueryBuilder::STORAGES.'_id', $data)); |
|
| 534 | 534 | |
| 535 | 535 | return $this; |
| 536 | 536 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $this->parseAsNonMember($event, $circle); |
| 69 | 69 | $this->parseAsMember($event, $circle, $params); |
| 70 | 70 | $this->parseAsModerator($event, $circle, $params); |
| 71 | - } catch (FakeException|InvalidItemException $e) { |
|
| 71 | + } catch (FakeException | InvalidItemException $e) { |
|
| 72 | 72 | /** clean exit */ |
| 73 | 73 | } |
| 74 | 74 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | private function setIcon(IEvent $event): void { |
| 96 | 96 | $path = $this->urlGenerator->imagePath( |
| 97 | 97 | Application::APP_ID, |
| 98 | - 'circles.' . $this->activityManager->getRequirePNG() ? 'png' : 'svg' |
|
| 98 | + 'circles.'.$this->activityManager->getRequirePNG() ? 'png' : 'svg' |
|
| 99 | 99 | ); |
| 100 | 100 | $event->setIcon($this->urlGenerator->getAbsoluteURL($path)); |
| 101 | 101 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | continue; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - $replace['{' . $k . '}'] = $data[$k]['_parsed']; |
|
| 129 | + $replace['{'.$k.'}'] = $data[$k]['_parsed']; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | $event->setParsedSubject(strtr($line, $replace)); |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | return [ |
| 271 | 271 | 'type' => Member::$TYPE[$member->getUserType()] ?? '', |
| 272 | 272 | 'id' => $member->getUserId(), |
| 273 | - 'name' => $member->getDisplayName() . ' (' . (Member::$TYPE[$member->getUserType()] ?? '') . ')', |
|
| 273 | + 'name' => $member->getDisplayName().' ('.(Member::$TYPE[$member->getUserType()] ?? '').')', |
|
| 274 | 274 | '_parsed' => $member->getDisplayName() |
| 275 | 275 | ]; |
| 276 | 276 | } |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | $event->setSubject('circle_create', ['circle' => json_encode($circle)]); |
| 76 | 76 | |
| 77 | 77 | $this->userManager->callForSeenUsers( |
| 78 | - function ($user) use ($event) { |
|
| 78 | + function($user) use ($event) { |
|
| 79 | 79 | /** @var IUser $user */ |
| 80 | 80 | $this->publishEvent($event, [$user]); |
| 81 | 81 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | public function result(FederatedEvent $event, array $results): void { |
| 165 | 165 | $member = $event->getMember(); |
| 166 | - \OC::$server->getLogger()->log(3, '>> ' . $member->getStatus()); |
|
| 166 | + \OC::$server->getLogger()->log(3, '>> '.$member->getStatus()); |
|
| 167 | 167 | if ($member->getStatus() === Member::STATUS_INVITED) { |
| 168 | 168 | $this->eventService->memberInvited($event, $results); |
| 169 | 169 | } else { |
@@ -197,10 +197,10 @@ discard block |
||
| 197 | 197 | protected function generateMember(FederatedEvent $event, Circle $circle, Member $member): Member { |
| 198 | 198 | try { |
| 199 | 199 | if ($member->getSingleId() !== '') { |
| 200 | - $userId = $member->getSingleId() . '@' . $member->getInstance(); |
|
| 200 | + $userId = $member->getSingleId().'@'.$member->getInstance(); |
|
| 201 | 201 | $federatedUser = $this->federatedUserService->getFederatedUser($userId, Member::TYPE_SINGLE); |
| 202 | 202 | } else { |
| 203 | - $userId = $member->getUserId() . '@' . $member->getInstance(); |
|
| 203 | + $userId = $member->getUserId().'@'.$member->getInstance(); |
|
| 204 | 204 | $federatedUser = $this->federatedUserService->getFederatedUser( |
| 205 | 205 | $userId, |
| 206 | 206 | $member->getUserType() |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | * @throws SingleCircleNotFoundException |
| 247 | 247 | */ |
| 248 | 248 | public function syncNextcloudUser(string $userId): FederatedUser { |
| 249 | - $this->outputService->output('Syncing Nextcloud Account \'' . $userId . '\'', true); |
|
| 249 | + $this->outputService->output('Syncing Nextcloud Account \''.$userId.'\'', true); |
|
| 250 | 250 | |
| 251 | 251 | return $this->federatedUserService->getLocalFederatedUser($userId, false, true); |
| 252 | 252 | } |
@@ -290,10 +290,10 @@ discard block |
||
| 290 | 290 | * @throws RequestBuilderException |
| 291 | 291 | */ |
| 292 | 292 | public function syncNextcloudGroup(string $groupId): Circle { |
| 293 | - $this->outputService->output('Syncing Nextcloud Group \'' . $groupId . '\'', true); |
|
| 293 | + $this->outputService->output('Syncing Nextcloud Group \''.$groupId.'\'', true); |
|
| 294 | 294 | |
| 295 | 295 | $circle = $this->federatedUserService->getGroupCircle($groupId); |
| 296 | - $members = array_map(function (Member $member): string { |
|
| 296 | + $members = array_map(function(Member $member): string { |
|
| 297 | 297 | return $member->getSingleId(); |
| 298 | 298 | }, $this->memberRequest->getMembers($circle->getSingleId())); |
| 299 | 299 | |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | */ |
| 372 | 372 | public function groupDeleted(string $groupId): void { |
| 373 | 373 | $circle = new Circle(); |
| 374 | - $circle->setName('group:' . $groupId) |
|
| 374 | + $circle->setName('group:'.$groupId) |
|
| 375 | 375 | ->setConfig(Circle::CFG_SYSTEM | Circle::CFG_NO_OWNER | Circle::CFG_HIDDEN) |
| 376 | 376 | ->setSource(Member::TYPE_GROUP); |
| 377 | 377 | |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | if ($check) { |
| 529 | 529 | $user = $this->userManager->get($userId); |
| 530 | 530 | if ($user === null) { |
| 531 | - throw new FederatedUserNotFoundException('user ' . $userId . ' not found'); |
|
| 531 | + throw new FederatedUserNotFoundException('user '.$userId.' not found'); |
|
| 532 | 532 | } |
| 533 | 533 | $displayName = $this->userManager->getDisplayName($userId); |
| 534 | 534 | } else { |
@@ -1043,7 +1043,7 @@ discard block |
||
| 1043 | 1043 | $prefix = ($federatedUser->getUserType() === Member::TYPE_APP) ? 'app' |
| 1044 | 1044 | : Member::$TYPE[$federatedUser->getUserType()]; |
| 1045 | 1045 | |
| 1046 | - $circle->setName($prefix . ':' . $federatedUser->getUserId() . ':' . $id) |
|
| 1046 | + $circle->setName($prefix.':'.$federatedUser->getUserId().':'.$id) |
|
| 1047 | 1047 | ->setDisplayName($federatedUser->getDisplayName()) |
| 1048 | 1048 | ->setSingleId($id) |
| 1049 | 1049 | ->setSource($source); |
@@ -1247,7 +1247,7 @@ discard block |
||
| 1247 | 1247 | $owner = $this->getCurrentApp(); |
| 1248 | 1248 | |
| 1249 | 1249 | $circle = new Circle(); |
| 1250 | - $circle->setName('group:' . $groupId) |
|
| 1250 | + $circle->setName('group:'.$groupId) |
|
| 1251 | 1251 | ->setConfig(Circle::CFG_SYSTEM | Circle::CFG_NO_OWNER | Circle::CFG_HIDDEN) |
| 1252 | 1252 | ->setSingleId($this->token(ManagedModel::ID_LENGTH)) |
| 1253 | 1253 | ->setSource(Member::TYPE_GROUP); |
@@ -1315,8 +1315,8 @@ discard block |
||
| 1315 | 1315 | * @return string |
| 1316 | 1316 | */ |
| 1317 | 1317 | private function generateCacheKey(FederatedUser $federatedUser): string { |
| 1318 | - return $federatedUser->getInstance() . '#' |
|
| 1319 | - . $federatedUser->getUserType() . '#' |
|
| 1318 | + return $federatedUser->getInstance().'#' |
|
| 1319 | + . $federatedUser->getUserType().'#' |
|
| 1320 | 1320 | . $federatedUser->getUserId(); |
| 1321 | 1321 | } |
| 1322 | 1322 | } |
@@ -184,8 +184,8 @@ |
||
| 184 | 184 | $qb->filterCircles(CoreQueryBuilder::CIRCLE, $probe); |
| 185 | 185 | if (!is_null($initiator)) { |
| 186 | 186 | $qb->limitToInitiator(CoreQueryBuilder::CIRCLE, $initiator); |
| 187 | - $qb->orderBy($qb->generateAlias(CoreQueryBuilder::CIRCLE, CoreQueryBuilder::INITIATOR) . '.level', 'desc'); |
|
| 188 | - $qb->addOrderBy(CoreQueryBuilder::CIRCLE . '.display_name', 'asc'); |
|
| 187 | + $qb->orderBy($qb->generateAlias(CoreQueryBuilder::CIRCLE, CoreQueryBuilder::INITIATOR).'.level', 'desc'); |
|
| 188 | + $qb->addOrderBy(CoreQueryBuilder::CIRCLE.'.display_name', 'asc'); |
|
| 189 | 189 | } |
| 190 | 190 | if ($probe->hasFilterMember()) { |
| 191 | 191 | $qb->limitToDirectMembership(CoreQueryBuilder::CIRCLE, $probe->getFilterMember()); |
@@ -90,27 +90,27 @@ discard block |
||
| 90 | 90 | public const FLAGS_LONG = 2; |
| 91 | 91 | |
| 92 | 92 | // specific value |
| 93 | - public const CFG_CIRCLE = 0; // only for code readability. Circle is locked by default. |
|
| 94 | - public const CFG_SINGLE = 1; // Circle with only one single member. |
|
| 95 | - public const CFG_PERSONAL = 2; // Personal circle, only the owner can see it. |
|
| 93 | + public const CFG_CIRCLE = 0; // only for code readability. Circle is locked by default. |
|
| 94 | + public const CFG_SINGLE = 1; // Circle with only one single member. |
|
| 95 | + public const CFG_PERSONAL = 2; // Personal circle, only the owner can see it. |
|
| 96 | 96 | |
| 97 | 97 | // bitwise |
| 98 | - public const CFG_SYSTEM = 4; // System Circle (not managed by the official front-end). Meaning some config are limited |
|
| 99 | - public const CFG_VISIBLE = 8; // Visible to everyone, if not visible, people have to know its name to be able to find it |
|
| 100 | - public const CFG_OPEN = 16; // Circle is open, people can join |
|
| 101 | - public const CFG_INVITE = 32; // Adding a member generate an invitation that needs to be accepted |
|
| 102 | - public const CFG_REQUEST = 64; // Request to join Circles needs to be confirmed by a moderator |
|
| 103 | - public const CFG_FRIEND = 128; // Members of the circle can invite their friends |
|
| 104 | - public const CFG_PROTECTED = 256; // Password protected to join/request |
|
| 105 | - public const CFG_NO_OWNER = 512; // no owner, only members |
|
| 106 | - public const CFG_HIDDEN = 1024; // hidden from listing, but available as a share entity |
|
| 107 | - public const CFG_BACKEND = 2048; // Fully hidden, only backend Circles |
|
| 108 | - public const CFG_LOCAL = 4096; // Local even on GlobalScale |
|
| 109 | - public const CFG_ROOT = 8192; // Circle cannot be inside another Circle |
|
| 110 | - public const CFG_CIRCLE_INVITE = 16384; // Circle must confirm when invited in another circle |
|
| 111 | - public const CFG_FEDERATED = 32768; // Federated |
|
| 112 | - public const CFG_MOUNTPOINT = 65536; // Generate a Files folder for this Circle |
|
| 113 | - public const CFG_APP = 131072; // Some features are not available to the OCS API (ie. destroying Circle) |
|
| 98 | + public const CFG_SYSTEM = 4; // System Circle (not managed by the official front-end). Meaning some config are limited |
|
| 99 | + public const CFG_VISIBLE = 8; // Visible to everyone, if not visible, people have to know its name to be able to find it |
|
| 100 | + public const CFG_OPEN = 16; // Circle is open, people can join |
|
| 101 | + public const CFG_INVITE = 32; // Adding a member generate an invitation that needs to be accepted |
|
| 102 | + public const CFG_REQUEST = 64; // Request to join Circles needs to be confirmed by a moderator |
|
| 103 | + public const CFG_FRIEND = 128; // Members of the circle can invite their friends |
|
| 104 | + public const CFG_PROTECTED = 256; // Password protected to join/request |
|
| 105 | + public const CFG_NO_OWNER = 512; // no owner, only members |
|
| 106 | + public const CFG_HIDDEN = 1024; // hidden from listing, but available as a share entity |
|
| 107 | + public const CFG_BACKEND = 2048; // Fully hidden, only backend Circles |
|
| 108 | + public const CFG_LOCAL = 4096; // Local even on GlobalScale |
|
| 109 | + public const CFG_ROOT = 8192; // Circle cannot be inside another Circle |
|
| 110 | + public const CFG_CIRCLE_INVITE = 16384; // Circle must confirm when invited in another circle |
|
| 111 | + public const CFG_FEDERATED = 32768; // Federated |
|
| 112 | + public const CFG_MOUNTPOINT = 65536; // Generate a Files folder for this Circle |
|
| 113 | + public const CFG_APP = 131072; // Some features are not available to the OCS API (ie. destroying Circle) |
|
| 114 | 114 | public static $DEF_CFG_MAX = 262143; |
| 115 | 115 | |
| 116 | 116 | |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | */ |
| 480 | 480 | public function addInheritedMembers(array $members): self { |
| 481 | 481 | $knownIds = array_map( |
| 482 | - function (Member $member): string { |
|
| 482 | + function(Member $member): string { |
|
| 483 | 483 | return $member->getId(); |
| 484 | 484 | }, $this->inheritedMembers |
| 485 | 485 | ); |
@@ -893,25 +893,25 @@ discard block |
||
| 893 | 893 | * @throws CircleNotFoundException |
| 894 | 894 | */ |
| 895 | 895 | public function importFromDatabase(array $data, string $prefix = ''): IQueryRow { |
| 896 | - if ($this->get($prefix . 'unique_id', $data) === '') { |
|
| 896 | + if ($this->get($prefix.'unique_id', $data) === '') { |
|
| 897 | 897 | throw new CircleNotFoundException(); |
| 898 | 898 | } |
| 899 | 899 | |
| 900 | - $this->setSingleId($this->get($prefix . 'unique_id', $data)) |
|
| 901 | - ->setName($this->get($prefix . 'name', $data)) |
|
| 902 | - ->setDisplayName($this->get($prefix . 'display_name', $data)) |
|
| 903 | - ->setSanitizedName($this->get($prefix . 'sanitized_name', $data)) |
|
| 904 | - ->setConfig($this->getInt($prefix . 'config', $data)) |
|
| 905 | - ->setSource($this->getInt($prefix . 'source', $data)) |
|
| 906 | - ->setInstance($this->get($prefix . 'instance', $data)) |
|
| 907 | - ->setSettings($this->getArray($prefix . 'settings', $data)) |
|
| 908 | - ->setContactAddressBook($this->getInt($prefix . 'contact_addressbook', $data)) |
|
| 909 | - ->setContactGroupName($this->get($prefix . 'contact_groupname', $data)) |
|
| 910 | - ->setDescription($this->get($prefix . 'description', $data)); |
|
| 911 | - |
|
| 912 | - $creation = $this->get($prefix . 'creation', $data); |
|
| 900 | + $this->setSingleId($this->get($prefix.'unique_id', $data)) |
|
| 901 | + ->setName($this->get($prefix.'name', $data)) |
|
| 902 | + ->setDisplayName($this->get($prefix.'display_name', $data)) |
|
| 903 | + ->setSanitizedName($this->get($prefix.'sanitized_name', $data)) |
|
| 904 | + ->setConfig($this->getInt($prefix.'config', $data)) |
|
| 905 | + ->setSource($this->getInt($prefix.'source', $data)) |
|
| 906 | + ->setInstance($this->get($prefix.'instance', $data)) |
|
| 907 | + ->setSettings($this->getArray($prefix.'settings', $data)) |
|
| 908 | + ->setContactAddressBook($this->getInt($prefix.'contact_addressbook', $data)) |
|
| 909 | + ->setContactGroupName($this->get($prefix.'contact_groupname', $data)) |
|
| 910 | + ->setDescription($this->get($prefix.'description', $data)); |
|
| 911 | + |
|
| 912 | + $creation = $this->get($prefix.'creation', $data); |
|
| 913 | 913 | $dateTime = DateTime::createFromFormat('Y-m-d H:i:s', $creation); |
| 914 | - $timestamp = $dateTime ? $dateTime->getTimestamp() : (int) strtotime($creation); |
|
| 914 | + $timestamp = $dateTime ? $dateTime->getTimestamp() : (int)strtotime($creation); |
|
| 915 | 915 | $this->setCreation($timestamp); |
| 916 | 916 | |
| 917 | 917 | $this->setPopulation($this->getInt('population', $this->getSettings())); |