@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | // exit if we can't create a new file and we don't updatable existing file |
| 128 | 128 | $chunkInfo = \OC_FileChunking::decodeName($name); |
| 129 | 129 | if (!$this->fileView->isCreatable($this->path) && |
| 130 | - !$this->fileView->isUpdatable($this->path . '/' . $chunkInfo['name']) |
|
| 130 | + !$this->fileView->isUpdatable($this->path.'/'.$chunkInfo['name']) |
|
| 131 | 131 | ) { |
| 132 | 132 | throw new \Sabre\DAV\Exception\Forbidden(); |
| 133 | 133 | } |
@@ -140,9 +140,9 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | $this->fileView->verifyPath($this->path, $name); |
| 142 | 142 | |
| 143 | - $path = $this->fileView->getAbsolutePath($this->path) . '/' . $name; |
|
| 143 | + $path = $this->fileView->getAbsolutePath($this->path).'/'.$name; |
|
| 144 | 144 | // in case the file already exists/overwriting |
| 145 | - $info = $this->fileView->getFileInfo($this->path . '/' . $name); |
|
| 145 | + $info = $this->fileView->getFileInfo($this->path.'/'.$name); |
|
| 146 | 146 | if (!$info) { |
| 147 | 147 | // use a dummy FileInfo which is acceptable here since it will be refreshed after the put is complete |
| 148 | 148 | $info = new \OC\Files\FileInfo($path, null, null, [ |
@@ -153,11 +153,11 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | // only allow 1 process to upload a file at once but still allow reading the file while writing the part file |
| 155 | 155 | $node->acquireLock(ILockingProvider::LOCK_SHARED); |
| 156 | - $this->fileView->lockFile($path . '.upload.part', ILockingProvider::LOCK_EXCLUSIVE); |
|
| 156 | + $this->fileView->lockFile($path.'.upload.part', ILockingProvider::LOCK_EXCLUSIVE); |
|
| 157 | 157 | |
| 158 | 158 | $result = $node->put($data); |
| 159 | 159 | |
| 160 | - $this->fileView->unlockFile($path . '.upload.part', ILockingProvider::LOCK_EXCLUSIVE); |
|
| 160 | + $this->fileView->unlockFile($path.'.upload.part', ILockingProvider::LOCK_EXCLUSIVE); |
|
| 161 | 161 | $node->releaseLock(ILockingProvider::LOCK_SHARED); |
| 162 | 162 | return $result; |
| 163 | 163 | } catch (\OCP\Files\StorageNotAvailableException $e) { |
@@ -187,9 +187,9 @@ discard block |
||
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | $this->fileView->verifyPath($this->path, $name); |
| 190 | - $newPath = $this->path . '/' . $name; |
|
| 190 | + $newPath = $this->path.'/'.$name; |
|
| 191 | 191 | if (!$this->fileView->mkdir($newPath)) { |
| 192 | - throw new \Sabre\DAV\Exception\Forbidden('Could not create directory ' . $newPath); |
|
| 192 | + throw new \Sabre\DAV\Exception\Forbidden('Could not create directory '.$newPath); |
|
| 193 | 193 | } |
| 194 | 194 | } catch (\OCP\Files\StorageNotAvailableException $e) { |
| 195 | 195 | throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage()); |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | throw new NotFound(); |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - $path = $this->path . '/' . $name; |
|
| 221 | + $path = $this->path.'/'.$name; |
|
| 222 | 222 | if (is_null($info)) { |
| 223 | 223 | try { |
| 224 | 224 | $this->fileView->verifyPath($this->path, $name); |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | if (!$info) { |
| 236 | - throw new \Sabre\DAV\Exception\NotFound('File with name ' . $path . ' could not be located'); |
|
| 236 | + throw new \Sabre\DAV\Exception\NotFound('File with name '.$path.' could not be located'); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | if ($info->getMimeType() === FileInfo::MIMETYPE_FOLDER) { |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | // (required old code) instead of "updateFile". |
| 293 | 293 | // |
| 294 | 294 | // TODO: resolve chunk file name here and implement "updateFile" |
| 295 | - $path = $this->path . '/' . $name; |
|
| 295 | + $path = $this->path.'/'.$name; |
|
| 296 | 296 | return $this->fileView->file_exists($path); |
| 297 | 297 | } |
| 298 | 298 | |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | throw new ServiceUnavailable('filesystem not setup'); |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | - $destinationPath = $this->getPath() . '/' . $targetName; |
|
| 392 | + $destinationPath = $this->getPath().'/'.$targetName; |
|
| 393 | 393 | |
| 394 | 394 | |
| 395 | 395 | $targetNodeExists = $this->childExists($targetName); |
@@ -397,10 +397,10 @@ discard block |
||
| 397 | 397 | // at getNodeForPath we also check the path for isForbiddenFileOrDir |
| 398 | 398 | // with that we have covered both source and destination |
| 399 | 399 | if ($sourceNode instanceof Directory && $targetNodeExists) { |
| 400 | - throw new \Sabre\DAV\Exception\Forbidden('Could not copy directory ' . $sourceNode->getName() . ', target exists'); |
|
| 400 | + throw new \Sabre\DAV\Exception\Forbidden('Could not copy directory '.$sourceNode->getName().', target exists'); |
|
| 401 | 401 | } |
| 402 | 402 | |
| 403 | - [$sourceDir,] = \Sabre\Uri\split($sourceNode->getPath()); |
|
| 403 | + [$sourceDir, ] = \Sabre\Uri\split($sourceNode->getPath()); |
|
| 404 | 404 | $destinationDir = $this->getPath(); |
| 405 | 405 | |
| 406 | 406 | $sourcePath = $sourceNode->getPath(); |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | |
| 460 | 460 | public function copyInto($targetName, $sourcePath, INode $sourceNode) { |
| 461 | 461 | if ($sourceNode instanceof File || $sourceNode instanceof Directory) { |
| 462 | - $destinationPath = $this->getPath() . '/' . $targetName; |
|
| 462 | + $destinationPath = $this->getPath().'/'.$targetName; |
|
| 463 | 463 | $sourcePath = $sourceNode->getPath(); |
| 464 | 464 | |
| 465 | 465 | if (!$this->fileView->isCreatable($this->getPath())) { |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | if (!$this->isValidPath($path)) { |
| 70 | 70 | throw new NotPermittedException('Invalid path'); |
| 71 | 71 | } |
| 72 | - return $this->path . $this->normalizePath($path); |
|
| 72 | + return $this->path.$this->normalizePath($path); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * @return bool |
| 88 | 88 | */ |
| 89 | 89 | public function isSubNode($node) { |
| 90 | - return strpos($node->getPath(), $this->path . '/') === 0; |
|
| 90 | + return strpos($node->getPath(), $this->path.'/') === 0; |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | public function getDirectoryListing() { |
| 100 | 100 | $folderContent = $this->view->getDirectoryContent($this->path, '', $this->getFileInfo()); |
| 101 | 101 | |
| 102 | - return array_map(function (FileInfo $info) { |
|
| 102 | + return array_map(function(FileInfo $info) { |
|
| 103 | 103 | if ($info->getMimetype() === FileInfo::MIMETYPE_FOLDER) { |
| 104 | 104 | return new Folder($this->root, $this->view, $info->getPath(), $info); |
| 105 | 105 | } else { |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | */ |
| 220 | 220 | public function search($query) { |
| 221 | 221 | if (is_string($query)) { |
| 222 | - $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', '%' . $query . '%')); |
|
| 222 | + $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', '%'.$query.'%')); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | // search is handled by a single query covering all caches that this folder contains |
@@ -263,22 +263,22 @@ discard block |
||
| 263 | 263 | $resultsPerCache = $searchHelper->searchInCaches($query, $caches); |
| 264 | 264 | |
| 265 | 265 | // loop trough all results per-cache, constructing the FileInfo object from the CacheEntry and merge them all |
| 266 | - $files = array_merge(...array_map(function (array $results, $relativeMountPoint) use ($mountByMountPoint) { |
|
| 266 | + $files = array_merge(...array_map(function(array $results, $relativeMountPoint) use ($mountByMountPoint) { |
|
| 267 | 267 | $mount = $mountByMountPoint[$relativeMountPoint]; |
| 268 | - return array_map(function (ICacheEntry $result) use ($relativeMountPoint, $mount) { |
|
| 268 | + return array_map(function(ICacheEntry $result) use ($relativeMountPoint, $mount) { |
|
| 269 | 269 | return $this->cacheEntryToFileInfo($mount, $relativeMountPoint, $result); |
| 270 | 270 | }, $results); |
| 271 | 271 | }, array_values($resultsPerCache), array_keys($resultsPerCache))); |
| 272 | 272 | |
| 273 | 273 | // don't include this folder in the results |
| 274 | - $files = array_filter($files, function (FileInfo $file) { |
|
| 274 | + $files = array_filter($files, function(FileInfo $file) { |
|
| 275 | 275 | return $file->getPath() !== $this->getPath(); |
| 276 | 276 | }); |
| 277 | 277 | |
| 278 | 278 | // since results were returned per-cache, they are no longer fully sorted |
| 279 | 279 | $order = $query->getOrder(); |
| 280 | 280 | if ($order) { |
| 281 | - usort($files, function (FileInfo $a, FileInfo $b) use ($order) { |
|
| 281 | + usort($files, function(FileInfo $a, FileInfo $b) use ($order) { |
|
| 282 | 282 | foreach ($order as $orderField) { |
| 283 | 283 | $cmp = $orderField->sortFileInfo($a, $b); |
| 284 | 284 | if ($cmp !== 0) { |
@@ -289,16 +289,16 @@ discard block |
||
| 289 | 289 | }); |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | - return array_map(function (FileInfo $file) { |
|
| 292 | + return array_map(function(FileInfo $file) { |
|
| 293 | 293 | return $this->createNode($file->getPath(), $file); |
| 294 | 294 | }, $files); |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | private function cacheEntryToFileInfo(IMountPoint $mount, string $appendRoot, ICacheEntry $cacheEntry): FileInfo { |
| 298 | 298 | $cacheEntry['internalPath'] = $cacheEntry['path']; |
| 299 | - $cacheEntry['path'] = $appendRoot . $cacheEntry->getPath(); |
|
| 300 | - $subPath = $cacheEntry['path'] !== '' ? '/' . $cacheEntry['path'] : ''; |
|
| 301 | - return new \OC\Files\FileInfo($this->path . $subPath, $mount->getStorage(), $cacheEntry['internalPath'], $cacheEntry, $mount); |
|
| 299 | + $cacheEntry['path'] = $appendRoot.$cacheEntry->getPath(); |
|
| 300 | + $subPath = $cacheEntry['path'] !== '' ? '/'.$cacheEntry['path'] : ''; |
|
| 301 | + return new \OC\Files\FileInfo($this->path.$subPath, $mount->getStorage(), $cacheEntry['internalPath'], $cacheEntry, $mount); |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | /** |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | */ |
| 310 | 310 | public function searchByMime($mimetype) { |
| 311 | 311 | if (strpos($mimetype, '/') === false) { |
| 312 | - $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', $mimetype . '/%')); |
|
| 312 | + $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', $mimetype.'/%')); |
|
| 313 | 313 | } else { |
| 314 | 314 | $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', $mimetype)); |
| 315 | 315 | } |
@@ -333,12 +333,12 @@ discard block |
||
| 333 | 333 | * @return \OC\Files\Node\Node[] |
| 334 | 334 | */ |
| 335 | 335 | public function getById($id) { |
| 336 | - return $this->root->getByIdInPath((int)$id, $this->getPath()); |
|
| 336 | + return $this->root->getByIdInPath((int) $id, $this->getPath()); |
|
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | protected function getAppDataDirectoryName(): string { |
| 340 | 340 | $instanceId = \OC::$server->getConfig()->getSystemValueString('instanceid'); |
| 341 | - return 'appdata_' . $instanceId; |
|
| 341 | + return 'appdata_'.$instanceId; |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | /** |
@@ -360,8 +360,8 @@ discard block |
||
| 360 | 360 | return []; |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | - $absolutePath = '/' . ltrim($cacheEntry->getPath(), '/'); |
|
| 364 | - $currentPath = rtrim($this->path, '/') . '/'; |
|
| 363 | + $absolutePath = '/'.ltrim($cacheEntry->getPath(), '/'); |
|
| 364 | + $currentPath = rtrim($this->path, '/').'/'; |
|
| 365 | 365 | |
| 366 | 366 | if (strpos($absolutePath, $currentPath) !== 0) { |
| 367 | 367 | return []; |