diff options
author | provokateurin <kate@provokateurin.de> | 2024-09-19 18:19:34 +0200 |
---|---|---|
committer | provokateurin <kate@provokateurin.de> | 2024-09-26 18:13:03 +0200 |
commit | 7cdccd058f98a5e4164fc314f06f62fd8dfcd73c (patch) | |
tree | 948927053d2d1b06f9fa27e7f2c897ac922181e1 /lib/private/Files/ObjectStore/ObjectStoreStorage.php | |
parent | 256a8d8903ef3a81a425f417c0eb626f42036a25 (diff) | |
download | nextcloud-server-7cdccd058f98a5e4164fc314f06f62fd8dfcd73c.tar.gz nextcloud-server-7cdccd058f98a5e4164fc314f06f62fd8dfcd73c.zip |
fix(Storage): Fix IStorage return types
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'lib/private/Files/ObjectStore/ObjectStoreStorage.php')
-rw-r--r-- | lib/private/Files/ObjectStore/ObjectStoreStorage.php | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php index 2f1f91f7f22..c44b5b299ed 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -17,6 +17,7 @@ use OC\Files\Cache\CacheEntry; use OC\Files\Storage\PolyFill\CopyDirectory; use OCP\Files\Cache\ICache; use OCP\Files\Cache\ICacheEntry; +use OCP\Files\Cache\IScanner; use OCP\Files\FileInfo; use OCP\Files\GenericFileException; use OCP\Files\NotFoundException; @@ -64,7 +65,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil $this->logger = \OCP\Server::get(LoggerInterface::class); } - public function mkdir($path, bool $force = false) { + public function mkdir($path, bool $force = false): bool { $path = $this->normalizePath($path); if (!$force && $this->file_exists($path)) { $this->logger->warning("Tried to create an object store folder that already exists: $path"); @@ -130,7 +131,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil * Object Stores use a NoopScanner because metadata is directly stored in * the file cache and cannot really scan the filesystem. The storage passed in is not used anywhere. */ - public function getScanner($path = '', $storage = null) { + public function getScanner($path = '', $storage = null): IScanner { if (!$storage) { $storage = $this; } @@ -141,11 +142,11 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil return $this->scanner; } - public function getId() { + public function getId(): string { return $this->id; } - public function rmdir($path) { + public function rmdir($path): bool { $path = $this->normalizePath($path); $entry = $this->getCache()->get($path); @@ -175,7 +176,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil return true; } - public function unlink($path) { + public function unlink($path): bool { $path = $this->normalizePath($path); $entry = $this->getCache()->get($path); @@ -209,7 +210,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil return true; } - public function stat($path) { + public function stat($path): array|false { $path = $this->normalizePath($path); $cacheEntry = $this->getCache()->get($path); if ($cacheEntry instanceof CacheEntry) { @@ -226,7 +227,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil } } - public function getPermissions($path) { + public function getPermissions($path): int { $stat = $this->stat($path); if (is_array($stat) && isset($stat['permissions'])) { @@ -268,7 +269,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil } } - public function filetype($path) { + public function filetype($path): string|false { $path = $this->normalizePath($path); $stat = $this->stat($path); if ($stat) { @@ -373,12 +374,12 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil return false; } - public function file_exists($path) { + public function file_exists($path): bool { $path = $this->normalizePath($path); return (bool)$this->stat($path); } - public function rename($source, $target) { + public function rename($source, $target): bool { $source = $this->normalizePath($source); $target = $this->normalizePath($target); $this->remove($target); @@ -387,12 +388,12 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil return true; } - public function getMimeType($path) { + public function getMimeType($path): string|false { $path = $this->normalizePath($path); return parent::getMimeType($path); } - public function touch($path, $mtime = null) { + public function touch($path, $mtime = null): bool { if (is_null($mtime)) { $mtime = time(); } @@ -443,22 +444,15 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil $this->writeStream($path, fopen($tmpFile, 'r'), $size); } - /** - * external changes are not supported, exclusive access to the object storage is assumed - * - * @param string $path - * @param int $time - * @return false - */ - public function hasUpdated($path, $time) { + public function hasUpdated($path, $time): bool { return false; } - public function needsPartFile() { + public function needsPartFile(): bool { return false; } - public function file_put_contents($path, $data) { + public function file_put_contents($path, $data): int { $fh = fopen('php://temp', 'w+'); fwrite($fh, $data); rewind($fh); @@ -571,7 +565,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil $sourceInternalPath, $targetInternalPath, $preserveMtime = false, - ) { + ): bool { if ($sourceStorage->instanceOfStorage(ObjectStoreStorage::class)) { /** @var ObjectStoreStorage $sourceStorage */ if ($sourceStorage->getObjectStore()->getStorageId() === $this->getObjectStore()->getStorageId()) { @@ -627,7 +621,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil return true; } - public function copy($source, $target) { + public function copy($source, $target): bool { $source = $this->normalizePath($source); $target = $this->normalizePath($target); @@ -695,7 +689,6 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil } /** - * * @throws GenericFileException */ public function putChunkedWritePart( |