@@ -163,7 +163,7 @@ |
||
163 | 163 | |
164 | 164 | $shares = array_merge($groupShares, $roomShares); |
165 | 165 | |
166 | - $shares = array_map(function (IShare $share) { |
|
166 | + $shares = array_map(function(IShare $share) { |
|
167 | 167 | return $this->formatShare($share); |
168 | 168 | }, $shares); |
169 | 169 |
@@ -231,14 +231,14 @@ discard block |
||
231 | 231 | |
232 | 232 | $result['share_with_displayname'] = $share->getSharedWithDisplayName(); |
233 | 233 | if (empty($result['share_with_displayname'])) { |
234 | - $displayNameLength = ($hasCircleId? strrpos($share->getSharedWith(), ' '): strlen($share->getSharedWith())); |
|
234 | + $displayNameLength = ($hasCircleId ? strrpos($share->getSharedWith(), ' ') : strlen($share->getSharedWith())); |
|
235 | 235 | $result['share_with_displayname'] = substr($share->getSharedWith(), 0, $displayNameLength); |
236 | 236 | } |
237 | 237 | |
238 | 238 | $result['share_with_avatar'] = $share->getSharedWithAvatar(); |
239 | 239 | |
240 | - $shareWithStart = ($hasCircleId? strrpos($share->getSharedWith(), '[') + 1: 0); |
|
241 | - $shareWithLength = ($hasCircleId? -1: strpos($share->getSharedWith(), ' ')); |
|
240 | + $shareWithStart = ($hasCircleId ? strrpos($share->getSharedWith(), '[') + 1 : 0); |
|
241 | + $shareWithLength = ($hasCircleId ? -1 : strpos($share->getSharedWith(), ' ')); |
|
242 | 242 | $result['share_with'] = substr($share->getSharedWith(), $shareWithStart, $shareWithLength); |
243 | 243 | } else if ($share->getShareType() === Share::SHARE_TYPE_ROOM) { |
244 | 244 | $result['share_with'] = $share->getSharedWith(); |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | // FIXME: If we inject the contacts manager it gets initialized bofore any address books are registered |
269 | 269 | $result = \OC::$server->getContactsManager()->search($query, [$property]); |
270 | 270 | foreach ($result as $r) { |
271 | - foreach($r[$property] as $value) { |
|
271 | + foreach ($r[$property] as $value) { |
|
272 | 272 | if ($value === $query) { |
273 | 273 | return $r['FN']; |
274 | 274 | } |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | |
499 | 499 | $share->setSharedWith($shareWith); |
500 | 500 | $share->setPermissions($permissions); |
501 | - } else if ($shareType === Share::SHARE_TYPE_REMOTE_GROUP) { |
|
501 | + } else if ($shareType === Share::SHARE_TYPE_REMOTE_GROUP) { |
|
502 | 502 | if (!$this->shareManager->outgoingServer2ServerGroupSharesAllowed()) { |
503 | 503 | throw new OCSForbiddenException($this->l->t('Sharing %s failed because the back end does not allow shares from type %s', [$path->getPath(), $shareType])); |
504 | 504 | } |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | |
575 | 575 | $shares = array_merge($userShares, $groupShares, $circleShares, $roomShares); |
576 | 576 | |
577 | - $shares = array_filter($shares, function (IShare $share) { |
|
577 | + $shares = array_filter($shares, function(IShare $share) { |
|
578 | 578 | return $share->getShareOwner() !== $this->currentUser; |
579 | 579 | }); |
580 | 580 | |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | $shares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser, Share::SHARE_TYPE_USER, $node, false, -1, 0)); |
614 | 614 | $shares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser, Share::SHARE_TYPE_GROUP, $node, false, -1, 0)); |
615 | 615 | $shares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser, Share::SHARE_TYPE_LINK, $node, false, -1, 0)); |
616 | - if($this->shareManager->shareProviderExists(Share::SHARE_TYPE_EMAIL)) { |
|
616 | + if ($this->shareManager->shareProviderExists(Share::SHARE_TYPE_EMAIL)) { |
|
617 | 617 | $shares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser, Share::SHARE_TYPE_EMAIL, $node, false, -1, 0)); |
618 | 618 | } |
619 | 619 | if ($this->shareManager->outgoingServer2ServerSharesAllowed()) { |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | throw new OCSBadRequestException($this->l->t('Wrong or no update parameter given')); |
778 | 778 | } |
779 | 779 | |
780 | - if($note !== null) { |
|
780 | + if ($note !== null) { |
|
781 | 781 | $share->setNote($note); |
782 | 782 | } |
783 | 783 | |
@@ -794,7 +794,7 @@ discard block |
||
794 | 794 | } |
795 | 795 | |
796 | 796 | if ($permissions !== null) { |
797 | - $newPermissions = (int)$permissions; |
|
797 | + $newPermissions = (int) $permissions; |
|
798 | 798 | $newPermissions = $newPermissions & ~Constants::PERMISSION_SHARE; |
799 | 799 | } |
800 | 800 | |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | |
853 | 853 | } else { |
854 | 854 | if ($permissions !== null) { |
855 | - $permissions = (int)$permissions; |
|
855 | + $permissions = (int) $permissions; |
|
856 | 856 | $share->setPermissions($permissions); |
857 | 857 | } |
858 | 858 | |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | |
1003 | 1003 | // First check if it is an internal share. |
1004 | 1004 | try { |
1005 | - $share = $this->shareManager->getShareById('ocinternal:' . $id, $this->currentUser); |
|
1005 | + $share = $this->shareManager->getShareById('ocinternal:'.$id, $this->currentUser); |
|
1006 | 1006 | return $share; |
1007 | 1007 | } catch (ShareNotFound $e) { |
1008 | 1008 | // Do nothing, just try the other share type |
@@ -1011,7 +1011,7 @@ discard block |
||
1011 | 1011 | |
1012 | 1012 | try { |
1013 | 1013 | if ($this->shareManager->shareProviderExists(Share::SHARE_TYPE_CIRCLE)) { |
1014 | - $share = $this->shareManager->getShareById('ocCircleShare:' . $id, $this->currentUser); |
|
1014 | + $share = $this->shareManager->getShareById('ocCircleShare:'.$id, $this->currentUser); |
|
1015 | 1015 | return $share; |
1016 | 1016 | } |
1017 | 1017 | } catch (ShareNotFound $e) { |
@@ -1020,7 +1020,7 @@ discard block |
||
1020 | 1020 | |
1021 | 1021 | try { |
1022 | 1022 | if ($this->shareManager->shareProviderExists(Share::SHARE_TYPE_EMAIL)) { |
1023 | - $share = $this->shareManager->getShareById('ocMailShare:' . $id, $this->currentUser); |
|
1023 | + $share = $this->shareManager->getShareById('ocMailShare:'.$id, $this->currentUser); |
|
1024 | 1024 | return $share; |
1025 | 1025 | } |
1026 | 1026 | } catch (ShareNotFound $e) { |
@@ -1028,7 +1028,7 @@ discard block |
||
1028 | 1028 | } |
1029 | 1029 | |
1030 | 1030 | try { |
1031 | - $share = $this->shareManager->getShareById('ocRoomShare:' . $id, $this->currentUser); |
|
1031 | + $share = $this->shareManager->getShareById('ocRoomShare:'.$id, $this->currentUser); |
|
1032 | 1032 | return $share; |
1033 | 1033 | } catch (ShareNotFound $e) { |
1034 | 1034 | // Do nothing, just try the other share type |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | if (!$this->shareManager->outgoingServer2ServerSharesAllowed()) { |
1038 | 1038 | throw new ShareNotFound(); |
1039 | 1039 | } |
1040 | - $share = $this->shareManager->getShareById('ocFederatedSharing:' . $id, $this->currentUser); |
|
1040 | + $share = $this->shareManager->getShareById('ocFederatedSharing:'.$id, $this->currentUser); |
|
1041 | 1041 | |
1042 | 1042 | return $share; |
1043 | 1043 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $shares = array_merge($shares, $this->shareManager->getSharedWith($user->getUID(), \OCP\Share::SHARE_TYPE_ROOM, null, -1)); |
78 | 78 | |
79 | 79 | // filter out excluded shares and group shares that includes self |
80 | - $shares = array_filter($shares, function (\OCP\Share\IShare $share) use ($user) { |
|
80 | + $shares = array_filter($shares, function(\OCP\Share\IShare $share) use ($user) { |
|
81 | 81 | return $share->getPermissions() > 0 && $share->getShareOwner() !== $user->getUID(); |
82 | 82 | }); |
83 | 83 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | // null groups which usually appear with group backend |
190 | 190 | // caching inconsistencies |
191 | 191 | $this->logger->debug( |
192 | - 'Could not adjust share target for share ' . $share->getId() . ' to make it consistent: ' . $e->getMessage(), |
|
192 | + 'Could not adjust share target for share '.$share->getId().' to make it consistent: '.$e->getMessage(), |
|
193 | 193 | ['app' => 'files_sharing'] |
194 | 194 | ); |
195 | 195 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @param array $params |
41 | 41 | */ |
42 | 42 | public function shared(array $params) { |
43 | - if($params['shareType'] === Share::SHARE_TYPE_LINK) { |
|
43 | + if ($params['shareType'] === Share::SHARE_TYPE_LINK) { |
|
44 | 44 | $this->log( |
45 | 45 | 'The %s "%s" with ID "%s" has been shared via link with permissions "%s" (Share ID: %s)', |
46 | 46 | $params, |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | 'id', |
53 | 53 | ] |
54 | 54 | ); |
55 | - } elseif($params['shareType'] === Share::SHARE_TYPE_USER) { |
|
55 | + } elseif ($params['shareType'] === Share::SHARE_TYPE_USER) { |
|
56 | 56 | $this->log( |
57 | 57 | 'The %s "%s" with ID "%s" has been shared to the user "%s" with permissions "%s" (Share ID: %s)', |
58 | 58 | $params, |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | 'id', |
66 | 66 | ] |
67 | 67 | ); |
68 | - } elseif($params['shareType'] === Share::SHARE_TYPE_GROUP) { |
|
68 | + } elseif ($params['shareType'] === Share::SHARE_TYPE_GROUP) { |
|
69 | 69 | $this->log( |
70 | 70 | 'The %s "%s" with ID "%s" has been shared to the group "%s" with permissions "%s" (Share ID: %s)', |
71 | 71 | $params, |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | 'id', |
79 | 79 | ] |
80 | 80 | ); |
81 | - } elseif($params['shareType'] === Share::SHARE_TYPE_ROOM) { |
|
81 | + } elseif ($params['shareType'] === Share::SHARE_TYPE_ROOM) { |
|
82 | 82 | $this->log( |
83 | 83 | 'The %s "%s" with ID "%s" has been shared to the room "%s" with permissions "%s" (Share ID: %s)', |
84 | 84 | $params, |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @param array $params |
101 | 101 | */ |
102 | 102 | public function unshare(array $params) { |
103 | - if($params['shareType'] === Share::SHARE_TYPE_LINK) { |
|
103 | + if ($params['shareType'] === Share::SHARE_TYPE_LINK) { |
|
104 | 104 | $this->log( |
105 | 105 | 'The %s "%s" with ID "%s" has been unshared (Share ID: %s)', |
106 | 106 | $params, |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | 'id', |
112 | 112 | ] |
113 | 113 | ); |
114 | - } elseif($params['shareType'] === Share::SHARE_TYPE_USER) { |
|
114 | + } elseif ($params['shareType'] === Share::SHARE_TYPE_USER) { |
|
115 | 115 | $this->log( |
116 | 116 | 'The %s "%s" with ID "%s" has been unshared from the user "%s" (Share ID: %s)', |
117 | 117 | $params, |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | 'id', |
124 | 124 | ] |
125 | 125 | ); |
126 | - } elseif($params['shareType'] === Share::SHARE_TYPE_GROUP) { |
|
126 | + } elseif ($params['shareType'] === Share::SHARE_TYPE_GROUP) { |
|
127 | 127 | $this->log( |
128 | 128 | 'The %s "%s" with ID "%s" has been unshared from the group "%s" (Share ID: %s)', |
129 | 129 | $params, |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | 'id', |
136 | 136 | ] |
137 | 137 | ); |
138 | - } elseif($params['shareType'] === Share::SHARE_TYPE_ROOM) { |
|
138 | + } elseif ($params['shareType'] === Share::SHARE_TYPE_ROOM) { |
|
139 | 139 | $this->log( |
140 | 140 | 'The %s "%s" with ID "%s" has been unshared from the room "%s" (Share ID: %s)', |
141 | 141 | $params, |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $this->sourceUser = $sourceUserObject->getUID(); |
124 | 124 | $this->destinationUser = $destinationUserObject->getUID(); |
125 | 125 | $sourcePathOption = ltrim($input->getOption('path'), '/'); |
126 | - $this->sourcePath = rtrim($this->sourceUser . '/files/' . $sourcePathOption, '/'); |
|
126 | + $this->sourcePath = rtrim($this->sourceUser.'/files/'.$sourcePathOption, '/'); |
|
127 | 127 | |
128 | 128 | // target user has to be ready |
129 | 129 | if (!\OC::$server->getEncryptionManager()->isReadyForUser($this->destinationUser)) { |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $self = $this; |
181 | 181 | |
182 | 182 | $this->walkFiles($view, $this->sourcePath, |
183 | - function (FileInfo $fileInfo) use ($progress, $self) { |
|
183 | + function(FileInfo $fileInfo) use ($progress, $self) { |
|
184 | 184 | if ($fileInfo->getType() === FileInfo::TYPE_FOLDER) { |
185 | 185 | // only analyze into folders from main storage, |
186 | 186 | if (!$fileInfo->getStorage()->instanceOfStorage(IHomeStorage::class)) { |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | // no file is allowed to be encrypted |
202 | 202 | if (!empty($this->encryptedFiles)) { |
203 | 203 | $output->writeln("<error>Some files are encrypted - please decrypt them first</error>"); |
204 | - foreach($this->encryptedFiles as $encryptedFile) { |
|
204 | + foreach ($this->encryptedFiles as $encryptedFile) { |
|
205 | 205 | /** @var FileInfo $encryptedFile */ |
206 | - $output->writeln(" " . $encryptedFile->getPath()); |
|
206 | + $output->writeln(" ".$encryptedFile->getPath()); |
|
207 | 207 | } |
208 | 208 | throw new \Exception('Execution terminated.'); |
209 | 209 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $output->writeln("Collecting all share information for files and folder of $this->sourceUser ..."); |
218 | 218 | |
219 | 219 | $progress = new ProgressBar($output, count($this->shares)); |
220 | - foreach([\OCP\Share::SHARE_TYPE_GROUP, \OCP\Share::SHARE_TYPE_USER, \OCP\Share::SHARE_TYPE_LINK, \OCP\Share::SHARE_TYPE_REMOTE, \OCP\Share::SHARE_TYPE_ROOM] as $shareType) { |
|
220 | + foreach ([\OCP\Share::SHARE_TYPE_GROUP, \OCP\Share::SHARE_TYPE_USER, \OCP\Share::SHARE_TYPE_LINK, \OCP\Share::SHARE_TYPE_REMOTE, \OCP\Share::SHARE_TYPE_ROOM] as $shareType) { |
|
221 | 221 | $offset = 0; |
222 | 222 | while (true) { |
223 | 223 | $sharePage = $this->shareManager->getSharesBy($this->sourceUser, $shareType, null, true, 50, $offset); |
@@ -243,9 +243,9 @@ discard block |
||
243 | 243 | |
244 | 244 | // This change will help user to transfer the folder specified using --path option. |
245 | 245 | // Else only the content inside folder is transferred which is not correct. |
246 | - if($this->sourcePath !== "$this->sourceUser/files") { |
|
246 | + if ($this->sourcePath !== "$this->sourceUser/files") { |
|
247 | 247 | $view->mkdir($this->finalTarget); |
248 | - $this->finalTarget = $this->finalTarget . '/' . basename($this->sourcePath); |
|
248 | + $this->finalTarget = $this->finalTarget.'/'.basename($this->sourcePath); |
|
249 | 249 | } |
250 | 250 | $view->rename($this->sourcePath, $this->finalTarget); |
251 | 251 | if (!is_dir("$this->sourceUser/files")) { |
@@ -261,12 +261,12 @@ discard block |
||
261 | 261 | $output->writeln("Restoring shares ..."); |
262 | 262 | $progress = new ProgressBar($output, count($this->shares)); |
263 | 263 | |
264 | - foreach($this->shares as $share) { |
|
264 | + foreach ($this->shares as $share) { |
|
265 | 265 | try { |
266 | 266 | if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER && |
267 | 267 | $share->getSharedWith() === $this->destinationUser) { |
268 | 268 | // Unmount the shares before deleting, so we don't try to get the storage later on. |
269 | - $shareMountPoint = $this->mountManager->find('/' . $this->destinationUser . '/files' . $share->getTarget()); |
|
269 | + $shareMountPoint = $this->mountManager->find('/'.$this->destinationUser.'/files'.$share->getTarget()); |
|
270 | 270 | if ($shareMountPoint) { |
271 | 271 | $this->mountManager->removeMount($shareMountPoint->getMountPoint()); |
272 | 272 | } |
@@ -282,9 +282,9 @@ discard block |
||
282 | 282 | $this->shareManager->updateShare($share); |
283 | 283 | } |
284 | 284 | } catch (\OCP\Files\NotFoundException $e) { |
285 | - $output->writeln('<error>Share with id ' . $share->getId() . ' points at deleted file, skipping</error>'); |
|
285 | + $output->writeln('<error>Share with id '.$share->getId().' points at deleted file, skipping</error>'); |
|
286 | 286 | } catch (\Exception $e) { |
287 | - $output->writeln('<error>Could not restore share with id ' . $share->getId() . ':' . $e->getTraceAsString() . '</error>'); |
|
287 | + $output->writeln('<error>Could not restore share with id '.$share->getId().':'.$e->getTraceAsString().'</error>'); |
|
288 | 288 | } |
289 | 289 | $progress->advance(); |
290 | 290 | } |