@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $this->groupedShares = $arguments['groupedShares']; |
| 78 | 78 | |
| 79 | 79 | $newMountPoint = $this->verifyMountPoint($this->superShare, $mountpoints, $folderExistCache); |
| 80 | - $absMountPoint = '/' . $this->user . '/files' . $newMountPoint; |
|
| 80 | + $absMountPoint = '/'.$this->user.'/files'.$newMountPoint; |
|
| 81 | 81 | parent::__construct($storage, $absMountPoint, $arguments, $loader, null, null, MountProvider::class); |
| 82 | 82 | } |
| 83 | 83 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | $newMountPoint = $this->generateUniqueTarget( |
| 112 | - \OC\Files\Filesystem::normalizePath($parent . '/' . $mountPoint), |
|
| 112 | + \OC\Files\Filesystem::normalizePath($parent.'/'.$mountPoint), |
|
| 113 | 113 | $this->recipientView, |
| 114 | 114 | $mountpoints |
| 115 | 115 | ); |
@@ -146,15 +146,15 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | private function generateUniqueTarget($path, $view, array $mountpoints) { |
| 148 | 148 | $pathinfo = pathinfo($path); |
| 149 | - $ext = isset($pathinfo['extension']) ? '.' . $pathinfo['extension'] : ''; |
|
| 149 | + $ext = isset($pathinfo['extension']) ? '.'.$pathinfo['extension'] : ''; |
|
| 150 | 150 | $name = $pathinfo['filename']; |
| 151 | 151 | $dir = $pathinfo['dirname']; |
| 152 | 152 | |
| 153 | 153 | $i = 2; |
| 154 | - $absolutePath = $this->recipientView->getAbsolutePath($path) . '/'; |
|
| 154 | + $absolutePath = $this->recipientView->getAbsolutePath($path).'/'; |
|
| 155 | 155 | while ($view->file_exists($path) || isset($mountpoints[$absolutePath])) { |
| 156 | - $path = Filesystem::normalizePath($dir . '/' . $name . ' (' . $i . ')' . $ext); |
|
| 157 | - $absolutePath = $this->recipientView->getAbsolutePath($path) . '/'; |
|
| 156 | + $path = Filesystem::normalizePath($dir.'/'.$name.' ('.$i.')'.$ext); |
|
| 157 | + $absolutePath = $this->recipientView->getAbsolutePath($path).'/'; |
|
| 158 | 158 | $i++; |
| 159 | 159 | } |
| 160 | 160 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | // it is not a file relative to data/user/files |
| 176 | 176 | if (count($split) < 3 || $split[1] !== 'files') { |
| 177 | - \OC::$server->getLogger()->error('Can not strip userid and "files/" from path: ' . $path, ['app' => 'files_sharing']); |
|
| 177 | + \OC::$server->getLogger()->error('Can not strip userid and "files/" from path: '.$path, ['app' => 'files_sharing']); |
|
| 178 | 178 | throw new \OCA\Files_Sharing\Exceptions\BrokenPath('Path does not start with /user/files', 10); |
| 179 | 179 | } |
| 180 | 180 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | $sliced = array_slice($split, 2); |
| 183 | 183 | $relPath = implode('/', $sliced); |
| 184 | 184 | |
| 185 | - return '/' . $relPath; |
|
| 185 | + return '/'.$relPath; |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /** |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | $this->setMountPoint($target); |
| 203 | 203 | $this->storage->setMountPoint($relTargetPath); |
| 204 | 204 | } catch (\Exception $e) { |
| 205 | - \OC::$server->getLogger()->logException($e, ['app' => 'files_sharing', 'message' => 'Could not rename mount point for shared folder "' . $this->getMountPoint() . '" to "' . $target . '"']); |
|
| 205 | + \OC::$server->getLogger()->logException($e, ['app' => 'files_sharing', 'message' => 'Could not rename mount point for shared folder "'.$this->getMountPoint().'" to "'.$target.'"']); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | return $result; |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | $row = $result->fetch(); |
| 257 | 257 | $result->closeCursor(); |
| 258 | 258 | if ($row) { |
| 259 | - return (int)$row['storage']; |
|
| 259 | + return (int) $row['storage']; |
|
| 260 | 260 | } |
| 261 | 261 | return -1; |
| 262 | 262 | } |
@@ -91,11 +91,11 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | public function registerMounts(IUser $user, array $mounts) { |
| 93 | 93 | // filter out non-proper storages coming from unit tests |
| 94 | - $mounts = array_filter($mounts, function (IMountPoint $mount) { |
|
| 94 | + $mounts = array_filter($mounts, function(IMountPoint $mount) { |
|
| 95 | 95 | return $mount instanceof SharedMount || $mount->getStorage() && $mount->getStorage()->getCache(); |
| 96 | 96 | }); |
| 97 | 97 | /** @var ICachedMountInfo[] $newMounts */ |
| 98 | - $newMounts = array_map(function (IMountPoint $mount) use ($user) { |
|
| 98 | + $newMounts = array_map(function(IMountPoint $mount) use ($user) { |
|
| 99 | 99 | // filter out any storages which aren't scanned yet since we aren't interested in files from those storages (yet) |
| 100 | 100 | if ($mount->getStorageRootId() === -1) { |
| 101 | 101 | return null; |
@@ -104,13 +104,13 @@ discard block |
||
| 104 | 104 | } |
| 105 | 105 | }, $mounts); |
| 106 | 106 | $newMounts = array_values(array_filter($newMounts)); |
| 107 | - $newMountRootIds = array_map(function (ICachedMountInfo $mount) { |
|
| 107 | + $newMountRootIds = array_map(function(ICachedMountInfo $mount) { |
|
| 108 | 108 | return $mount->getRootId(); |
| 109 | 109 | }, $newMounts); |
| 110 | 110 | $newMounts = array_combine($newMountRootIds, $newMounts); |
| 111 | 111 | |
| 112 | 112 | $cachedMounts = $this->getMountsForUser($user); |
| 113 | - $cachedMountRootIds = array_map(function (ICachedMountInfo $mount) { |
|
| 113 | + $cachedMountRootIds = array_map(function(ICachedMountInfo $mount) { |
|
| 114 | 114 | return $mount->getRootId(); |
| 115 | 115 | }, $cachedMounts); |
| 116 | 116 | $cachedMounts = array_combine($cachedMountRootIds, $cachedMounts); |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | ], ['root_id', 'user_id']); |
| 187 | 187 | } else { |
| 188 | 188 | // in some cases this is legitimate, like orphaned shares |
| 189 | - $this->logger->debug('Could not get storage info for mount at ' . $mount->getMountPoint()); |
|
| 189 | + $this->logger->debug('Could not get storage info for mount at '.$mount->getMountPoint()); |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | |
@@ -220,12 +220,12 @@ discard block |
||
| 220 | 220 | } |
| 221 | 221 | $mount_id = $row['mount_id']; |
| 222 | 222 | if (!is_null($mount_id)) { |
| 223 | - $mount_id = (int)$mount_id; |
|
| 223 | + $mount_id = (int) $mount_id; |
|
| 224 | 224 | } |
| 225 | 225 | return new CachedMountInfo( |
| 226 | 226 | $user, |
| 227 | - (int)$row['storage_id'], |
|
| 228 | - (int)$row['root_id'], |
|
| 227 | + (int) $row['storage_id'], |
|
| 228 | + (int) $row['root_id'], |
|
| 229 | 229 | $row['mount_point'], |
| 230 | 230 | $row['mount_provider_class'] ?? '', |
| 231 | 231 | $mount_id, |
@@ -313,12 +313,12 @@ discard block |
||
| 313 | 313 | |
| 314 | 314 | if (is_array($row)) { |
| 315 | 315 | $this->cacheInfoCache[$fileId] = [ |
| 316 | - (int)$row['storage'], |
|
| 317 | - (string)$row['path'], |
|
| 318 | - (int)$row['mimetype'] |
|
| 316 | + (int) $row['storage'], |
|
| 317 | + (string) $row['path'], |
|
| 318 | + (int) $row['mimetype'] |
|
| 319 | 319 | ]; |
| 320 | 320 | } else { |
| 321 | - throw new NotFoundException('File with id "' . $fileId . '" not found'); |
|
| 321 | + throw new NotFoundException('File with id "'.$fileId.'" not found'); |
|
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | return $this->cacheInfoCache[$fileId]; |
@@ -350,17 +350,17 @@ discard block |
||
| 350 | 350 | $rows = $result->fetchAll(); |
| 351 | 351 | $result->closeCursor(); |
| 352 | 352 | // filter mounts that are from the same storage but a different directory |
| 353 | - $filteredMounts = array_filter($rows, function (array $row) use ($internalPath, $fileId) { |
|
| 354 | - if ($fileId === (int)$row['root_id']) { |
|
| 353 | + $filteredMounts = array_filter($rows, function(array $row) use ($internalPath, $fileId) { |
|
| 354 | + if ($fileId === (int) $row['root_id']) { |
|
| 355 | 355 | return true; |
| 356 | 356 | } |
| 357 | 357 | $internalMountPath = $row['path'] ?? ''; |
| 358 | 358 | |
| 359 | - return $internalMountPath === '' || substr($internalPath, 0, strlen($internalMountPath) + 1) === $internalMountPath . '/'; |
|
| 359 | + return $internalMountPath === '' || substr($internalPath, 0, strlen($internalMountPath) + 1) === $internalMountPath.'/'; |
|
| 360 | 360 | }); |
| 361 | 361 | |
| 362 | 362 | $filteredMounts = array_filter(array_map([$this, 'dbRowToMountInfo'], $filteredMounts)); |
| 363 | - return array_map(function (ICachedMountInfo $mount) use ($internalPath) { |
|
| 363 | + return array_map(function(ICachedMountInfo $mount) use ($internalPath) { |
|
| 364 | 364 | return new CachedMountFileInfo( |
| 365 | 365 | $mount->getUser(), |
| 366 | 366 | $mount->getStorageId(), |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | $slash |
| 419 | 419 | ); |
| 420 | 420 | |
| 421 | - $userIds = array_map(function (IUser $user) { |
|
| 421 | + $userIds = array_map(function(IUser $user) { |
|
| 422 | 422 | return $user->getUID(); |
| 423 | 423 | }, $users); |
| 424 | 424 | |
@@ -53,6 +53,6 @@ |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | public function getPath(): string { |
| 56 | - return $this->getMountPoint() . $this->getInternalPath(); |
|
| 56 | + return $this->getMountPoint().$this->getInternalPath(); |
|
| 57 | 57 | } |
| 58 | 58 | } |
@@ -54,15 +54,15 @@ |
||
| 54 | 54 | public function getMountsForUser(IUser $user, IStorageFactory $loader) { |
| 55 | 55 | $cacheBaseDir = $this->config->getSystemValue('cache_path', ''); |
| 56 | 56 | if ($cacheBaseDir !== '') { |
| 57 | - $cacheDir = rtrim($cacheBaseDir, '/') . '/' . $user->getUID(); |
|
| 57 | + $cacheDir = rtrim($cacheBaseDir, '/').'/'.$user->getUID(); |
|
| 58 | 58 | if (!file_exists($cacheDir)) { |
| 59 | 59 | mkdir($cacheDir, 0770, true); |
| 60 | - mkdir($cacheDir . '/uploads', 0770, true); |
|
| 60 | + mkdir($cacheDir.'/uploads', 0770, true); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | return [ |
| 64 | - new MountPoint('\OC\Files\Storage\Local', '/' . $user->getUID() . '/cache', ['datadir' => $cacheDir], $loader, null, null, self::class), |
|
| 65 | - new MountPoint('\OC\Files\Storage\Local', '/' . $user->getUID() . '/uploads', ['datadir' => $cacheDir . '/uploads'], $loader, null, null, self::class) |
|
| 64 | + new MountPoint('\OC\Files\Storage\Local', '/'.$user->getUID().'/cache', ['datadir' => $cacheDir], $loader, null, null, self::class), |
|
| 65 | + new MountPoint('\OC\Files\Storage\Local', '/'.$user->getUID().'/uploads', ['datadir' => $cacheDir.'/uploads'], $loader, null, null, self::class) |
|
| 66 | 66 | ]; |
| 67 | 67 | } else { |
| 68 | 68 | return []; |
@@ -38,6 +38,6 @@ |
||
| 38 | 38 | */ |
| 39 | 39 | public function getHomeMountForUser(IUser $user, IStorageFactory $loader) { |
| 40 | 40 | $arguments = ['user' => $user]; |
| 41 | - return new MountPoint('\OC\Files\Storage\Home', '/' . $user->getUID(), $arguments, $loader, null, null, self::class); |
|
| 41 | + return new MountPoint('\OC\Files\Storage\Home', '/'.$user->getUID(), $arguments, $loader, null, null, self::class); |
|
| 42 | 42 | } |
| 43 | 43 | } |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | return null; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - return new MountPoint('\OC\Files\ObjectStore\HomeObjectStoreStorage', '/' . $user->getUID(), $config['arguments'], $loader, null, null, self::class); |
|
| 68 | + return new MountPoint('\OC\Files\ObjectStore\HomeObjectStoreStorage', '/'.$user->getUID(), $config['arguments'], $loader, null, null, self::class); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | foreach ($directoryRange as $child) { |
| 68 | 68 | $mountPoints[] = new MountPoint( |
| 69 | 69 | AppdataPreviewObjectStoreStorage::class, |
| 70 | - '/appdata_' . $instanceId . '/preview/' . $parent . '/' . $child, |
|
| 70 | + '/appdata_'.$instanceId.'/preview/'.$parent.'/'.$child, |
|
| 71 | 71 | $this->getMultiBucketObjectStore($i), |
| 72 | 72 | $loader, |
| 73 | 73 | null, |
@@ -82,13 +82,13 @@ discard block |
||
| 82 | 82 | $fakeRootStorage = new ObjectStoreStorage($rootStorageArguments); |
| 83 | 83 | $fakeRootStorageJail = new Jail([ |
| 84 | 84 | 'storage' => $fakeRootStorage, |
| 85 | - 'root' => '/appdata_' . $instanceId . '/preview', |
|
| 85 | + 'root' => '/appdata_'.$instanceId.'/preview', |
|
| 86 | 86 | ]); |
| 87 | 87 | |
| 88 | 88 | // add a fallback location to be able to fetch existing previews from the old bucket |
| 89 | 89 | $mountPoints[] = new MountPoint( |
| 90 | 90 | $fakeRootStorageJail, |
| 91 | - '/appdata_' . $instanceId . '/preview/old-multibucket', |
|
| 91 | + '/appdata_'.$instanceId.'/preview/old-multibucket', |
|
| 92 | 92 | null, |
| 93 | 93 | $loader, |
| 94 | 94 | null, |