@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $shares = array_merge($shares, $this->shareManager->getSharedWith($user->getUID(), \OCP\Share::SHARE_TYPE_CIRCLE, null, -1)); |
75 | 75 | |
76 | 76 | // filter out excluded shares and group shares that includes self |
77 | - $shares = array_filter($shares, function (\OCP\Share\IShare $share) use ($user) { |
|
77 | + $shares = array_filter($shares, function(\OCP\Share\IShare $share) use ($user) { |
|
78 | 78 | return $share->getPermissions() > 0 && $share->getShareOwner() !== $user->getUID(); |
79 | 79 | }); |
80 | 80 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | // null groups which usually appear with group backend |
187 | 187 | // caching inconsistencies |
188 | 188 | $this->logger->debug( |
189 | - 'Could not adjust share target for share ' . $share->getId() . ' to make it consistent: ' . $e->getMessage(), |
|
189 | + 'Could not adjust share target for share '.$share->getId().' to make it consistent: '.$e->getMessage(), |
|
190 | 190 | ['app' => 'files_sharing'] |
191 | 191 | ); |
192 | 192 | } |
@@ -74,13 +74,13 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function getMountsForUser(IUser $user) { |
76 | 76 | $loader = $this->loader; |
77 | - $mounts = array_map(function (IMountProvider $provider) use ($user, $loader) { |
|
77 | + $mounts = array_map(function(IMountProvider $provider) use ($user, $loader) { |
|
78 | 78 | return $provider->getMountsForUser($user, $loader); |
79 | 79 | }, $this->providers); |
80 | - $mounts = array_filter($mounts, function ($result) { |
|
80 | + $mounts = array_filter($mounts, function($result) { |
|
81 | 81 | return is_array($result); |
82 | 82 | }); |
83 | - return array_reduce($mounts, function (array $mounts, array $providerMounts) { |
|
83 | + return array_reduce($mounts, function(array $mounts, array $providerMounts) { |
|
84 | 84 | return array_merge($mounts, $providerMounts); |
85 | 85 | }, array()); |
86 | 86 | } |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | // shared mount provider gets to go last since it needs to know existing files |
90 | 90 | // to check for name collisions |
91 | 91 | $firstMounts = []; |
92 | - $firstProviders = array_filter($this->providers, function (IMountProvider $provider) { |
|
92 | + $firstProviders = array_filter($this->providers, function(IMountProvider $provider) { |
|
93 | 93 | return (get_class($provider) !== 'OCA\Files_Sharing\MountProvider'); |
94 | 94 | }); |
95 | - $lastProviders = array_filter($this->providers, function (IMountProvider $provider) { |
|
95 | + $lastProviders = array_filter($this->providers, function(IMountProvider $provider) { |
|
96 | 96 | return (get_class($provider) === 'OCA\Files_Sharing\MountProvider'); |
97 | 97 | }); |
98 | 98 | foreach ($firstProviders as $provider) { |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | $providers = array_reverse($this->homeProviders); // call the latest registered provider first to give apps an opportunity to overwrite builtin |
129 | 129 | foreach ($providers as $homeProvider) { |
130 | 130 | if ($mount = $homeProvider->getHomeMountForUser($user, $this->loader)) { |
131 | - $mount->setMountPoint('/' . $user->getUID()); //make sure the mountpoint is what we expect |
|
131 | + $mount->setMountPoint('/'.$user->getUID()); //make sure the mountpoint is what we expect |
|
132 | 132 | return $mount; |
133 | 133 | } |
134 | 134 | } |
135 | - throw new \Exception('No home storage configured for user ' . $user); |
|
135 | + throw new \Exception('No home storage configured for user '.$user); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $result = array(); |
45 | 45 | $timestamp = null; |
46 | 46 | |
47 | - $view = new \OC\Files\View('/' . $user . '/files_trashbin/files'); |
|
47 | + $view = new \OC\Files\View('/'.$user.'/files_trashbin/files'); |
|
48 | 48 | |
49 | 49 | if (ltrim($dir, '/') !== '' && !$view->is_dir($dir)) { |
50 | 50 | throw new \Exception('Directory does not exists'); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $timestamp = substr(pathinfo($parts[0], PATHINFO_EXTENSION), 1); |
73 | 73 | } |
74 | 74 | $originalPath = ''; |
75 | - $originalName = substr($entryName, 0, -strlen($timestamp)-2); |
|
75 | + $originalName = substr($entryName, 0, -strlen($timestamp) - 2); |
|
76 | 76 | if (isset($originalLocations[$originalName][$timestamp])) { |
77 | 77 | $originalPath = $originalLocations[$originalName][$timestamp]; |
78 | 78 | if (substr($originalPath, -1) === '/') { |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | ); |
93 | 93 | if ($originalPath) { |
94 | 94 | if ($originalPath !== '.') { |
95 | - $i['extraData'] = $originalPath . '/' . $originalName; |
|
95 | + $i['extraData'] = $originalPath.'/'.$originalName; |
|
96 | 96 | } else { |
97 | 97 | $i['extraData'] = $originalName; |
98 | 98 | } |
99 | 99 | } |
100 | - $result[] = new FileInfo($absoluteDir . '/' . $i['name'], $storage, $internalPath . '/' . $i['name'], $i, $mount); |
|
100 | + $result[] = new FileInfo($absoluteDir.'/'.$i['name'], $storage, $internalPath.'/'.$i['name'], $i, $mount); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | if ($sortAttribute !== '') { |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $this->sourceUser = $sourceUserObject->getUID(); |
120 | 120 | $this->destinationUser = $destinationUserObject->getUID(); |
121 | 121 | $sourcePathOption = ltrim($input->getOption('path'), '/'); |
122 | - $this->sourcePath = rtrim($this->sourceUser . '/files/' . $sourcePathOption, '/'); |
|
122 | + $this->sourcePath = rtrim($this->sourceUser.'/files/'.$sourcePathOption, '/'); |
|
123 | 123 | |
124 | 124 | // target user has to be ready |
125 | 125 | if (!\OC::$server->getEncryptionManager()->isReadyForUser($this->destinationUser)) { |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $self = $this; |
177 | 177 | |
178 | 178 | $this->walkFiles($view, $this->sourcePath, |
179 | - function (FileInfo $fileInfo) use ($progress, $self) { |
|
179 | + function(FileInfo $fileInfo) use ($progress, $self) { |
|
180 | 180 | if ($fileInfo->getType() === FileInfo::TYPE_FOLDER) { |
181 | 181 | // only analyze into folders from main storage, |
182 | 182 | if (!$fileInfo->getStorage()->instanceOfStorage(IHomeStorage::class)) { |
@@ -197,9 +197,9 @@ discard block |
||
197 | 197 | // no file is allowed to be encrypted |
198 | 198 | if (!empty($this->encryptedFiles)) { |
199 | 199 | $output->writeln("<error>Some files are encrypted - please decrypt them first</error>"); |
200 | - foreach($this->encryptedFiles as $encryptedFile) { |
|
200 | + foreach ($this->encryptedFiles as $encryptedFile) { |
|
201 | 201 | /** @var FileInfo $encryptedFile */ |
202 | - $output->writeln(" " . $encryptedFile->getPath()); |
|
202 | + $output->writeln(" ".$encryptedFile->getPath()); |
|
203 | 203 | } |
204 | 204 | throw new \Exception('Execution terminated.'); |
205 | 205 | } |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $output->writeln("Collecting all share information for files and folder of $this->sourceUser ..."); |
214 | 214 | |
215 | 215 | $progress = new ProgressBar($output, count($this->shares)); |
216 | - foreach([\OCP\Share::SHARE_TYPE_GROUP, \OCP\Share::SHARE_TYPE_USER, \OCP\Share::SHARE_TYPE_LINK, \OCP\Share::SHARE_TYPE_REMOTE] as $shareType) { |
|
216 | + foreach ([\OCP\Share::SHARE_TYPE_GROUP, \OCP\Share::SHARE_TYPE_USER, \OCP\Share::SHARE_TYPE_LINK, \OCP\Share::SHARE_TYPE_REMOTE] as $shareType) { |
|
217 | 217 | $offset = 0; |
218 | 218 | while (true) { |
219 | 219 | $sharePage = $this->shareManager->getSharesBy($this->sourceUser, $shareType, null, true, 50, $offset); |
@@ -239,9 +239,9 @@ discard block |
||
239 | 239 | |
240 | 240 | // This change will help user to transfer the folder specified using --path option. |
241 | 241 | // Else only the content inside folder is transferred which is not correct. |
242 | - if($this->sourcePath !== "$this->sourceUser/files") { |
|
242 | + if ($this->sourcePath !== "$this->sourceUser/files") { |
|
243 | 243 | $view->mkdir($this->finalTarget); |
244 | - $this->finalTarget = $this->finalTarget . '/' . basename($this->sourcePath); |
|
244 | + $this->finalTarget = $this->finalTarget.'/'.basename($this->sourcePath); |
|
245 | 245 | } |
246 | 246 | $view->rename($this->sourcePath, $this->finalTarget); |
247 | 247 | if (!is_dir("$this->sourceUser/files")) { |
@@ -257,11 +257,11 @@ discard block |
||
257 | 257 | $output->writeln("Restoring shares ..."); |
258 | 258 | $progress = new ProgressBar($output, count($this->shares)); |
259 | 259 | |
260 | - foreach($this->shares as $share) { |
|
260 | + foreach ($this->shares as $share) { |
|
261 | 261 | try { |
262 | 262 | if ($share->getSharedWith() === $this->destinationUser) { |
263 | 263 | // Unmount the shares before deleting, so we don't try to get the storage later on. |
264 | - $shareMountPoint = $this->mountManager->find('/' . $this->destinationUser . '/files' . $share->getTarget()); |
|
264 | + $shareMountPoint = $this->mountManager->find('/'.$this->destinationUser.'/files'.$share->getTarget()); |
|
265 | 265 | if ($shareMountPoint) { |
266 | 266 | $this->mountManager->removeMount($shareMountPoint->getMountPoint()); |
267 | 267 | } |
@@ -277,9 +277,9 @@ discard block |
||
277 | 277 | $this->shareManager->updateShare($share); |
278 | 278 | } |
279 | 279 | } catch (\OCP\Files\NotFoundException $e) { |
280 | - $output->writeln('<error>Share with id ' . $share->getId() . ' points at deleted file, skipping</error>'); |
|
280 | + $output->writeln('<error>Share with id '.$share->getId().' points at deleted file, skipping</error>'); |
|
281 | 281 | } catch (\Exception $e) { |
282 | - $output->writeln('<error>Could not restore share with id ' . $share->getId() . ':' . $e->getTraceAsString() . '</error>'); |
|
282 | + $output->writeln('<error>Could not restore share with id '.$share->getId().':'.$e->getTraceAsString().'</error>'); |
|
283 | 283 | } |
284 | 284 | $progress->advance(); |
285 | 285 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | ]); |
111 | 111 | } |
112 | 112 | // password policy app throws exception |
113 | - } catch(HintException $e) { |
|
113 | + } catch (HintException $e) { |
|
114 | 114 | return new JSONResponse([ |
115 | 115 | 'status' => 'error', |
116 | 116 | 'data' => [ |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | 'message' => $this->l->t('Please provide an admin recovery password; otherwise, all user data will be lost.'), |
221 | 221 | ] |
222 | 222 | ]); |
223 | - } elseif ($recoveryEnabledForUser && ! $validRecoveryPassword) { |
|
223 | + } elseif ($recoveryEnabledForUser && !$validRecoveryPassword) { |
|
224 | 224 | return new JSONResponse([ |
225 | 225 | 'status' => 'error', |
226 | 226 | 'data' => [ |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | try { |
232 | 232 | $result = $targetUser->setPassword($password, $recoveryPassword); |
233 | 233 | // password policy app throws exception |
234 | - } catch(HintException $e) { |
|
234 | + } catch (HintException $e) { |
|
235 | 235 | return new JSONResponse([ |
236 | 236 | 'status' => 'error', |
237 | 237 | 'data' => [ |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | ]); |
267 | 267 | } |
268 | 268 | // password policy app throws exception |
269 | - } catch(HintException $e) { |
|
269 | + } catch (HintException $e) { |
|
270 | 270 | return new JSONResponse([ |
271 | 271 | 'status' => 'error', |
272 | 272 | 'data' => [ |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | if ($ex->getCode() === Http::STATUS_UNAUTHORIZED) { |
100 | 100 | // remote server revoked access to the address book, remove it |
101 | 101 | $this->backend->deleteAddressBook($addressBookId); |
102 | - $this->logger->info('Authorization failed, remove address book: ' . $url, ['app' => 'dav']); |
|
102 | + $this->logger->info('Authorization failed, remove address book: '.$url, ['app' => 'dav']); |
|
103 | 103 | throw $ex; |
104 | 104 | } |
105 | 105 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | */ |
150 | 150 | protected function getClient($url, $userName, $sharedSecret) { |
151 | 151 | $settings = [ |
152 | - 'baseUri' => $url . '/', |
|
152 | + 'baseUri' => $url.'/', |
|
153 | 153 | 'userName' => $userName, |
154 | 154 | 'password' => $sharedSecret, |
155 | 155 | ]; |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | */ |
270 | 270 | public function deleteUser($userOrCardId) { |
271 | 271 | $systemAddressBook = $this->getLocalSystemAddressBook(); |
272 | - if ($userOrCardId instanceof IUser){ |
|
272 | + if ($userOrCardId instanceof IUser) { |
|
273 | 273 | $name = $userOrCardId->getBackendClassName(); |
274 | 274 | $userId = $userOrCardId->getUID(); |
275 | 275 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | if (is_null($this->localSystemAddressBook)) { |
286 | 286 | $systemPrincipal = "principals/system/system"; |
287 | 287 | $this->localSystemAddressBook = $this->ensureSystemAddressBookExists($systemPrincipal, 'system', [ |
288 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => 'System addressbook which holds all users of this instance' |
|
288 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => 'System addressbook which holds all users of this instance' |
|
289 | 289 | ]); |
290 | 290 | } |
291 | 291 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | |
304 | 304 | // remove no longer existing |
305 | 305 | $allCards = $this->backend->getCards($systemAddressBook['id']); |
306 | - foreach($allCards as $card) { |
|
306 | + foreach ($allCards as $card) { |
|
307 | 307 | $vCard = Reader::read($card['carddata']); |
308 | 308 | $uid = $vCard->UID->getValue(); |
309 | 309 | // load backend and see if user exists |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @param \OCP\Files\Mount\IMountPoint $mount |
88 | 88 | * @param \OCP\IUser|null $owner |
89 | 89 | */ |
90 | - public function __construct($path, $storage, $internalPath, $data, $mount, $owner= null) { |
|
90 | + public function __construct($path, $storage, $internalPath, $data, $mount, $owner = null) { |
|
91 | 91 | $this->path = $path; |
92 | 92 | $this->storage = $storage; |
93 | 93 | $this->internalPath = $internalPath; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @return int|null |
154 | 154 | */ |
155 | 155 | public function getId() { |
156 | - return isset($this->data['fileid']) ? (int) $this->data['fileid'] : null; |
|
156 | + return isset($this->data['fileid']) ? (int) $this->data['fileid'] : null; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | public function getEtag() { |
184 | 184 | $this->updateEntryfromSubMounts(); |
185 | 185 | if (count($this->childEtags) > 0) { |
186 | - $combinedEtag = $this->data['etag'] . '::' . implode('::', $this->childEtags); |
|
186 | + $combinedEtag = $this->data['etag'].'::'.implode('::', $this->childEtags); |
|
187 | 187 | return md5($combinedEtag); |
188 | 188 | } else { |
189 | 189 | return $this->data['etag']; |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | $relativeEntryPath = substr($entryPath, strlen($this->getPath())); |
380 | 380 | // attach the permissions to propagate etag on permision changes of submounts |
381 | 381 | $permissions = isset($data['permissions']) ? $data['permissions'] : 0; |
382 | - $this->childEtags[] = $relativeEntryPath . '/' . $data['etag'] . $permissions; |
|
382 | + $this->childEtags[] = $relativeEntryPath.'/'.$data['etag'].$permissions; |
|
383 | 383 | } |
384 | 384 | } |
385 | 385 |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | public function getChild($name) { |
60 | 60 | $elements = pathinfo($name); |
61 | 61 | $ext = isset($elements['extension']) ? $elements['extension'] : ''; |
62 | - $size = (int)(isset($elements['filename']) ? $elements['filename'] : '64'); |
|
62 | + $size = (int) (isset($elements['filename']) ? $elements['filename'] : '64'); |
|
63 | 63 | if (!in_array($ext, ['jpeg', 'png'], true)) { |
64 | 64 | throw new MethodNotAllowed('File format not allowed'); |
65 | 65 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | return [ |
79 | 79 | $this->getChild('96.jpeg') |
80 | 80 | ]; |
81 | - } catch(NotFound $exception) { |
|
81 | + } catch (NotFound $exception) { |
|
82 | 82 | return []; |
83 | 83 | } |
84 | 84 | } |
@@ -89,7 +89,7 @@ |
||
89 | 89 | public function getLastModified() { |
90 | 90 | $timestamp = $this->avatar->getFile($this->size)->getMTime(); |
91 | 91 | if (!empty($timestamp)) { |
92 | - return (int)$timestamp; |
|
92 | + return (int) $timestamp; |
|
93 | 93 | } |
94 | 94 | return $timestamp; |
95 | 95 |