@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | if (!$this->isValidPath($path)) { |
| 72 | 72 | throw new NotPermittedException('Invalid path'); |
| 73 | 73 | } |
| 74 | - return $this->path . $this->normalizePath($path); |
|
| 74 | + return $this->path.$this->normalizePath($path); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | if ($path === $this->path) { |
| 86 | 86 | return '/'; |
| 87 | - } elseif (strpos($path, $this->path . '/') !== 0) { |
|
| 87 | + } elseif (strpos($path, $this->path.'/') !== 0) { |
|
| 88 | 88 | return null; |
| 89 | 89 | } else { |
| 90 | 90 | $path = substr($path, strlen($this->path)); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @return bool |
| 100 | 100 | */ |
| 101 | 101 | public function isSubNode($node) { |
| 102 | - return strpos($node->getPath(), $this->path . '/') === 0; |
|
| 102 | + return strpos($node->getPath(), $this->path.'/') === 0; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | public function getDirectoryListing() { |
| 112 | 112 | $folderContent = $this->view->getDirectoryContent($this->path); |
| 113 | 113 | |
| 114 | - return array_map(function (FileInfo $info) { |
|
| 114 | + return array_map(function(FileInfo $info) { |
|
| 115 | 115 | if ($info->getMimetype() === 'httpd/unix-directory') { |
| 116 | 116 | return new Folder($this->root, $this->view, $info->getPath(), $info); |
| 117 | 117 | } else { |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | public function search($query) { |
| 230 | 230 | if (is_string($query)) { |
| 231 | - $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', '%' . $query . '%')); |
|
| 231 | + $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', '%'.$query.'%')); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | // Limit+offset for queries with ordering |
@@ -255,13 +255,13 @@ discard block |
||
| 255 | 255 | $internalPath = $mount->getInternalPath($this->path); |
| 256 | 256 | $internalPath = rtrim($internalPath, '/'); |
| 257 | 257 | if ($internalPath !== '') { |
| 258 | - $internalPath = $internalPath . '/'; |
|
| 258 | + $internalPath = $internalPath.'/'; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | $subQueryLimit = $query->getLimit() > 0 ? $query->getLimit() + $query->getOffset() : 0; |
| 262 | 262 | $rootQuery = new SearchQuery( |
| 263 | 263 | new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ |
| 264 | - new SearchComparison(ISearchComparison::COMPARE_LIKE, 'path', $internalPath . '%'), |
|
| 264 | + new SearchComparison(ISearchComparison::COMPARE_LIKE, 'path', $internalPath.'%'), |
|
| 265 | 265 | $query->getSearchOperation(), |
| 266 | 266 | ] |
| 267 | 267 | ), |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | |
| 307 | 307 | $order = $query->getOrder(); |
| 308 | 308 | if ($order) { |
| 309 | - usort($files, function (FileInfo $a,FileInfo $b) use ($order) { |
|
| 309 | + usort($files, function(FileInfo $a, FileInfo $b) use ($order) { |
|
| 310 | 310 | foreach ($order as $orderField) { |
| 311 | 311 | $cmp = $orderField->sortFileInfo($a, $b); |
| 312 | 312 | if ($cmp !== 0) { |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | } |
| 319 | 319 | $files = array_values(array_slice($files, $query->getOffset(), $query->getLimit() > 0 ? $query->getLimit() : null)); |
| 320 | 320 | |
| 321 | - return array_map(function (FileInfo $file) { |
|
| 321 | + return array_map(function(FileInfo $file) { |
|
| 322 | 322 | return $this->createNode($file->getPath(), $file); |
| 323 | 323 | }, $files); |
| 324 | 324 | } |
@@ -326,8 +326,8 @@ discard block |
||
| 326 | 326 | private function cacheEntryToFileInfo(IMountPoint $mount, string $appendRoot, string $trimRoot, ICacheEntry $cacheEntry): FileInfo { |
| 327 | 327 | $trimLength = strlen($trimRoot); |
| 328 | 328 | $cacheEntry['internalPath'] = $cacheEntry['path']; |
| 329 | - $cacheEntry['path'] = $appendRoot . substr($cacheEntry['path'], $trimLength); |
|
| 330 | - return new \OC\Files\FileInfo($this->path . '/' . $cacheEntry['path'], $mount->getStorage(), $cacheEntry['internalPath'], $cacheEntry, $mount); |
|
| 329 | + $cacheEntry['path'] = $appendRoot.substr($cacheEntry['path'], $trimLength); |
|
| 330 | + return new \OC\Files\FileInfo($this->path.'/'.$cacheEntry['path'], $mount->getStorage(), $cacheEntry['internalPath'], $cacheEntry, $mount); |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | /** |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | */ |
| 339 | 339 | public function searchByMime($mimetype) { |
| 340 | 340 | if (strpos($mimetype, '/') === false) { |
| 341 | - $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', $mimetype . '/%')); |
|
| 341 | + $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', $mimetype.'/%')); |
|
| 342 | 342 | } else { |
| 343 | 343 | $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', $mimetype)); |
| 344 | 344 | } |
@@ -368,38 +368,38 @@ discard block |
||
| 368 | 368 | } else { |
| 369 | 369 | $user = null; |
| 370 | 370 | } |
| 371 | - $mountsContainingFile = $mountCache->getMountsForFileId((int)$id, $user); |
|
| 371 | + $mountsContainingFile = $mountCache->getMountsForFileId((int) $id, $user); |
|
| 372 | 372 | $mounts = $this->root->getMountsIn($this->path); |
| 373 | 373 | $mounts[] = $this->root->getMount($this->path); |
| 374 | 374 | /** @var IMountPoint[] $folderMounts */ |
| 375 | - $folderMounts = array_combine(array_map(function (IMountPoint $mountPoint) { |
|
| 375 | + $folderMounts = array_combine(array_map(function(IMountPoint $mountPoint) { |
|
| 376 | 376 | return $mountPoint->getMountPoint(); |
| 377 | 377 | }, $mounts), $mounts); |
| 378 | 378 | |
| 379 | 379 | /** @var ICachedMountInfo[] $mountsContainingFile */ |
| 380 | - $mountsContainingFile = array_values(array_filter($mountsContainingFile, function (ICachedMountInfo $cachedMountInfo) use ($folderMounts) { |
|
| 380 | + $mountsContainingFile = array_values(array_filter($mountsContainingFile, function(ICachedMountInfo $cachedMountInfo) use ($folderMounts) { |
|
| 381 | 381 | return isset($folderMounts[$cachedMountInfo->getMountPoint()]); |
| 382 | 382 | })); |
| 383 | 383 | |
| 384 | 384 | if (count($mountsContainingFile) === 0) { |
| 385 | 385 | if ($user === $this->getAppDataDirectoryName()) { |
| 386 | - return $this->getByIdInRootMount((int)$id); |
|
| 386 | + return $this->getByIdInRootMount((int) $id); |
|
| 387 | 387 | } |
| 388 | 388 | return []; |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | - $nodes = array_map(function (ICachedMountInfo $cachedMountInfo) use ($folderMounts, $id) { |
|
| 391 | + $nodes = array_map(function(ICachedMountInfo $cachedMountInfo) use ($folderMounts, $id) { |
|
| 392 | 392 | $mount = $folderMounts[$cachedMountInfo->getMountPoint()]; |
| 393 | - $cacheEntry = $mount->getStorage()->getCache()->get((int)$id); |
|
| 393 | + $cacheEntry = $mount->getStorage()->getCache()->get((int) $id); |
|
| 394 | 394 | if (!$cacheEntry) { |
| 395 | 395 | return null; |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | // cache jails will hide the "true" internal path |
| 399 | - $internalPath = ltrim($cachedMountInfo->getRootInternalPath() . '/' . $cacheEntry->getPath(), '/'); |
|
| 399 | + $internalPath = ltrim($cachedMountInfo->getRootInternalPath().'/'.$cacheEntry->getPath(), '/'); |
|
| 400 | 400 | $pathRelativeToMount = substr($internalPath, strlen($cachedMountInfo->getRootInternalPath())); |
| 401 | 401 | $pathRelativeToMount = ltrim($pathRelativeToMount, '/'); |
| 402 | - $absolutePath = rtrim($cachedMountInfo->getMountPoint() . $pathRelativeToMount, '/'); |
|
| 402 | + $absolutePath = rtrim($cachedMountInfo->getMountPoint().$pathRelativeToMount, '/'); |
|
| 403 | 403 | return $this->root->createNode($absolutePath, new \OC\Files\FileInfo( |
| 404 | 404 | $absolutePath, $mount->getStorage(), $cacheEntry->getPath(), $cacheEntry, $mount, |
| 405 | 405 | \OC::$server->getUserManager()->get($mount->getStorage()->getOwner($pathRelativeToMount)) |
@@ -408,14 +408,14 @@ discard block |
||
| 408 | 408 | |
| 409 | 409 | $nodes = array_filter($nodes); |
| 410 | 410 | |
| 411 | - return array_filter($nodes, function (Node $node) { |
|
| 411 | + return array_filter($nodes, function(Node $node) { |
|
| 412 | 412 | return $this->getRelativePath($node->getPath()); |
| 413 | 413 | }); |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | protected function getAppDataDirectoryName(): string { |
| 417 | 417 | $instanceId = \OC::$server->getConfig()->getSystemValueString('instanceid'); |
| 418 | - return 'appdata_' . $instanceId; |
|
| 418 | + return 'appdata_'.$instanceId; |
|
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | /** |
@@ -437,8 +437,8 @@ discard block |
||
| 437 | 437 | return []; |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | - $absolutePath = '/' . ltrim($cacheEntry->getPath(), '/'); |
|
| 441 | - $currentPath = rtrim($this->path, '/') . '/'; |
|
| 440 | + $absolutePath = '/'.ltrim($cacheEntry->getPath(), '/'); |
|
| 441 | + $currentPath = rtrim($this->path, '/').'/'; |
|
| 442 | 442 | |
| 443 | 443 | if (strpos($absolutePath, $currentPath) !== 0) { |
| 444 | 444 | return []; |
@@ -493,10 +493,10 @@ discard block |
||
| 493 | 493 | $mounts = $this->root->getMountsIn($this->path); |
| 494 | 494 | $mounts[] = $this->getMountPoint(); |
| 495 | 495 | |
| 496 | - $mounts = array_filter($mounts, function (IMountPoint $mount) { |
|
| 496 | + $mounts = array_filter($mounts, function(IMountPoint $mount) { |
|
| 497 | 497 | return $mount->getStorage() !== null; |
| 498 | 498 | }); |
| 499 | - $storageIds = array_map(function (IMountPoint $mount) { |
|
| 499 | + $storageIds = array_map(function(IMountPoint $mount) { |
|
| 500 | 500 | return $mount->getStorage()->getCache()->getNumericStorageId(); |
| 501 | 501 | }, $mounts); |
| 502 | 502 | /** @var IMountPoint[] $mountMap */ |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | * Construct an array of the storage id with their prefix path |
| 508 | 508 | * This helps us to filter in the final query |
| 509 | 509 | */ |
| 510 | - $filters = array_map(function (IMountPoint $mount) { |
|
| 510 | + $filters = array_map(function(IMountPoint $mount) { |
|
| 511 | 511 | $storage = $mount->getStorage(); |
| 512 | 512 | |
| 513 | 513 | $storageId = $storage->getCache()->getNumericStorageId(); |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | |
| 572 | 572 | if ($filter['pathPrefix'] !== '') { |
| 573 | 573 | $storageFilter->add( |
| 574 | - $builder->expr()->like('f.path', $builder->createNamedParameter($dbconn->escapeLikeParameter($filter['pathPrefix']) . '/%')) |
|
| 574 | + $builder->expr()->like('f.path', $builder->createNamedParameter($dbconn->escapeLikeParameter($filter['pathPrefix']).'/%')) |
|
| 575 | 575 | ); |
| 576 | 576 | } |
| 577 | 577 | |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | } |
| 600 | 600 | |
| 601 | 601 | private function recentParse($result, $mountMap, $mimetypeLoader) { |
| 602 | - $files = array_filter(array_map(function (array $entry) use ($mountMap, $mimetypeLoader) { |
|
| 602 | + $files = array_filter(array_map(function(array $entry) use ($mountMap, $mimetypeLoader) { |
|
| 603 | 603 | $mount = $mountMap[$entry['storage']]; |
| 604 | 604 | $entry['internalPath'] = $entry['path']; |
| 605 | 605 | $entry['mimetype'] = $mimetypeLoader->getMimetypeById($entry['mimetype']); |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | return $this->root->createNode($fileInfo->getPath(), $fileInfo); |
| 613 | 613 | }, $result)); |
| 614 | 614 | |
| 615 | - return array_values(array_filter($files, function (Node $node) { |
|
| 615 | + return array_values(array_filter($files, function(Node $node) { |
|
| 616 | 616 | $cacheEntry = $node->getMountPoint()->getStorage()->getCache()->get($node->getId()); |
| 617 | 617 | if (!$cacheEntry) { |
| 618 | 618 | return false; |
@@ -634,13 +634,13 @@ discard block |
||
| 634 | 634 | $rootLength = strlen($jailRoot) + 1; |
| 635 | 635 | if ($path === $jailRoot) { |
| 636 | 636 | return $mount->getMountPoint(); |
| 637 | - } elseif (substr($path, 0, $rootLength) === $jailRoot . '/') { |
|
| 638 | - return $mount->getMountPoint() . substr($path, $rootLength); |
|
| 637 | + } elseif (substr($path, 0, $rootLength) === $jailRoot.'/') { |
|
| 638 | + return $mount->getMountPoint().substr($path, $rootLength); |
|
| 639 | 639 | } else { |
| 640 | 640 | return null; |
| 641 | 641 | } |
| 642 | 642 | } else { |
| 643 | - return $mount->getMountPoint() . $path; |
|
| 643 | + return $mount->getMountPoint().$path; |
|
| 644 | 644 | } |
| 645 | 645 | } |
| 646 | 646 | } |