@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | if (!$this->isValidPath($path)) { |
| 56 | 56 | throw new NotPermittedException('Invalid path'); |
| 57 | 57 | } |
| 58 | - return $this->path . $this->normalizePath($path); |
|
| 58 | + return $this->path.$this->normalizePath($path); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | if ($path === $this->path) { |
| 70 | 70 | return '/'; |
| 71 | - } else if (strpos($path, $this->path . '/') !== 0) { |
|
| 71 | + } else if (strpos($path, $this->path.'/') !== 0) { |
|
| 72 | 72 | return null; |
| 73 | 73 | } else { |
| 74 | 74 | $path = substr($path, strlen($this->path)); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * @return bool |
| 84 | 84 | */ |
| 85 | 85 | public function isSubNode($node) { |
| 86 | - return strpos($node->getPath(), $this->path . '/') === 0; |
|
| 86 | + return strpos($node->getPath(), $this->path.'/') === 0; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | public function getDirectoryListing() { |
| 96 | 96 | $folderContent = $this->view->getDirectoryContent($this->path); |
| 97 | 97 | |
| 98 | - return array_map(function (FileInfo $info) { |
|
| 98 | + return array_map(function(FileInfo $info) { |
|
| 99 | 99 | if ($info->getMimetype() === 'httpd/unix-directory') { |
| 100 | 100 | return new Folder($this->root, $this->view, $info->getPath(), $info); |
| 101 | 101 | } else { |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | */ |
| 197 | 197 | public function search($query) { |
| 198 | 198 | if (is_string($query)) { |
| 199 | - return $this->searchCommon('search', array('%' . $query . '%')); |
|
| 199 | + return $this->searchCommon('search', array('%'.$query.'%')); |
|
| 200 | 200 | } else { |
| 201 | 201 | return $this->searchCommon('searchQuery', array($query)); |
| 202 | 202 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | $internalPath = $mount->getInternalPath($this->path); |
| 237 | 237 | $internalPath = rtrim($internalPath, '/'); |
| 238 | 238 | if ($internalPath !== '') { |
| 239 | - $internalPath = $internalPath . '/'; |
|
| 239 | + $internalPath = $internalPath.'/'; |
|
| 240 | 240 | } |
| 241 | 241 | $internalRootLength = strlen($internalPath); |
| 242 | 242 | |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | $result['internalPath'] = $result['path']; |
| 249 | 249 | $result['path'] = substr($result['path'], $internalRootLength); |
| 250 | 250 | $result['storage'] = $storage; |
| 251 | - $files[] = new \OC\Files\FileInfo($this->path . '/' . $result['path'], $storage, $result['internalPath'], $result, $mount); |
|
| 251 | + $files[] = new \OC\Files\FileInfo($this->path.'/'.$result['path'], $storage, $result['internalPath'], $result, $mount); |
|
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | |
@@ -262,14 +262,14 @@ discard block |
||
| 262 | 262 | $results = call_user_func_array(array($cache, $method), $args); |
| 263 | 263 | foreach ($results as $result) { |
| 264 | 264 | $result['internalPath'] = $result['path']; |
| 265 | - $result['path'] = $relativeMountPoint . $result['path']; |
|
| 265 | + $result['path'] = $relativeMountPoint.$result['path']; |
|
| 266 | 266 | $result['storage'] = $storage; |
| 267 | - $files[] = new \OC\Files\FileInfo($this->path . '/' . $result['path'], $storage, $result['internalPath'], $result, $mount); |
|
| 267 | + $files[] = new \OC\Files\FileInfo($this->path.'/'.$result['path'], $storage, $result['internalPath'], $result, $mount); |
|
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - return array_map(function (FileInfo $file) { |
|
| 272 | + return array_map(function(FileInfo $file) { |
|
| 273 | 273 | return $this->createNode($file->getPath(), $file); |
| 274 | 274 | }, $files); |
| 275 | 275 | } |
@@ -285,16 +285,16 @@ discard block |
||
| 285 | 285 | } else { |
| 286 | 286 | $user = null; |
| 287 | 287 | } |
| 288 | - $mountsContainingFile = $mountCache->getMountsForFileId((int)$id, $user); |
|
| 288 | + $mountsContainingFile = $mountCache->getMountsForFileId((int) $id, $user); |
|
| 289 | 289 | $mounts = $this->root->getMountsIn($this->path); |
| 290 | 290 | $mounts[] = $this->root->getMount($this->path); |
| 291 | 291 | /** @var IMountPoint[] $folderMounts */ |
| 292 | - $folderMounts = array_combine(array_map(function (IMountPoint $mountPoint) { |
|
| 292 | + $folderMounts = array_combine(array_map(function(IMountPoint $mountPoint) { |
|
| 293 | 293 | return $mountPoint->getMountPoint(); |
| 294 | 294 | }, $mounts), $mounts); |
| 295 | 295 | |
| 296 | 296 | /** @var ICachedMountInfo[] $mountsContainingFile */ |
| 297 | - $mountsContainingFile = array_values(array_filter($mountsContainingFile, function (ICachedMountInfo $cachedMountInfo) use ($folderMounts) { |
|
| 297 | + $mountsContainingFile = array_values(array_filter($mountsContainingFile, function(ICachedMountInfo $cachedMountInfo) use ($folderMounts) { |
|
| 298 | 298 | return isset($folderMounts[$cachedMountInfo->getMountPoint()]); |
| 299 | 299 | })); |
| 300 | 300 | |
@@ -305,25 +305,25 @@ discard block |
||
| 305 | 305 | // we only need to get the cache info once, since all mounts we found point to the same storage |
| 306 | 306 | |
| 307 | 307 | $mount = $folderMounts[$mountsContainingFile[0]->getMountPoint()]; |
| 308 | - $cacheEntry = $mount->getStorage()->getCache()->get((int)$id); |
|
| 308 | + $cacheEntry = $mount->getStorage()->getCache()->get((int) $id); |
|
| 309 | 309 | if (!$cacheEntry) { |
| 310 | 310 | return []; |
| 311 | 311 | } |
| 312 | 312 | // cache jails will hide the "true" internal path |
| 313 | - $internalPath = ltrim($mountsContainingFile[0]->getRootInternalPath() . '/' . $cacheEntry->getPath(), '/'); |
|
| 313 | + $internalPath = ltrim($mountsContainingFile[0]->getRootInternalPath().'/'.$cacheEntry->getPath(), '/'); |
|
| 314 | 314 | |
| 315 | - $nodes = array_map(function (ICachedMountInfo $cachedMountInfo) use ($cacheEntry, $folderMounts, $internalPath) { |
|
| 315 | + $nodes = array_map(function(ICachedMountInfo $cachedMountInfo) use ($cacheEntry, $folderMounts, $internalPath) { |
|
| 316 | 316 | $mount = $folderMounts[$cachedMountInfo->getMountPoint()]; |
| 317 | 317 | $pathRelativeToMount = substr($internalPath, strlen($cachedMountInfo->getRootInternalPath())); |
| 318 | 318 | $pathRelativeToMount = ltrim($pathRelativeToMount, '/'); |
| 319 | - $absolutePath = $cachedMountInfo->getMountPoint() . $pathRelativeToMount; |
|
| 319 | + $absolutePath = $cachedMountInfo->getMountPoint().$pathRelativeToMount; |
|
| 320 | 320 | return $this->root->createNode($absolutePath, new \OC\Files\FileInfo( |
| 321 | 321 | $absolutePath, $mount->getStorage(), $cacheEntry->getPath(), $cacheEntry, $mount, |
| 322 | 322 | \OC::$server->getUserManager()->get($mount->getStorage()->getOwner($pathRelativeToMount)) |
| 323 | 323 | )); |
| 324 | 324 | }, $mountsContainingFile); |
| 325 | 325 | |
| 326 | - return array_filter($nodes, function (Node $node) { |
|
| 326 | + return array_filter($nodes, function(Node $node) { |
|
| 327 | 327 | return $this->getRelativePath($node->getPath()); |
| 328 | 328 | }); |
| 329 | 329 | } |
@@ -367,10 +367,10 @@ discard block |
||
| 367 | 367 | $mounts = $this->root->getMountsIn($this->path); |
| 368 | 368 | $mounts[] = $this->getMountPoint(); |
| 369 | 369 | |
| 370 | - $mounts = array_filter($mounts, function (IMountPoint $mount) { |
|
| 370 | + $mounts = array_filter($mounts, function(IMountPoint $mount) { |
|
| 371 | 371 | return $mount->getStorage(); |
| 372 | 372 | }); |
| 373 | - $storageIds = array_map(function (IMountPoint $mount) { |
|
| 373 | + $storageIds = array_map(function(IMountPoint $mount) { |
|
| 374 | 374 | return $mount->getStorage()->getCache()->getNumericStorageId(); |
| 375 | 375 | }, $mounts); |
| 376 | 376 | /** @var IMountPoint[] $mountMap */ |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | |
| 396 | 396 | $result = $query->execute()->fetchAll(); |
| 397 | 397 | |
| 398 | - $files = array_filter(array_map(function (array $entry) use ($mountMap, $mimetypeLoader) { |
|
| 398 | + $files = array_filter(array_map(function(array $entry) use ($mountMap, $mimetypeLoader) { |
|
| 399 | 399 | $mount = $mountMap[$entry['storage']]; |
| 400 | 400 | $entry['internalPath'] = $entry['path']; |
| 401 | 401 | $entry['mimetype'] = $mimetypeLoader->getMimetypeById($entry['mimetype']); |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | return $this->root->createNode($fileInfo->getPath(), $fileInfo); |
| 409 | 409 | }, $result)); |
| 410 | 410 | |
| 411 | - return array_values(array_filter($files, function (Node $node) { |
|
| 411 | + return array_values(array_filter($files, function(Node $node) { |
|
| 412 | 412 | $relative = $this->getRelativePath($node->getPath()); |
| 413 | 413 | return $relative !== null && $relative !== '/'; |
| 414 | 414 | })); |
@@ -422,13 +422,13 @@ discard block |
||
| 422 | 422 | $rootLength = strlen($jailRoot) + 1; |
| 423 | 423 | if ($path === $jailRoot) { |
| 424 | 424 | return $mount->getMountPoint(); |
| 425 | - } else if (substr($path, 0, $rootLength) === $jailRoot . '/') { |
|
| 426 | - return $mount->getMountPoint() . substr($path, $rootLength); |
|
| 425 | + } else if (substr($path, 0, $rootLength) === $jailRoot.'/') { |
|
| 426 | + return $mount->getMountPoint().substr($path, $rootLength); |
|
| 427 | 427 | } else { |
| 428 | 428 | return null; |
| 429 | 429 | } |
| 430 | 430 | } else { |
| 431 | - return $mount->getMountPoint() . $path; |
|
| 431 | + return $mount->getMountPoint().$path; |
|
| 432 | 432 | } |
| 433 | 433 | } |
| 434 | 434 | } |
@@ -89,11 +89,11 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | public function registerMounts(IUser $user, array $mounts) { |
| 91 | 91 | // filter out non-proper storages coming from unit tests |
| 92 | - $mounts = array_filter($mounts, function (IMountPoint $mount) { |
|
| 92 | + $mounts = array_filter($mounts, function(IMountPoint $mount) { |
|
| 93 | 93 | return $mount instanceof SharedMount || $mount->getStorage() && $mount->getStorage()->getCache(); |
| 94 | 94 | }); |
| 95 | 95 | /** @var ICachedMountInfo[] $newMounts */ |
| 96 | - $newMounts = array_map(function (IMountPoint $mount) use ($user) { |
|
| 96 | + $newMounts = array_map(function(IMountPoint $mount) use ($user) { |
|
| 97 | 97 | // filter out any storages which aren't scanned yet since we aren't interested in files from those storages (yet) |
| 98 | 98 | if ($mount->getStorageRootId() === -1) { |
| 99 | 99 | return null; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | $newMounts = array_values(array_filter($newMounts)); |
| 105 | 105 | |
| 106 | 106 | $cachedMounts = $this->getMountsForUser($user); |
| 107 | - $mountDiff = function (ICachedMountInfo $mount1, ICachedMountInfo $mount2) { |
|
| 107 | + $mountDiff = function(ICachedMountInfo $mount1, ICachedMountInfo $mount2) { |
|
| 108 | 108 | // since we are only looking for mounts for a specific user comparing on root id is enough |
| 109 | 109 | return $mount1->getRootId() - $mount2->getRootId(); |
| 110 | 110 | }; |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | ], ['root_id', 'user_id']); |
| 166 | 166 | } else { |
| 167 | 167 | // in some cases this is legitimate, like orphaned shares |
| 168 | - $this->logger->debug('Could not get storage info for mount at ' . $mount->getMountPoint()); |
|
| 168 | + $this->logger->debug('Could not get storage info for mount at '.$mount->getMountPoint()); |
|
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | if (is_null($user)) { |
| 197 | 197 | return null; |
| 198 | 198 | } |
| 199 | - return new CachedMountInfo($user, (int)$row['storage_id'], (int)$row['root_id'], $row['mount_point'], $row['mount_id'], isset($row['path'])? $row['path']:''); |
|
| 199 | + return new CachedMountInfo($user, (int) $row['storage_id'], (int) $row['root_id'], $row['mount_point'], $row['mount_id'], isset($row['path']) ? $row['path'] : ''); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /** |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | $builder = $this->connection->getQueryBuilder(); |
| 228 | 228 | $query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point', 'mount_id', 'f.path') |
| 229 | 229 | ->from('mounts', 'm') |
| 230 | - ->innerJoin('m', 'filecache', 'f' , $builder->expr()->eq('m.root_id', 'f.fileid')) |
|
| 230 | + ->innerJoin('m', 'filecache', 'f', $builder->expr()->eq('m.root_id', 'f.fileid')) |
|
| 231 | 231 | ->where($builder->expr()->eq('storage_id', $builder->createPositionalParameter($numericStorageId, IQueryBuilder::PARAM_INT))); |
| 232 | 232 | |
| 233 | 233 | if ($user) { |
@@ -270,12 +270,12 @@ discard block |
||
| 270 | 270 | $row = $query->execute()->fetch(); |
| 271 | 271 | if (is_array($row)) { |
| 272 | 272 | $this->cacheInfoCache[$fileId] = [ |
| 273 | - (int)$row['storage'], |
|
| 273 | + (int) $row['storage'], |
|
| 274 | 274 | $row['path'], |
| 275 | - (int)$row['mimetype'] |
|
| 275 | + (int) $row['mimetype'] |
|
| 276 | 276 | ]; |
| 277 | 277 | } else { |
| 278 | - throw new NotFoundException('File with id "' . $fileId . '" not found'); |
|
| 278 | + throw new NotFoundException('File with id "'.$fileId.'" not found'); |
|
| 279 | 279 | } |
| 280 | 280 | } |
| 281 | 281 | return $this->cacheInfoCache[$fileId]; |
@@ -296,13 +296,13 @@ discard block |
||
| 296 | 296 | $mountsForStorage = $this->getMountsForStorageId($storageId, $user); |
| 297 | 297 | |
| 298 | 298 | // filter mounts that are from the same storage but a different directory |
| 299 | - return array_filter($mountsForStorage, function (ICachedMountInfo $mount) use ($internalPath, $fileId) { |
|
| 299 | + return array_filter($mountsForStorage, function(ICachedMountInfo $mount) use ($internalPath, $fileId) { |
|
| 300 | 300 | if ($fileId === $mount->getRootId()) { |
| 301 | 301 | return true; |
| 302 | 302 | } |
| 303 | 303 | $internalMountPath = $mount->getRootInternalPath(); |
| 304 | 304 | |
| 305 | - return $internalMountPath === '' || substr($internalPath, 0, strlen($internalMountPath) + 1) === $internalMountPath . '/'; |
|
| 305 | + return $internalMountPath === '' || substr($internalPath, 0, strlen($internalMountPath) + 1) === $internalMountPath.'/'; |
|
| 306 | 306 | }); |
| 307 | 307 | } |
| 308 | 308 | |