@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | if (!$this->isValidPath($path)) { |
| 71 | 71 | throw new NotPermittedException('Invalid path'); |
| 72 | 72 | } |
| 73 | - return $this->path . $path; |
|
| 73 | + return $this->path.$path; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * @return bool |
| 89 | 89 | */ |
| 90 | 90 | public function isSubNode($node) { |
| 91 | - return strpos($node->getPath(), $this->path . '/') === 0; |
|
| 91 | + return strpos($node->getPath(), $this->path.'/') === 0; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | public function getDirectoryListing() { |
| 101 | 101 | $folderContent = $this->view->getDirectoryContent($this->path, '', $this->getFileInfo(false)); |
| 102 | 102 | |
| 103 | - return array_map(function (FileInfo $info) { |
|
| 103 | + return array_map(function(FileInfo $info) { |
|
| 104 | 104 | if ($info->getMimetype() === FileInfo::MIMETYPE_FOLDER) { |
| 105 | 105 | return new Folder($this->root, $this->view, $info->getPath(), $info, $this); |
| 106 | 106 | } else { |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | public function search($query) { |
| 224 | 224 | if (is_string($query)) { |
| 225 | - $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', '%' . $query . '%')); |
|
| 225 | + $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', '%'.$query.'%')); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | // search is handled by a single query covering all caches that this folder contains |
@@ -266,22 +266,22 @@ discard block |
||
| 266 | 266 | $resultsPerCache = $searchHelper->searchInCaches($query, $caches); |
| 267 | 267 | |
| 268 | 268 | // loop through all results per-cache, constructing the FileInfo object from the CacheEntry and merge them all |
| 269 | - $files = array_merge(...array_map(function (array $results, $relativeMountPoint) use ($mountByMountPoint) { |
|
| 269 | + $files = array_merge(...array_map(function(array $results, $relativeMountPoint) use ($mountByMountPoint) { |
|
| 270 | 270 | $mount = $mountByMountPoint[$relativeMountPoint]; |
| 271 | - return array_map(function (ICacheEntry $result) use ($relativeMountPoint, $mount) { |
|
| 271 | + return array_map(function(ICacheEntry $result) use ($relativeMountPoint, $mount) { |
|
| 272 | 272 | return $this->cacheEntryToFileInfo($mount, $relativeMountPoint, $result); |
| 273 | 273 | }, $results); |
| 274 | 274 | }, array_values($resultsPerCache), array_keys($resultsPerCache))); |
| 275 | 275 | |
| 276 | 276 | // don't include this folder in the results |
| 277 | - $files = array_filter($files, function (FileInfo $file) { |
|
| 277 | + $files = array_filter($files, function(FileInfo $file) { |
|
| 278 | 278 | return $file->getPath() !== $this->getPath(); |
| 279 | 279 | }); |
| 280 | 280 | |
| 281 | 281 | // since results were returned per-cache, they are no longer fully sorted |
| 282 | 282 | $order = $query->getOrder(); |
| 283 | 283 | if ($order) { |
| 284 | - usort($files, function (FileInfo $a, FileInfo $b) use ($order) { |
|
| 284 | + usort($files, function(FileInfo $a, FileInfo $b) use ($order) { |
|
| 285 | 285 | foreach ($order as $orderField) { |
| 286 | 286 | $cmp = $orderField->sortFileInfo($a, $b); |
| 287 | 287 | if ($cmp !== 0) { |
@@ -292,16 +292,16 @@ discard block |
||
| 292 | 292 | }); |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - return array_map(function (FileInfo $file) { |
|
| 295 | + return array_map(function(FileInfo $file) { |
|
| 296 | 296 | return $this->createNode($file->getPath(), $file); |
| 297 | 297 | }, $files); |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | private function cacheEntryToFileInfo(IMountPoint $mount, string $appendRoot, ICacheEntry $cacheEntry): FileInfo { |
| 301 | 301 | $cacheEntry['internalPath'] = $cacheEntry['path']; |
| 302 | - $cacheEntry['path'] = rtrim($appendRoot . $cacheEntry->getPath(), '/'); |
|
| 303 | - $subPath = $cacheEntry['path'] !== '' ? '/' . $cacheEntry['path'] : ''; |
|
| 304 | - return new \OC\Files\FileInfo($this->path . $subPath, $mount->getStorage(), $cacheEntry['internalPath'], $cacheEntry, $mount); |
|
| 302 | + $cacheEntry['path'] = rtrim($appendRoot.$cacheEntry->getPath(), '/'); |
|
| 303 | + $subPath = $cacheEntry['path'] !== '' ? '/'.$cacheEntry['path'] : ''; |
|
| 304 | + return new \OC\Files\FileInfo($this->path.$subPath, $mount->getStorage(), $cacheEntry['internalPath'], $cacheEntry, $mount); |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | /** |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | */ |
| 313 | 313 | public function searchByMime($mimetype) { |
| 314 | 314 | if (strpos($mimetype, '/') === false) { |
| 315 | - $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', $mimetype . '/%')); |
|
| 315 | + $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', $mimetype.'/%')); |
|
| 316 | 316 | } else { |
| 317 | 317 | $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', $mimetype)); |
| 318 | 318 | } |
@@ -336,12 +336,12 @@ discard block |
||
| 336 | 336 | * @return \OC\Files\Node\Node[] |
| 337 | 337 | */ |
| 338 | 338 | public function getById($id) { |
| 339 | - return $this->root->getByIdInPath((int)$id, $this->getPath()); |
|
| 339 | + return $this->root->getByIdInPath((int) $id, $this->getPath()); |
|
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | protected function getAppDataDirectoryName(): string { |
| 343 | 343 | $instanceId = \OC::$server->getConfig()->getSystemValueString('instanceid'); |
| 344 | - return 'appdata_' . $instanceId; |
|
| 344 | + return 'appdata_'.$instanceId; |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | /** |
@@ -363,8 +363,8 @@ discard block |
||
| 363 | 363 | return []; |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | - $absolutePath = '/' . ltrim($cacheEntry->getPath(), '/'); |
|
| 367 | - $currentPath = rtrim($this->path, '/') . '/'; |
|
| 366 | + $absolutePath = '/'.ltrim($cacheEntry->getPath(), '/'); |
|
| 367 | + $currentPath = rtrim($this->path, '/').'/'; |
|
| 368 | 368 | |
| 369 | 369 | if (strpos($absolutePath, $currentPath) !== 0) { |
| 370 | 370 | return []; |
@@ -131,9 +131,9 @@ discard block |
||
| 131 | 131 | $path = '/'; |
| 132 | 132 | } |
| 133 | 133 | if ($path[0] !== '/') { |
| 134 | - $path = '/' . $path; |
|
| 134 | + $path = '/'.$path; |
|
| 135 | 135 | } |
| 136 | - return $this->fakeRoot . $path; |
|
| 136 | + return $this->fakeRoot.$path; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | public function chroot($fakeRoot) { |
| 146 | 146 | if (!$fakeRoot == '') { |
| 147 | 147 | if ($fakeRoot[0] !== '/') { |
| 148 | - $fakeRoot = '/' . $fakeRoot; |
|
| 148 | + $fakeRoot = '/'.$fakeRoot; |
|
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | $this->fakeRoot = $fakeRoot; |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | // missing slashes can cause wrong matches! |
| 180 | - $root = rtrim($this->fakeRoot, '/') . '/'; |
|
| 180 | + $root = rtrim($this->fakeRoot, '/').'/'; |
|
| 181 | 181 | |
| 182 | 182 | if (strpos($path, $root) !== 0) { |
| 183 | 183 | return null; |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | if ($mount instanceof MoveableMount) { |
| 284 | 284 | // cut of /user/files to get the relative path to data/user/files |
| 285 | 285 | $pathParts = explode('/', $path, 4); |
| 286 | - $relPath = '/' . $pathParts[3]; |
|
| 286 | + $relPath = '/'.$pathParts[3]; |
|
| 287 | 287 | $this->lockFile($relPath, ILockingProvider::LOCK_SHARED, true); |
| 288 | 288 | \OC_Hook::emit( |
| 289 | 289 | Filesystem::CLASSNAME, "umount", |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | } |
| 720 | 720 | $postFix = (substr($path, -1) === '/') ? '/' : ''; |
| 721 | 721 | $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path)); |
| 722 | - $mount = Filesystem::getMountManager()->find($absolutePath . $postFix); |
|
| 722 | + $mount = Filesystem::getMountManager()->find($absolutePath.$postFix); |
|
| 723 | 723 | if ($mount->getInternalPath($absolutePath) === '') { |
| 724 | 724 | return $this->removeMount($mount, $absolutePath); |
| 725 | 725 | } |
@@ -996,7 +996,7 @@ discard block |
||
| 996 | 996 | $hooks[] = 'write'; |
| 997 | 997 | break; |
| 998 | 998 | default: |
| 999 | - $this->logger->error('invalid mode (' . $mode . ') for ' . $path, ['app' => 'core']); |
|
| 999 | + $this->logger->error('invalid mode ('.$mode.') for '.$path, ['app' => 'core']); |
|
| 1000 | 1000 | } |
| 1001 | 1001 | |
| 1002 | 1002 | if ($mode !== 'r' && $mode !== 'w') { |
@@ -1110,7 +1110,7 @@ discard block |
||
| 1110 | 1110 | ); |
| 1111 | 1111 | } |
| 1112 | 1112 | /** @var Storage|null $storage */ |
| 1113 | - [$storage, $internalPath] = Filesystem::resolvePath($absolutePath . $postFix); |
|
| 1113 | + [$storage, $internalPath] = Filesystem::resolvePath($absolutePath.$postFix); |
|
| 1114 | 1114 | if ($storage) { |
| 1115 | 1115 | return $storage->hash($type, $internalPath, $raw); |
| 1116 | 1116 | } |
@@ -1164,7 +1164,7 @@ discard block |
||
| 1164 | 1164 | |
| 1165 | 1165 | $run = $this->runHooks($hooks, $path); |
| 1166 | 1166 | /** @var \OC\Files\Storage\Storage $storage */ |
| 1167 | - [$storage, $internalPath] = Filesystem::resolvePath($absolutePath . $postFix); |
|
| 1167 | + [$storage, $internalPath] = Filesystem::resolvePath($absolutePath.$postFix); |
|
| 1168 | 1168 | if ($run and $storage) { |
| 1169 | 1169 | if (in_array('write', $hooks) || in_array('delete', $hooks)) { |
| 1170 | 1170 | try { |
@@ -1209,7 +1209,7 @@ discard block |
||
| 1209 | 1209 | $unlockLater = true; |
| 1210 | 1210 | // make sure our unlocking callback will still be called if connection is aborted |
| 1211 | 1211 | ignore_user_abort(true); |
| 1212 | - $result = CallbackWrapper::wrap($result, null, null, function () use ($hooks, $path) { |
|
| 1212 | + $result = CallbackWrapper::wrap($result, null, null, function() use ($hooks, $path) { |
|
| 1213 | 1213 | if (in_array('write', $hooks)) { |
| 1214 | 1214 | $this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE); |
| 1215 | 1215 | } elseif (in_array('read', $hooks)) { |
@@ -1270,7 +1270,7 @@ discard block |
||
| 1270 | 1270 | return true; |
| 1271 | 1271 | } |
| 1272 | 1272 | |
| 1273 | - return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot . '/'); |
|
| 1273 | + return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot.'/'); |
|
| 1274 | 1274 | } |
| 1275 | 1275 | |
| 1276 | 1276 | /** |
@@ -1289,7 +1289,7 @@ discard block |
||
| 1289 | 1289 | if ($hook != 'read') { |
| 1290 | 1290 | \OC_Hook::emit( |
| 1291 | 1291 | Filesystem::CLASSNAME, |
| 1292 | - $prefix . $hook, |
|
| 1292 | + $prefix.$hook, |
|
| 1293 | 1293 | [ |
| 1294 | 1294 | Filesystem::signal_param_run => &$run, |
| 1295 | 1295 | Filesystem::signal_param_path => $path |
@@ -1298,7 +1298,7 @@ discard block |
||
| 1298 | 1298 | } elseif (!$post) { |
| 1299 | 1299 | \OC_Hook::emit( |
| 1300 | 1300 | Filesystem::CLASSNAME, |
| 1301 | - $prefix . $hook, |
|
| 1301 | + $prefix.$hook, |
|
| 1302 | 1302 | [ |
| 1303 | 1303 | Filesystem::signal_param_path => $path |
| 1304 | 1304 | ] |
@@ -1385,7 +1385,7 @@ discard block |
||
| 1385 | 1385 | return $this->getPartFileInfo($path); |
| 1386 | 1386 | } |
| 1387 | 1387 | $relativePath = $path; |
| 1388 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
| 1388 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
| 1389 | 1389 | |
| 1390 | 1390 | $mount = Filesystem::getMountManager()->find($path); |
| 1391 | 1391 | $storage = $mount->getStorage(); |
@@ -1418,7 +1418,7 @@ discard block |
||
| 1418 | 1418 | |
| 1419 | 1419 | return $info; |
| 1420 | 1420 | } else { |
| 1421 | - $this->logger->warning('Storage not valid for mountpoint: ' . $mount->getMountPoint(), ['app' => 'core']); |
|
| 1421 | + $this->logger->warning('Storage not valid for mountpoint: '.$mount->getMountPoint(), ['app' => 'core']); |
|
| 1422 | 1422 | } |
| 1423 | 1423 | |
| 1424 | 1424 | return false; |
@@ -1429,7 +1429,7 @@ discard block |
||
| 1429 | 1429 | */ |
| 1430 | 1430 | public function addSubMounts(FileInfo $info, $extOnly = false): void { |
| 1431 | 1431 | $mounts = Filesystem::getMountManager()->findIn($info->getPath()); |
| 1432 | - $info->setSubMounts(array_filter($mounts, function (IMountPoint $mount) use ($extOnly) { |
|
| 1432 | + $info->setSubMounts(array_filter($mounts, function(IMountPoint $mount) use ($extOnly) { |
|
| 1433 | 1433 | $subStorage = $mount->getStorage(); |
| 1434 | 1434 | return !($extOnly && $subStorage instanceof \OCA\Files_Sharing\SharedStorage); |
| 1435 | 1435 | })); |
@@ -1478,18 +1478,18 @@ discard block |
||
| 1478 | 1478 | |
| 1479 | 1479 | $sharingDisabled = \OCP\Util::isSharingDisabledForUser(); |
| 1480 | 1480 | |
| 1481 | - $fileNames = array_map(function (ICacheEntry $content) { |
|
| 1481 | + $fileNames = array_map(function(ICacheEntry $content) { |
|
| 1482 | 1482 | return $content->getName(); |
| 1483 | 1483 | }, $contents); |
| 1484 | 1484 | /** |
| 1485 | 1485 | * @var \OC\Files\FileInfo[] $fileInfos |
| 1486 | 1486 | */ |
| 1487 | - $fileInfos = array_map(function (ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
| 1487 | + $fileInfos = array_map(function(ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
| 1488 | 1488 | if ($sharingDisabled) { |
| 1489 | 1489 | $content['permissions'] = $content['permissions'] & ~\OCP\Constants::PERMISSION_SHARE; |
| 1490 | 1490 | } |
| 1491 | 1491 | $owner = $this->getUserObjectForOwner($storage->getOwner($content['path'])); |
| 1492 | - return new FileInfo($path . '/' . $content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
| 1492 | + return new FileInfo($path.'/'.$content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
| 1493 | 1493 | }, $contents); |
| 1494 | 1494 | $files = array_combine($fileNames, $fileInfos); |
| 1495 | 1495 | |
@@ -1513,7 +1513,7 @@ discard block |
||
| 1513 | 1513 | continue; |
| 1514 | 1514 | } catch (\Exception $e) { |
| 1515 | 1515 | // sometimes when the storage is not available it can be any exception |
| 1516 | - $this->logger->error('Exception while scanning storage "' . $subStorage->getId() . '"', [ |
|
| 1516 | + $this->logger->error('Exception while scanning storage "'.$subStorage->getId().'"', [ |
|
| 1517 | 1517 | 'exception' => $e, |
| 1518 | 1518 | 'app' => 'core', |
| 1519 | 1519 | ]); |
@@ -1542,7 +1542,7 @@ discard block |
||
| 1542 | 1542 | $rootEntry['permissions'] = $permissions & (\OCP\Constants::PERMISSION_ALL - (\OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE)); |
| 1543 | 1543 | } |
| 1544 | 1544 | |
| 1545 | - $rootEntry['path'] = substr(Filesystem::normalizePath($path . '/' . $rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
| 1545 | + $rootEntry['path'] = substr(Filesystem::normalizePath($path.'/'.$rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
| 1546 | 1546 | |
| 1547 | 1547 | // if sharing was disabled for the user we remove the share permissions |
| 1548 | 1548 | if (\OCP\Util::isSharingDisabledForUser()) { |
@@ -1550,14 +1550,14 @@ discard block |
||
| 1550 | 1550 | } |
| 1551 | 1551 | |
| 1552 | 1552 | $owner = $this->getUserObjectForOwner($subStorage->getOwner('')); |
| 1553 | - $files[$rootEntry->getName()] = new FileInfo($path . '/' . $rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
| 1553 | + $files[$rootEntry->getName()] = new FileInfo($path.'/'.$rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
| 1554 | 1554 | } |
| 1555 | 1555 | } |
| 1556 | 1556 | } |
| 1557 | 1557 | } |
| 1558 | 1558 | |
| 1559 | 1559 | if ($mimetype_filter) { |
| 1560 | - $files = array_filter($files, function (FileInfo $file) use ($mimetype_filter) { |
|
| 1560 | + $files = array_filter($files, function(FileInfo $file) use ($mimetype_filter) { |
|
| 1561 | 1561 | if (strpos($mimetype_filter, '/')) { |
| 1562 | 1562 | return $file->getMimetype() === $mimetype_filter; |
| 1563 | 1563 | } else { |
@@ -1583,7 +1583,7 @@ discard block |
||
| 1583 | 1583 | if ($data instanceof FileInfo) { |
| 1584 | 1584 | $data = $data->getData(); |
| 1585 | 1585 | } |
| 1586 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
| 1586 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
| 1587 | 1587 | /** |
| 1588 | 1588 | * @var \OC\Files\Storage\Storage $storage |
| 1589 | 1589 | * @var string $internalPath |
@@ -1610,7 +1610,7 @@ discard block |
||
| 1610 | 1610 | * @return FileInfo[] |
| 1611 | 1611 | */ |
| 1612 | 1612 | public function search($query) { |
| 1613 | - return $this->searchCommon('search', ['%' . $query . '%']); |
|
| 1613 | + return $this->searchCommon('search', ['%'.$query.'%']); |
|
| 1614 | 1614 | } |
| 1615 | 1615 | |
| 1616 | 1616 | /** |
@@ -1662,10 +1662,10 @@ discard block |
||
| 1662 | 1662 | |
| 1663 | 1663 | $results = call_user_func_array([$cache, $method], $args); |
| 1664 | 1664 | foreach ($results as $result) { |
| 1665 | - if (substr($mountPoint . $result['path'], 0, $rootLength + 1) === $this->fakeRoot . '/') { |
|
| 1665 | + if (substr($mountPoint.$result['path'], 0, $rootLength + 1) === $this->fakeRoot.'/') { |
|
| 1666 | 1666 | $internalPath = $result['path']; |
| 1667 | - $path = $mountPoint . $result['path']; |
|
| 1668 | - $result['path'] = substr($mountPoint . $result['path'], $rootLength); |
|
| 1667 | + $path = $mountPoint.$result['path']; |
|
| 1668 | + $result['path'] = substr($mountPoint.$result['path'], $rootLength); |
|
| 1669 | 1669 | $owner = $userManager->get($storage->getOwner($internalPath)); |
| 1670 | 1670 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); |
| 1671 | 1671 | } |
@@ -1683,8 +1683,8 @@ discard block |
||
| 1683 | 1683 | if ($results) { |
| 1684 | 1684 | foreach ($results as $result) { |
| 1685 | 1685 | $internalPath = $result['path']; |
| 1686 | - $result['path'] = rtrim($relativeMountPoint . $result['path'], '/'); |
|
| 1687 | - $path = rtrim($mountPoint . $internalPath, '/'); |
|
| 1686 | + $result['path'] = rtrim($relativeMountPoint.$result['path'], '/'); |
|
| 1687 | + $path = rtrim($mountPoint.$internalPath, '/'); |
|
| 1688 | 1688 | $owner = $userManager->get($storage->getOwner($internalPath)); |
| 1689 | 1689 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); |
| 1690 | 1690 | } |
@@ -1705,11 +1705,11 @@ discard block |
||
| 1705 | 1705 | public function getOwner($path) { |
| 1706 | 1706 | $info = $this->getFileInfo($path); |
| 1707 | 1707 | if (!$info) { |
| 1708 | - throw new NotFoundException($path . ' not found while trying to get owner'); |
|
| 1708 | + throw new NotFoundException($path.' not found while trying to get owner'); |
|
| 1709 | 1709 | } |
| 1710 | 1710 | |
| 1711 | 1711 | if ($info->getOwner() === null) { |
| 1712 | - throw new NotFoundException($path . ' has no owner'); |
|
| 1712 | + throw new NotFoundException($path.' has no owner'); |
|
| 1713 | 1713 | } |
| 1714 | 1714 | |
| 1715 | 1715 | return $info->getOwner()->getUID(); |
@@ -1745,7 +1745,7 @@ discard block |
||
| 1745 | 1745 | * @throws NotFoundException |
| 1746 | 1746 | */ |
| 1747 | 1747 | public function getPath($id, int $storageId = null) { |
| 1748 | - $id = (int)$id; |
|
| 1748 | + $id = (int) $id; |
|
| 1749 | 1749 | $manager = Filesystem::getMountManager(); |
| 1750 | 1750 | $mounts = $manager->findIn($this->fakeRoot); |
| 1751 | 1751 | $mounts[] = $manager->find($this->fakeRoot); |
@@ -1756,12 +1756,12 @@ discard block |
||
| 1756 | 1756 | |
| 1757 | 1757 | // put non-shared mounts in front of the shared mount |
| 1758 | 1758 | // this prevents unneeded recursion into shares |
| 1759 | - usort($mounts, function (IMountPoint $a, IMountPoint $b) { |
|
| 1759 | + usort($mounts, function(IMountPoint $a, IMountPoint $b) { |
|
| 1760 | 1760 | return $a instanceof SharedMount && (!$b instanceof SharedMount) ? 1 : -1; |
| 1761 | 1761 | }); |
| 1762 | 1762 | |
| 1763 | 1763 | if (!is_null($storageId)) { |
| 1764 | - $mounts = array_filter($mounts, function (IMountPoint $mount) use ($storageId) { |
|
| 1764 | + $mounts = array_filter($mounts, function(IMountPoint $mount) use ($storageId) { |
|
| 1765 | 1765 | return $mount->getNumericStorageId() === $storageId; |
| 1766 | 1766 | }); |
| 1767 | 1767 | } |
@@ -1774,7 +1774,7 @@ discard block |
||
| 1774 | 1774 | $cache = $mount->getStorage()->getCache(); |
| 1775 | 1775 | $internalPath = $cache->getPathById($id); |
| 1776 | 1776 | if (is_string($internalPath)) { |
| 1777 | - $fullPath = $mount->getMountPoint() . $internalPath; |
|
| 1777 | + $fullPath = $mount->getMountPoint().$internalPath; |
|
| 1778 | 1778 | if (!is_null($path = $this->getRelativePath($fullPath))) { |
| 1779 | 1779 | return $path; |
| 1780 | 1780 | } |
@@ -1809,10 +1809,10 @@ discard block |
||
| 1809 | 1809 | */ |
| 1810 | 1810 | private function targetIsNotShared(IStorage $targetStorage, string $targetInternalPath) { |
| 1811 | 1811 | // note: cannot use the view because the target is already locked |
| 1812 | - $fileId = (int)$targetStorage->getCache()->getId($targetInternalPath); |
|
| 1812 | + $fileId = (int) $targetStorage->getCache()->getId($targetInternalPath); |
|
| 1813 | 1813 | if ($fileId === -1) { |
| 1814 | 1814 | // target might not exist, need to check parent instead |
| 1815 | - $fileId = (int)$targetStorage->getCache()->getId(dirname($targetInternalPath)); |
|
| 1815 | + $fileId = (int) $targetStorage->getCache()->getId(dirname($targetInternalPath)); |
|
| 1816 | 1816 | } |
| 1817 | 1817 | |
| 1818 | 1818 | // check if any of the parents were shared by the current owner (include collections) |
@@ -1912,7 +1912,7 @@ discard block |
||
| 1912 | 1912 | $resultPath = ''; |
| 1913 | 1913 | foreach ($parts as $part) { |
| 1914 | 1914 | if ($part) { |
| 1915 | - $resultPath .= '/' . $part; |
|
| 1915 | + $resultPath .= '/'.$part; |
|
| 1916 | 1916 | $result[] = $resultPath; |
| 1917 | 1917 | } |
| 1918 | 1918 | } |
@@ -2177,16 +2177,16 @@ discard block |
||
| 2177 | 2177 | public function getUidAndFilename($filename) { |
| 2178 | 2178 | $info = $this->getFileInfo($filename); |
| 2179 | 2179 | if (!$info instanceof \OCP\Files\FileInfo) { |
| 2180 | - throw new NotFoundException($this->getAbsolutePath($filename) . ' not found'); |
|
| 2180 | + throw new NotFoundException($this->getAbsolutePath($filename).' not found'); |
|
| 2181 | 2181 | } |
| 2182 | 2182 | $uid = $info->getOwner()->getUID(); |
| 2183 | 2183 | if ($uid != \OC_User::getUser()) { |
| 2184 | 2184 | Filesystem::initMountPoints($uid); |
| 2185 | - $ownerView = new View('/' . $uid . '/files'); |
|
| 2185 | + $ownerView = new View('/'.$uid.'/files'); |
|
| 2186 | 2186 | try { |
| 2187 | 2187 | $filename = $ownerView->getPath($info['fileid']); |
| 2188 | 2188 | } catch (NotFoundException $e) { |
| 2189 | - throw new NotFoundException('File with id ' . $info['fileid'] . ' not found for user ' . $uid); |
|
| 2189 | + throw new NotFoundException('File with id '.$info['fileid'].' not found for user '.$uid); |
|
| 2190 | 2190 | } |
| 2191 | 2191 | } |
| 2192 | 2192 | return [$uid, $filename]; |
@@ -2203,7 +2203,7 @@ discard block |
||
| 2203 | 2203 | $directoryParts = array_filter($directoryParts); |
| 2204 | 2204 | foreach ($directoryParts as $key => $part) { |
| 2205 | 2205 | $currentPathElements = array_slice($directoryParts, 0, $key); |
| 2206 | - $currentPath = '/' . implode('/', $currentPathElements); |
|
| 2206 | + $currentPath = '/'.implode('/', $currentPathElements); |
|
| 2207 | 2207 | if ($this->is_file($currentPath)) { |
| 2208 | 2208 | return false; |
| 2209 | 2209 | } |