diff options
author | provokateurin <kate@provokateurin.de> | 2024-09-16 16:00:30 +0200 |
---|---|---|
committer | provokateurin <kate@provokateurin.de> | 2024-09-17 10:10:50 +0200 |
commit | 8ca6fcace7dc22230a7afe84936ca01470f50d00 (patch) | |
tree | fd6867b712621f7a9969bd190ef3b2f2499984d3 /lib/private | |
parent | c256518ab3cb61d046ee10edf1c3b18218ee8ff6 (diff) | |
download | nextcloud-server-8ca6fcace7dc22230a7afe84936ca01470f50d00.tar.gz nextcloud-server-8ca6fcace7dc22230a7afe84936ca01470f50d00.zip |
fix(Storage): Document getOwner() can return false
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/Files/ObjectStore/HomeObjectStoreStorage.php | 8 | ||||
-rw-r--r-- | lib/private/Files/Storage/Common.php | 8 | ||||
-rw-r--r-- | lib/private/Files/Storage/Home.php | 8 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Availability.php | 4 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Jail.php | 8 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Wrapper.php | 9 | ||||
-rw-r--r-- | lib/private/Files/View.php | 4 | ||||
-rw-r--r-- | lib/private/Lockdown/Filesystem/NullStorage.php | 4 |
8 files changed, 10 insertions, 43 deletions
diff --git a/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php b/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php index b543d223f4c..feca1f6b4f5 100644 --- a/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php @@ -32,13 +32,7 @@ class HomeObjectStoreStorage extends ObjectStoreStorage implements IHomeStorage return 'object::user:' . $this->user->getUID(); } - /** - * get the owner of a path - * - * @param string $path The path to get the owner - * @return string uid - */ - public function getOwner($path): string { + public function getOwner($path): string|false { return $this->user->getUID(); } diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index eb93ab89bc7..181da79cebe 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -390,13 +390,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { return $this->getCache($storage)->getStorageCache(); } - /** - * get the owner of a path - * - * @param string $path The path to get the owner - * @return string|false uid or false - */ - public function getOwner($path) { + public function getOwner($path): string|false { if ($this->owner === null) { $this->owner = \OC_User::getUser(); } diff --git a/lib/private/Files/Storage/Home.php b/lib/private/Files/Storage/Home.php index 0e53e7b28d4..f7151f4a005 100644 --- a/lib/private/Files/Storage/Home.php +++ b/lib/private/Files/Storage/Home.php @@ -83,13 +83,7 @@ class Home extends Local implements \OCP\Files\IHomeStorage { return $this->user; } - /** - * get the owner of a path - * - * @param string $path The path to get the owner - * @return string uid or false - */ - public function getOwner($path) { + public function getOwner($path): string|false { return $this->user->getUID(); } } diff --git a/lib/private/Files/Storage/Wrapper/Availability.php b/lib/private/Files/Storage/Wrapper/Availability.php index 6bd622e1c1b..0f1abada168 100644 --- a/lib/private/Files/Storage/Wrapper/Availability.php +++ b/lib/private/Files/Storage/Wrapper/Availability.php @@ -373,12 +373,12 @@ class Availability extends Wrapper { } } - /** {@inheritdoc} */ - public function getOwner($path) { + public function getOwner($path): string|false { try { return parent::getOwner($path); } catch (StorageNotAvailableException $e) { $this->setUnavailable($e); + return false; } } diff --git a/lib/private/Files/Storage/Wrapper/Jail.php b/lib/private/Files/Storage/Wrapper/Jail.php index 5673caf834a..46b40b92244 100644 --- a/lib/private/Files/Storage/Wrapper/Jail.php +++ b/lib/private/Files/Storage/Wrapper/Jail.php @@ -370,13 +370,7 @@ class Jail extends Wrapper { return new CacheJail($sourceCache, $this->rootPath); } - /** - * get the user id of the owner of a file or folder - * - * @param string $path - * @return string - */ - public function getOwner($path) { + public function getOwner($path): string|false { return $this->getWrapperStorage()->getOwner($this->getUnjailedPath($path)); } diff --git a/lib/private/Files/Storage/Wrapper/Wrapper.php b/lib/private/Files/Storage/Wrapper/Wrapper.php index f0420f4f16a..2a6d04da849 100644 --- a/lib/private/Files/Storage/Wrapper/Wrapper.php +++ b/lib/private/Files/Storage/Wrapper/Wrapper.php @@ -381,14 +381,7 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea return $this->getWrapperStorage()->getScanner($path, $storage); } - - /** - * get the user id of the owner of a file or folder - * - * @param string $path - * @return string - */ - public function getOwner($path) { + public function getOwner($path): string|false { return $this->getWrapperStorage()->getOwner($path); } diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index 336349c680b..9ac74461ca8 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -1676,11 +1676,9 @@ class View { /** * Get the owner for a file or folder * - * @param string $path - * @return string the user id of the owner * @throws NotFoundException */ - public function getOwner($path) { + public function getOwner(string $path): string { $info = $this->getFileInfo($path); if (!$info) { throw new NotFoundException($path . ' not found while trying to get owner'); diff --git a/lib/private/Lockdown/Filesystem/NullStorage.php b/lib/private/Lockdown/Filesystem/NullStorage.php index 7175594a01d..00124877e9d 100644 --- a/lib/private/Lockdown/Filesystem/NullStorage.php +++ b/lib/private/Lockdown/Filesystem/NullStorage.php @@ -155,8 +155,8 @@ class NullStorage extends Common { return true; } - public function getOwner($path) { - return null; + public function getOwner($path): string|false { + return false; } public function getCache($path = '', $storage = null) { |