@@ -45,15 +45,15 @@ discard block |
||
45 | 45 | protected function getAddressbookHomeForPrincipal($principal) { |
46 | 46 | if (strrpos($principal, 'principals/users', -strlen($principal)) !== false) { |
47 | 47 | [, $principalId] = \Sabre\Uri\split($principal); |
48 | - return self::ADDRESSBOOK_ROOT . '/users/' . $principalId; |
|
48 | + return self::ADDRESSBOOK_ROOT.'/users/'.$principalId; |
|
49 | 49 | } |
50 | 50 | if (strrpos($principal, 'principals/groups', -strlen($principal)) !== false) { |
51 | 51 | [, $principalId] = \Sabre\Uri\split($principal); |
52 | - return self::ADDRESSBOOK_ROOT . '/groups/' . $principalId; |
|
52 | + return self::ADDRESSBOOK_ROOT.'/groups/'.$principalId; |
|
53 | 53 | } |
54 | 54 | if (strrpos($principal, 'principals/system', -strlen($principal)) !== false) { |
55 | 55 | [, $principalId] = \Sabre\Uri\split($principal); |
56 | - return self::ADDRESSBOOK_ROOT . '/system/' . $principalId; |
|
56 | + return self::ADDRESSBOOK_ROOT.'/system/'.$principalId; |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $ns = '{http://owncloud.org/ns}'; |
69 | 69 | |
70 | 70 | if ($node instanceof AddressBook) { |
71 | - $propFind->handle($ns . 'groups', function () use ($node) { |
|
71 | + $propFind->handle($ns.'groups', function() use ($node) { |
|
72 | 72 | return new Groups($node->getContactsGroups()); |
73 | 73 | }); |
74 | 74 | } |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | $proxies = $this->proxyMapper->getProxiesFor($principal); |
93 | 93 | foreach ($proxies as $proxy) { |
94 | 94 | if ($proxy->getPermissions() === ProxyMapper::PERMISSION_READ) { |
95 | - $groups[] = $proxy->getOwnerId() . '/calendar-proxy-read'; |
|
95 | + $groups[] = $proxy->getOwnerId().'/calendar-proxy-read'; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | if ($proxy->getPermissions() === (ProxyMapper::PERMISSION_READ | ProxyMapper::PERMISSION_WRITE)) { |
99 | - $groups[] = $proxy->getOwnerId() . '/calendar-proxy-write'; |
|
99 | + $groups[] = $proxy->getOwnerId().'/calendar-proxy-write'; |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | [$prefix, $name] = \Sabre\Uri\split($member); |
137 | 137 | |
138 | 138 | if ($prefix !== $this->principalPrefix) { |
139 | - throw new Exception('Invalid member group prefix: ' . $prefix); |
|
139 | + throw new Exception('Invalid member group prefix: '.$prefix); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | $principalArray = $this->getPrincipalByPath($member); |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $proxy->setPermissions($proxy->getPermissions() | $permission); |
152 | 152 | $this->proxyMapper->update($proxy); |
153 | 153 | |
154 | - $proxies = array_filter($proxies, function (Proxy $p) use ($proxy) { |
|
154 | + $proxies = array_filter($proxies, function(Proxy $p) use ($proxy) { |
|
155 | 155 | return $p->getId() !== $proxy->getId(); |
156 | 156 | }); |
157 | 157 | break; |
@@ -178,9 +178,9 @@ discard block |
||
178 | 178 | $this->server->on('propPatch', [$this, 'handleUpdateProperties']); |
179 | 179 | $this->server->on('afterBind', [$this, 'sendFileIdHeader']); |
180 | 180 | $this->server->on('afterWriteContent', [$this, 'sendFileIdHeader']); |
181 | - $this->server->on('afterMethod:GET', [$this,'httpGet']); |
|
181 | + $this->server->on('afterMethod:GET', [$this, 'httpGet']); |
|
182 | 182 | $this->server->on('afterMethod:GET', [$this, 'handleDownloadToken']); |
183 | - $this->server->on('afterResponse', function ($request, ResponseInterface $response) { |
|
183 | + $this->server->on('afterResponse', function($request, ResponseInterface $response) { |
|
184 | 184 | $body = $response->getBody(); |
185 | 185 | if (is_resource($body)) { |
186 | 186 | fclose($body); |
@@ -202,17 +202,17 @@ discard block |
||
202 | 202 | if (!$sourceNode instanceof Node) { |
203 | 203 | return; |
204 | 204 | } |
205 | - [$sourceDir,] = \Sabre\Uri\split($source); |
|
206 | - [$destinationDir,] = \Sabre\Uri\split($destination); |
|
205 | + [$sourceDir, ] = \Sabre\Uri\split($source); |
|
206 | + [$destinationDir, ] = \Sabre\Uri\split($destination); |
|
207 | 207 | |
208 | 208 | if ($sourceDir !== $destinationDir) { |
209 | 209 | $sourceNodeFileInfo = $sourceNode->getFileInfo(); |
210 | 210 | if ($sourceNodeFileInfo === null) { |
211 | - throw new NotFound($source . ' does not exist'); |
|
211 | + throw new NotFound($source.' does not exist'); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | if (!$sourceNodeFileInfo->isDeletable()) { |
215 | - throw new Forbidden($source . " cannot be deleted"); |
|
215 | + throw new Forbidden($source." cannot be deleted"); |
|
216 | 216 | } |
217 | 217 | } |
218 | 218 | } |
@@ -267,10 +267,10 @@ discard block |
||
267 | 267 | Request::USER_AGENT_ANDROID_MOBILE_CHROME, |
268 | 268 | Request::USER_AGENT_FREEBOX, |
269 | 269 | ])) { |
270 | - $response->addHeader('Content-Disposition', 'attachment; filename="' . rawurlencode($filename) . '"'); |
|
270 | + $response->addHeader('Content-Disposition', 'attachment; filename="'.rawurlencode($filename).'"'); |
|
271 | 271 | } else { |
272 | - $response->addHeader('Content-Disposition', 'attachment; filename*=UTF-8\'\'' . rawurlencode($filename) |
|
273 | - . '; filename="' . rawurlencode($filename) . '"'); |
|
272 | + $response->addHeader('Content-Disposition', 'attachment; filename*=UTF-8\'\''.rawurlencode($filename) |
|
273 | + . '; filename="'.rawurlencode($filename).'"'); |
|
274 | 274 | } |
275 | 275 | } |
276 | 276 | |
@@ -305,15 +305,15 @@ discard block |
||
305 | 305 | * } |
306 | 306 | */ |
307 | 307 | |
308 | - $propFind->handle(self::FILEID_PROPERTYNAME, function () use ($node) { |
|
308 | + $propFind->handle(self::FILEID_PROPERTYNAME, function() use ($node) { |
|
309 | 309 | return $node->getFileId(); |
310 | 310 | }); |
311 | 311 | |
312 | - $propFind->handle(self::INTERNAL_FILEID_PROPERTYNAME, function () use ($node) { |
|
312 | + $propFind->handle(self::INTERNAL_FILEID_PROPERTYNAME, function() use ($node) { |
|
313 | 313 | return $node->getInternalFileId(); |
314 | 314 | }); |
315 | 315 | |
316 | - $propFind->handle(self::PERMISSIONS_PROPERTYNAME, function () use ($node) { |
|
316 | + $propFind->handle(self::PERMISSIONS_PROPERTYNAME, function() use ($node) { |
|
317 | 317 | $perms = $node->getDavPermissions(); |
318 | 318 | if ($this->isPublic) { |
319 | 319 | // remove mount information |
@@ -322,13 +322,13 @@ discard block |
||
322 | 322 | return $perms; |
323 | 323 | }); |
324 | 324 | |
325 | - $propFind->handle(self::SHARE_PERMISSIONS_PROPERTYNAME, function () use ($node, $httpRequest) { |
|
325 | + $propFind->handle(self::SHARE_PERMISSIONS_PROPERTYNAME, function() use ($node, $httpRequest) { |
|
326 | 326 | return $node->getSharePermissions( |
327 | 327 | $httpRequest->getRawServerValue('PHP_AUTH_USER') |
328 | 328 | ); |
329 | 329 | }); |
330 | 330 | |
331 | - $propFind->handle(self::OCM_SHARE_PERMISSIONS_PROPERTYNAME, function () use ($node, $httpRequest) { |
|
331 | + $propFind->handle(self::OCM_SHARE_PERMISSIONS_PROPERTYNAME, function() use ($node, $httpRequest) { |
|
332 | 332 | $ncPermissions = $node->getSharePermissions( |
333 | 333 | $httpRequest->getRawServerValue('PHP_AUTH_USER') |
334 | 334 | ); |
@@ -336,11 +336,11 @@ discard block |
||
336 | 336 | return json_encode($ocmPermissions); |
337 | 337 | }); |
338 | 338 | |
339 | - $propFind->handle(self::GETETAG_PROPERTYNAME, function () use ($node) { |
|
339 | + $propFind->handle(self::GETETAG_PROPERTYNAME, function() use ($node) { |
|
340 | 340 | return $node->getETag(); |
341 | 341 | }); |
342 | 342 | |
343 | - $propFind->handle(self::OWNER_ID_PROPERTYNAME, function () use ($node) { |
|
343 | + $propFind->handle(self::OWNER_ID_PROPERTYNAME, function() use ($node) { |
|
344 | 344 | $owner = $node->getOwner(); |
345 | 345 | if (!$owner) { |
346 | 346 | return null; |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | return $owner->getUID(); |
349 | 349 | } |
350 | 350 | }); |
351 | - $propFind->handle(self::OWNER_DISPLAY_NAME_PROPERTYNAME, function () use ($node) { |
|
351 | + $propFind->handle(self::OWNER_DISPLAY_NAME_PROPERTYNAME, function() use ($node) { |
|
352 | 352 | $owner = $node->getOwner(); |
353 | 353 | if (!$owner) { |
354 | 354 | return null; |
@@ -357,17 +357,17 @@ discard block |
||
357 | 357 | } |
358 | 358 | }); |
359 | 359 | |
360 | - $propFind->handle(self::HAS_PREVIEW_PROPERTYNAME, function () use ($node) { |
|
360 | + $propFind->handle(self::HAS_PREVIEW_PROPERTYNAME, function() use ($node) { |
|
361 | 361 | return json_encode($this->previewManager->isAvailable($node->getFileInfo())); |
362 | 362 | }); |
363 | - $propFind->handle(self::SIZE_PROPERTYNAME, function () use ($node) { |
|
363 | + $propFind->handle(self::SIZE_PROPERTYNAME, function() use ($node) { |
|
364 | 364 | return $node->getSize(); |
365 | 365 | }); |
366 | - $propFind->handle(self::MOUNT_TYPE_PROPERTYNAME, function () use ($node) { |
|
366 | + $propFind->handle(self::MOUNT_TYPE_PROPERTYNAME, function() use ($node) { |
|
367 | 367 | return $node->getFileInfo()->getMountPoint()->getMountType(); |
368 | 368 | }); |
369 | 369 | |
370 | - $propFind->handle(self::SHARE_NOTE, function () use ($node, $httpRequest) { |
|
370 | + $propFind->handle(self::SHARE_NOTE, function() use ($node, $httpRequest) { |
|
371 | 371 | return $node->getNoteFromShare( |
372 | 372 | $httpRequest->getRawServerValue('PHP_AUTH_USER') |
373 | 373 | ); |
@@ -375,13 +375,13 @@ discard block |
||
375 | 375 | } |
376 | 376 | |
377 | 377 | if ($node instanceof \OCA\DAV\Connector\Sabre\Node) { |
378 | - $propFind->handle(self::DATA_FINGERPRINT_PROPERTYNAME, function () use ($node) { |
|
378 | + $propFind->handle(self::DATA_FINGERPRINT_PROPERTYNAME, function() use ($node) { |
|
379 | 379 | return $this->config->getSystemValue('data-fingerprint', ''); |
380 | 380 | }); |
381 | 381 | } |
382 | 382 | |
383 | 383 | if ($node instanceof \OCA\DAV\Connector\Sabre\File) { |
384 | - $propFind->handle(self::DOWNLOADURL_PROPERTYNAME, function () use ($node) { |
|
384 | + $propFind->handle(self::DOWNLOADURL_PROPERTYNAME, function() use ($node) { |
|
385 | 385 | try { |
386 | 386 | $directDownloadUrl = $node->getDirectDownload(); |
387 | 387 | if (isset($directDownloadUrl['url'])) { |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | return false; |
396 | 396 | }); |
397 | 397 | |
398 | - $propFind->handle(self::CHECKSUMS_PROPERTYNAME, function () use ($node) { |
|
398 | + $propFind->handle(self::CHECKSUMS_PROPERTYNAME, function() use ($node) { |
|
399 | 399 | $checksum = $node->getChecksum(); |
400 | 400 | if ($checksum === null || $checksum === '') { |
401 | 401 | return null; |
@@ -404,21 +404,21 @@ discard block |
||
404 | 404 | return new ChecksumList($checksum); |
405 | 405 | }); |
406 | 406 | |
407 | - $propFind->handle(self::CREATION_TIME_PROPERTYNAME, function () use ($node) { |
|
407 | + $propFind->handle(self::CREATION_TIME_PROPERTYNAME, function() use ($node) { |
|
408 | 408 | return $node->getFileInfo()->getCreationTime(); |
409 | 409 | }); |
410 | 410 | |
411 | - $propFind->handle(self::UPLOAD_TIME_PROPERTYNAME, function () use ($node) { |
|
411 | + $propFind->handle(self::UPLOAD_TIME_PROPERTYNAME, function() use ($node) { |
|
412 | 412 | return $node->getFileInfo()->getUploadTime(); |
413 | 413 | }); |
414 | 414 | } |
415 | 415 | |
416 | 416 | if ($node instanceof \OCA\DAV\Connector\Sabre\Directory) { |
417 | - $propFind->handle(self::SIZE_PROPERTYNAME, function () use ($node) { |
|
417 | + $propFind->handle(self::SIZE_PROPERTYNAME, function() use ($node) { |
|
418 | 418 | return $node->getSize(); |
419 | 419 | }); |
420 | 420 | |
421 | - $propFind->handle(self::IS_ENCRYPTED_PROPERTYNAME, function () use ($node) { |
|
421 | + $propFind->handle(self::IS_ENCRYPTED_PROPERTYNAME, function() use ($node) { |
|
422 | 422 | return $node->getFileInfo()->isEncrypted() ? '1' : '0'; |
423 | 423 | }); |
424 | 424 | } |
@@ -463,14 +463,14 @@ discard block |
||
463 | 463 | return; |
464 | 464 | } |
465 | 465 | |
466 | - $propPatch->handle(self::LASTMODIFIED_PROPERTYNAME, function ($time) use ($node) { |
|
466 | + $propPatch->handle(self::LASTMODIFIED_PROPERTYNAME, function($time) use ($node) { |
|
467 | 467 | if (empty($time)) { |
468 | 468 | return false; |
469 | 469 | } |
470 | 470 | $node->touch($time); |
471 | 471 | return true; |
472 | 472 | }); |
473 | - $propPatch->handle(self::GETETAG_PROPERTYNAME, function ($etag) use ($node) { |
|
473 | + $propPatch->handle(self::GETETAG_PROPERTYNAME, function($etag) use ($node) { |
|
474 | 474 | if (empty($etag)) { |
475 | 475 | return false; |
476 | 476 | } |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | } |
480 | 480 | return false; |
481 | 481 | }); |
482 | - $propPatch->handle(self::CREATION_TIME_PROPERTYNAME, function ($time) use ($node) { |
|
482 | + $propPatch->handle(self::CREATION_TIME_PROPERTYNAME, function($time) use ($node) { |
|
483 | 483 | if (empty($time)) { |
484 | 484 | return false; |
485 | 485 | } |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | [$path, $name] = \Sabre\Uri\split($filePath); |
500 | 500 | $info = \OC_FileChunking::decodeName($name); |
501 | 501 | if (!empty($info)) { |
502 | - $filePath = $path . '/' . $info['name']; |
|
502 | + $filePath = $path.'/'.$info['name']; |
|
503 | 503 | } |
504 | 504 | } |
505 | 505 |
@@ -224,9 +224,9 @@ discard block |
||
224 | 224 | )) { |
225 | 225 | // note: pre-fetching only supported for depth <= 1 |
226 | 226 | $folderContent = $node->getChildren(); |
227 | - $fileIds[] = (int)$node->getId(); |
|
227 | + $fileIds[] = (int) $node->getId(); |
|
228 | 228 | foreach ($folderContent as $info) { |
229 | - $fileIds[] = (int)$info->getId(); |
|
229 | + $fileIds[] = (int) $info->getId(); |
|
230 | 230 | } |
231 | 231 | $tags = $this->getTagger()->getTagsForObjects($fileIds); |
232 | 232 | if ($tags === false) { |
@@ -244,12 +244,12 @@ discard block |
||
244 | 244 | |
245 | 245 | $isFav = null; |
246 | 246 | |
247 | - $propFind->handle(self::TAGS_PROPERTYNAME, function () use (&$isFav, $node) { |
|
247 | + $propFind->handle(self::TAGS_PROPERTYNAME, function() use (&$isFav, $node) { |
|
248 | 248 | [$tags, $isFav] = $this->getTagsAndFav($node->getId()); |
249 | 249 | return new TagList($tags); |
250 | 250 | }); |
251 | 251 | |
252 | - $propFind->handle(self::FAVORITE_PROPERTYNAME, function () use ($isFav, $node) { |
|
252 | + $propFind->handle(self::FAVORITE_PROPERTYNAME, function() use ($isFav, $node) { |
|
253 | 253 | if (is_null($isFav)) { |
254 | 254 | [, $isFav] = $this->getTagsAndFav($node->getId()); |
255 | 255 | } |
@@ -275,13 +275,13 @@ discard block |
||
275 | 275 | return; |
276 | 276 | } |
277 | 277 | |
278 | - $propPatch->handle(self::TAGS_PROPERTYNAME, function ($tagList) use ($node) { |
|
278 | + $propPatch->handle(self::TAGS_PROPERTYNAME, function($tagList) use ($node) { |
|
279 | 279 | $this->updateTags($node->getId(), $tagList->getTags()); |
280 | 280 | return true; |
281 | 281 | }); |
282 | 282 | |
283 | - $propPatch->handle(self::FAVORITE_PROPERTYNAME, function ($favState) use ($node) { |
|
284 | - if ((int)$favState === 1 || $favState === 'true') { |
|
283 | + $propPatch->handle(self::FAVORITE_PROPERTYNAME, function($favState) use ($node) { |
|
284 | + if ((int) $favState === 1 || $favState === 'true') { |
|
285 | 285 | $this->getTagger()->tagAs($node->getId(), self::TAG_FAVORITE); |
286 | 286 | } else { |
287 | 287 | $this->getTagger()->unTag($node->getId(), self::TAG_FAVORITE); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | throw new Forbidden(); |
129 | 129 | } |
130 | 130 | } catch (StorageNotAvailableException $e) { |
131 | - throw new ServiceUnavailable("File is not updatable: " . $e->getMessage()); |
|
131 | + throw new ServiceUnavailable("File is not updatable: ".$e->getMessage()); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | // verify path of the target |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | if ($needsPartFile) { |
153 | 153 | // mark file as partial while uploading (ignored by the scanner) |
154 | - $partFilePath = $this->getPartFileBasePath($this->path) . '.ocTransferId' . rand() . '.part'; |
|
154 | + $partFilePath = $this->getPartFileBasePath($this->path).'.ocTransferId'.rand().'.part'; |
|
155 | 155 | |
156 | 156 | if (!$view->isCreatable($partFilePath) && $view->isUpdatable($this->path)) { |
157 | 157 | $needsPartFile = false; |
@@ -185,19 +185,19 @@ discard block |
||
185 | 185 | $data = $tmpData; |
186 | 186 | } |
187 | 187 | |
188 | - $data = HashWrapper::wrap($data, 'md5', function ($hash) { |
|
189 | - $this->header('X-Hash-MD5: ' . $hash); |
|
188 | + $data = HashWrapper::wrap($data, 'md5', function($hash) { |
|
189 | + $this->header('X-Hash-MD5: '.$hash); |
|
190 | 190 | }); |
191 | - $data = HashWrapper::wrap($data, 'sha1', function ($hash) { |
|
192 | - $this->header('X-Hash-SHA1: ' . $hash); |
|
191 | + $data = HashWrapper::wrap($data, 'sha1', function($hash) { |
|
192 | + $this->header('X-Hash-SHA1: '.$hash); |
|
193 | 193 | }); |
194 | - $data = HashWrapper::wrap($data, 'sha256', function ($hash) { |
|
195 | - $this->header('X-Hash-SHA256: ' . $hash); |
|
194 | + $data = HashWrapper::wrap($data, 'sha256', function($hash) { |
|
195 | + $this->header('X-Hash-SHA256: '.$hash); |
|
196 | 196 | }); |
197 | 197 | |
198 | 198 | if ($partStorage->instanceOfStorage(Storage\IWriteStreamStorage::class)) { |
199 | 199 | $isEOF = false; |
200 | - $wrappedData = CallbackWrapper::wrap($data, null, null, null, null, function ($stream) use (&$isEOF) { |
|
200 | + $wrappedData = CallbackWrapper::wrap($data, null, null, null, null, function($stream) use (&$isEOF) { |
|
201 | 201 | $isEOF = feof($stream); |
202 | 202 | }); |
203 | 203 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | $expected = $_SERVER['CONTENT_LENGTH']; |
234 | 234 | } |
235 | 235 | if ($expected !== "0") { |
236 | - throw new Exception('Error while copying file to target location (copied bytes: ' . $count . ', expected filesize: ' . $expected . ' )'); |
|
236 | + throw new Exception('Error while copying file to target location (copied bytes: '.$count.', expected filesize: '.$expected.' )'); |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | |
@@ -241,9 +241,9 @@ discard block |
||
241 | 241 | // double check if the file was fully received |
242 | 242 | // compare expected and actual size |
243 | 243 | if (isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['REQUEST_METHOD'] === 'PUT') { |
244 | - $expected = (int)$_SERVER['CONTENT_LENGTH']; |
|
244 | + $expected = (int) $_SERVER['CONTENT_LENGTH']; |
|
245 | 245 | if ($count !== $expected) { |
246 | - throw new BadRequest('Expected filesize of ' . $expected . ' bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) ' . $count . ' bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.'); |
|
246 | + throw new BadRequest('Expected filesize of '.$expected.' bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) '.$count.' bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.'); |
|
247 | 247 | } |
248 | 248 | } |
249 | 249 | } catch (\Exception $e) { |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $renameOkay = $storage->moveFromStorage($partStorage, $internalPartPath, $internalPath); |
293 | 293 | $fileExists = $storage->file_exists($internalPath); |
294 | 294 | if ($renameOkay === false || $fileExists === false) { |
295 | - \OC::$server->getLogger()->error('renaming part file to final file failed $renameOkay: ' . ($renameOkay ? 'true' : 'false') . ', $fileExists: ' . ($fileExists ? 'true' : 'false') . ')', ['app' => 'webdav']); |
|
295 | + \OC::$server->getLogger()->error('renaming part file to final file failed $renameOkay: '.($renameOkay ? 'true' : 'false').', $fileExists: '.($fileExists ? 'true' : 'false').')', ['app' => 'webdav']); |
|
296 | 296 | throw new Exception('Could not rename part file to final file'); |
297 | 297 | } |
298 | 298 | } catch (ForbiddenException $ex) { |
@@ -351,10 +351,10 @@ discard block |
||
351 | 351 | $this->refreshInfo(); |
352 | 352 | } |
353 | 353 | } catch (StorageNotAvailableException $e) { |
354 | - throw new ServiceUnavailable("Failed to check file size: " . $e->getMessage(), 0, $e); |
|
354 | + throw new ServiceUnavailable("Failed to check file size: ".$e->getMessage(), 0, $e); |
|
355 | 355 | } |
356 | 356 | |
357 | - return '"' . $this->info->getEtag() . '"'; |
|
357 | + return '"'.$this->info->getEtag().'"'; |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | private function getPartFileBasePath($path) { |
@@ -441,9 +441,9 @@ discard block |
||
441 | 441 | return $res; |
442 | 442 | } catch (GenericEncryptionException $e) { |
443 | 443 | // returning 503 will allow retry of the operation at a later point in time |
444 | - throw new ServiceUnavailable("Encryption not ready: " . $e->getMessage()); |
|
444 | + throw new ServiceUnavailable("Encryption not ready: ".$e->getMessage()); |
|
445 | 445 | } catch (StorageNotAvailableException $e) { |
446 | - throw new ServiceUnavailable("Failed to open file: " . $e->getMessage()); |
|
446 | + throw new ServiceUnavailable("Failed to open file: ".$e->getMessage()); |
|
447 | 447 | } catch (ForbiddenException $ex) { |
448 | 448 | throw new DAVForbiddenException($ex->getMessage(), $ex->getRetry()); |
449 | 449 | } catch (LockedException $e) { |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | throw new Forbidden(); |
469 | 469 | } |
470 | 470 | } catch (StorageNotAvailableException $e) { |
471 | - throw new ServiceUnavailable("Failed to unlink: " . $e->getMessage()); |
|
471 | + throw new ServiceUnavailable("Failed to unlink: ".$e->getMessage()); |
|
472 | 472 | } catch (ForbiddenException $ex) { |
473 | 473 | throw new DAVForbiddenException($ex->getMessage(), $ex->getRetry()); |
474 | 474 | } catch (LockedException $e) { |
@@ -531,21 +531,21 @@ discard block |
||
531 | 531 | //detect aborted upload |
532 | 532 | if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'PUT') { |
533 | 533 | if (isset($_SERVER['CONTENT_LENGTH'])) { |
534 | - $expected = (int)$_SERVER['CONTENT_LENGTH']; |
|
534 | + $expected = (int) $_SERVER['CONTENT_LENGTH']; |
|
535 | 535 | if ($bytesWritten !== $expected) { |
536 | 536 | $chunk_handler->remove($info['index']); |
537 | - throw new BadRequest('Expected filesize of ' . $expected . ' bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) ' . $bytesWritten . ' bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.'); |
|
537 | + throw new BadRequest('Expected filesize of '.$expected.' bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) '.$bytesWritten.' bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.'); |
|
538 | 538 | } |
539 | 539 | } |
540 | 540 | } |
541 | 541 | |
542 | 542 | if ($chunk_handler->isComplete()) { |
543 | 543 | /** @var Storage $storage */ |
544 | - [$storage,] = $this->fileView->resolvePath($path); |
|
544 | + [$storage, ] = $this->fileView->resolvePath($path); |
|
545 | 545 | $needsPartFile = $storage->needsPartFile(); |
546 | 546 | $partFile = null; |
547 | 547 | |
548 | - $targetPath = $path . '/' . $info['name']; |
|
548 | + $targetPath = $path.'/'.$info['name']; |
|
549 | 549 | /** @var \OC\Files\Storage\Storage $targetStorage */ |
550 | 550 | [$targetStorage, $targetInternalPath] = $this->fileView->resolvePath($targetPath); |
551 | 551 | |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | |
562 | 562 | if ($needsPartFile) { |
563 | 563 | // we first assembly the target file as a part file |
564 | - $partFile = $this->getPartFileBasePath($path . '/' . $info['name']) . '.ocTransferId' . $info['transferid'] . '.part'; |
|
564 | + $partFile = $this->getPartFileBasePath($path.'/'.$info['name']).'.ocTransferId'.$info['transferid'].'.part'; |
|
565 | 565 | /** @var \OC\Files\Storage\Storage $targetStorage */ |
566 | 566 | [$partStorage, $partInternalPath] = $this->fileView->resolvePath($partFile); |
567 | 567 | |
@@ -665,13 +665,13 @@ discard block |
||
665 | 665 | } |
666 | 666 | if ($e instanceof GenericEncryptionException) { |
667 | 667 | // returning 503 will allow retry of the operation at a later point in time |
668 | - throw new ServiceUnavailable('Encryption not ready: ' . $e->getMessage(), 0, $e); |
|
668 | + throw new ServiceUnavailable('Encryption not ready: '.$e->getMessage(), 0, $e); |
|
669 | 669 | } |
670 | 670 | if ($e instanceof StorageNotAvailableException) { |
671 | - throw new ServiceUnavailable('Failed to write file contents: ' . $e->getMessage(), 0, $e); |
|
671 | + throw new ServiceUnavailable('Failed to write file contents: '.$e->getMessage(), 0, $e); |
|
672 | 672 | } |
673 | 673 | if ($e instanceof NotFoundException) { |
674 | - throw new NotFound('File not found: ' . $e->getMessage(), 0, $e); |
|
674 | + throw new NotFound('File not found: '.$e->getMessage(), 0, $e); |
|
675 | 675 | } |
676 | 676 | |
677 | 677 | throw new \Sabre\DAV\Exception($e->getMessage(), 0, $e); |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | if (isset($this->cachedShares[$sabreNode->getId()])) { |
152 | 152 | $shares = $this->cachedShares[$sabreNode->getId()]; |
153 | 153 | } else { |
154 | - [$parentPath,] = \Sabre\Uri\split($sabreNode->getPath()); |
|
154 | + [$parentPath, ] = \Sabre\Uri\split($sabreNode->getPath()); |
|
155 | 155 | if ($parentPath === '') { |
156 | 156 | $parentPath = '/'; |
157 | 157 | } |
@@ -199,17 +199,17 @@ discard block |
||
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
202 | - $propFind->handle(self::SHARETYPES_PROPERTYNAME, function () use ($sabreNode) { |
|
202 | + $propFind->handle(self::SHARETYPES_PROPERTYNAME, function() use ($sabreNode) { |
|
203 | 203 | $shares = $this->getShares($sabreNode); |
204 | 204 | |
205 | - $shareTypes = array_unique(array_map(function (IShare $share) { |
|
205 | + $shareTypes = array_unique(array_map(function(IShare $share) { |
|
206 | 206 | return $share->getShareType(); |
207 | 207 | }, $shares)); |
208 | 208 | |
209 | 209 | return new ShareTypeList($shareTypes); |
210 | 210 | }); |
211 | 211 | |
212 | - $propFind->handle(self::SHAREES_PROPERTYNAME, function () use ($sabreNode) { |
|
212 | + $propFind->handle(self::SHAREES_PROPERTYNAME, function() use ($sabreNode) { |
|
213 | 213 | $shares = $this->getShares($sabreNode); |
214 | 214 | |
215 | 215 | return new ShareeList($shares); |
@@ -131,16 +131,16 @@ discard block |
||
131 | 131 | throw new \Sabre\DAV\Exception\Forbidden(); |
132 | 132 | } |
133 | 133 | |
134 | - [$parentPath,] = \Sabre\Uri\split($this->path); |
|
134 | + [$parentPath, ] = \Sabre\Uri\split($this->path); |
|
135 | 135 | [, $newName] = \Sabre\Uri\split($name); |
136 | 136 | |
137 | 137 | // verify path of the target |
138 | 138 | $this->verifyPath(); |
139 | 139 | |
140 | - $newPath = $parentPath . '/' . $newName; |
|
140 | + $newPath = $parentPath.'/'.$newName; |
|
141 | 141 | |
142 | 142 | if (!$this->fileView->rename($this->path, $newPath)) { |
143 | - throw new \Sabre\DAV\Exception('Failed to rename '. $this->path . ' to ' . $newPath); |
|
143 | + throw new \Sabre\DAV\Exception('Failed to rename '.$this->path.' to '.$newPath); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | $this->path = $newPath; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | public function getLastModified() { |
161 | 161 | $timestamp = $this->info->getMtime(); |
162 | 162 | if (!empty($timestamp)) { |
163 | - return (int)$timestamp; |
|
163 | + return (int) $timestamp; |
|
164 | 164 | } |
165 | 165 | return $timestamp; |
166 | 166 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | * @return string |
189 | 189 | */ |
190 | 190 | public function getETag() { |
191 | - return '"' . $this->info->getEtag() . '"'; |
|
191 | + return '"'.$this->info->getEtag().'"'; |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | if ($this->info->getId()) { |
236 | 236 | $instanceId = \OC_Util::getInstanceId(); |
237 | 237 | $id = sprintf('%08d', $this->info->getId()); |
238 | - return $id . $instanceId; |
|
238 | + return $id.$instanceId; |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | return null; |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | |
273 | 273 | if ($storage && $storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage')) { |
274 | 274 | /** @var \OCA\Files_Sharing\SharedStorage $storage */ |
275 | - $permissions = (int)$storage->getShare()->getPermissions(); |
|
275 | + $permissions = (int) $storage->getShare()->getPermissions(); |
|
276 | 276 | } else { |
277 | 277 | $permissions = $this->info->getPermissions(); |
278 | 278 | } |
@@ -414,6 +414,6 @@ discard block |
||
414 | 414 | throw new \InvalidArgumentException('X-OC-MTime header must be an integer (unix timestamp).'); |
415 | 415 | } |
416 | 416 | |
417 | - return (int)$mtimeFromRequest; |
|
417 | + return (int) $mtimeFromRequest; |
|
418 | 418 | } |
419 | 419 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | if (isset($info['transferid'])) { |
91 | 91 | // getNodePath is called for multiple nodes within a chunk |
92 | 92 | // upload call |
93 | - $path = $dir . '/' . $info['name']; |
|
93 | + $path = $dir.'/'.$info['name']; |
|
94 | 94 | $path = ltrim($path, '/'); |
95 | 95 | } |
96 | 96 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | } catch (StorageNotAvailableException $e) { |
162 | 162 | throw new \Sabre\DAV\Exception\ServiceUnavailable('Storage is temporarily not available', 0, $e); |
163 | 163 | } catch (StorageInvalidException $e) { |
164 | - throw new \Sabre\DAV\Exception\NotFound('Storage ' . $path . ' is invalid'); |
|
164 | + throw new \Sabre\DAV\Exception\NotFound('Storage '.$path.' is invalid'); |
|
165 | 165 | } catch (LockedException $e) { |
166 | 166 | throw new \Sabre\DAV\Exception\Locked(); |
167 | 167 | } catch (ForbiddenException $e) { |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | } |
171 | 171 | |
172 | 172 | if (!$info) { |
173 | - throw new \Sabre\DAV\Exception\NotFound('File with name ' . $path . ' could not be located'); |
|
173 | + throw new \Sabre\DAV\Exception\NotFound('File with name '.$path.' could not be located'); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | if ($info->getType() === 'dir') { |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | throw new FileLocked($e->getMessage(), $e->getCode(), $e); |
238 | 238 | } |
239 | 239 | |
240 | - [$destinationDir,] = \Sabre\Uri\split($destinationPath); |
|
240 | + [$destinationDir, ] = \Sabre\Uri\split($destinationPath); |
|
241 | 241 | $this->markDirty($destinationDir); |
242 | 242 | } |
243 | 243 | } |
@@ -41,15 +41,15 @@ |
||
41 | 41 | public function getCalendarHomeForPrincipal($principalUrl) { |
42 | 42 | if (strrpos($principalUrl, 'principals/users', -strlen($principalUrl)) !== false) { |
43 | 43 | [, $principalId] = \Sabre\Uri\split($principalUrl); |
44 | - return self::CALENDAR_ROOT . '/' . $principalId; |
|
44 | + return self::CALENDAR_ROOT.'/'.$principalId; |
|
45 | 45 | } |
46 | 46 | if (strrpos($principalUrl, 'principals/calendar-resources', -strlen($principalUrl)) !== false) { |
47 | 47 | [, $principalId] = \Sabre\Uri\split($principalUrl); |
48 | - return self::SYSTEM_CALENDAR_ROOT . '/calendar-resources/' . $principalId; |
|
48 | + return self::SYSTEM_CALENDAR_ROOT.'/calendar-resources/'.$principalId; |
|
49 | 49 | } |
50 | 50 | if (strrpos($principalUrl, 'principals/calendar-rooms', -strlen($principalUrl)) !== false) { |
51 | 51 | [, $principalId] = \Sabre\Uri\split($principalUrl); |
52 | - return self::SYSTEM_CALENDAR_ROOT . '/calendar-rooms/' . $principalId; |
|
52 | + return self::SYSTEM_CALENDAR_ROOT.'/calendar-rooms/'.$principalId; |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | } |