diff options
author | provokateurin <kate@provokateurin.de> | 2024-09-06 09:44:04 +0200 |
---|---|---|
committer | provokateurin <kate@provokateurin.de> | 2024-09-09 11:09:37 +0200 |
commit | 007be83a968e6aee649ff8de173163cb5ef93a86 (patch) | |
tree | 18e03c4a5562989bbd6482e9e6a47f3619b71e30 /lib/private/Files/Storage | |
parent | fc10fa592626d154a91d77d35c93beabdc7605c1 (diff) | |
download | nextcloud-server-fix/oc/inheritdoc.tar.gz nextcloud-server-fix/oc/inheritdoc.zip |
fix(OC): Remove doc blocks for OCP implementationsfix/oc/inheritdoc
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'lib/private/Files/Storage')
-rw-r--r-- | lib/private/Files/Storage/Common.php | 116 | ||||
-rw-r--r-- | lib/private/Files/Storage/Home.php | 26 | ||||
-rw-r--r-- | lib/private/Files/Storage/StorageFactory.php | 20 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Wrapper.php | 294 |
4 files changed, 0 insertions, 456 deletions
diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index cefba66683b..bdfe6b3b0c1 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -286,18 +286,6 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { return $files; } - /** - * Check if a file or folder has been updated since $time - * - * The method is only used to check if the cache needs to be updated. Storage backends that don't support checking - * the mtime should always return false here. As a result storage implementations that always return false expect - * exclusive access to the backend and will not pick up files that have been added in a way that circumvents - * Nextcloud filesystem. - * - * @param string $path - * @param int $time - * @return bool - */ public function hasUpdated($path, $time) { return $this->filemtime($path) > $time; } @@ -342,12 +330,6 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { return $this->watcher; } - /** - * get a propagator instance for the cache - * - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher - * @return \OC\Files\Cache\Propagator - */ public function getPropagator($storage = null) { if (!$storage) { $storage = $this; @@ -373,12 +355,6 @@ 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) { if ($this->owner === null) { $this->owner = \OC_User::getUser(); @@ -387,12 +363,6 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { return $this->owner; } - /** - * get the ETag for a file or folder - * - * @param string $path - * @return string|false - */ public function getETag($path) { return uniqid(); } @@ -421,11 +391,6 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { return implode('/', $output); } - /** - * Test a storage for availability - * - * @return bool - */ public function test() { try { if ($this->stat('')) { @@ -442,31 +407,16 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { } } - /** - * get the free space in the storage - * - * @param string $path - * @return int|float|false - */ public function free_space($path) { return \OCP\Files\FileInfo::SPACE_UNKNOWN; } - /** - * {@inheritdoc} - */ public function isLocal() { // the common implementation returns a temporary file by // default, which is not local return false; } - /** - * Check if the storage is an instance of $class or is a wrapper for a storage that is an instance of $class - * - * @param string $class - * @return bool - */ public function instanceOfStorage($class) { if (ltrim($class, '\\') === 'OC\Files\Storage\Shared') { // FIXME Temporary fix to keep existing checks working @@ -475,22 +425,10 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { return is_a($this, $class); } - /** - * A custom storage implementation can return an url for direct download of a give file. - * - * For now the returned array can hold the parameter url - in future more attributes might follow. - * - * @param string $path - * @return array|false - */ public function getDirectDownload($path) { return []; } - /** - * @inheritdoc - * @throws InvalidPathException - */ public function verifyPath($path, $fileName) { $this->getFilenameValidator() ->validateFilename($fileName); @@ -536,13 +474,6 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { return $this->mountOptions[$name] ?? $default; } - /** - * @param IStorage $sourceStorage - * @param string $sourceInternalPath - * @param string $targetInternalPath - * @param bool $preserveMtime - * @return bool - */ public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = false) { if ($sourceStorage === $this) { return $this->copy($sourceInternalPath, $targetInternalPath); @@ -603,12 +534,6 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { return $storage === $this; } - /** - * @param IStorage $sourceStorage - * @param string $sourceInternalPath - * @param string $targetInternalPath - * @return bool - */ public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { if ($this->isSameStorage($sourceStorage)) { // resolve any jailed paths @@ -671,12 +596,6 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { return $data; } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - * @throws \OCP\Lock\LockedException - */ public function acquireLock($path, $type, ILockingProvider $provider) { $logger = $this->getLockLogger(); if ($logger) { @@ -704,12 +623,6 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { } } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - * @throws \OCP\Lock\LockedException - */ public function releaseLock($path, $type, ILockingProvider $provider) { $logger = $this->getLockLogger(); if ($logger) { @@ -737,12 +650,6 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { } } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - * @throws \OCP\Lock\LockedException - */ public function changeLock($path, $type, ILockingProvider $provider) { $logger = $this->getLockLogger(); if ($logger) { @@ -778,29 +685,14 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { return $this->logger; } - /** - * @return array [ available, last_checked ] - */ public function getAvailability() { return $this->getStorageCache()->getAvailability(); } - /** - * @param bool $isAvailable - */ public function setAvailability($isAvailable) { $this->getStorageCache()->setAvailability($isAvailable); } - /** - * Allow setting the storage owner - * - * This can be used for storages that do not have a dedicated owner, where we want to - * pass the user that we setup the mountpoint for along to the storage layer - * - * @param string|null $user - * @return void - */ public function setOwner(?string $user): void { $this->owner = $user; } @@ -812,14 +704,6 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { return true; } - /** - * fallback implementation - * - * @param string $path - * @param resource $stream - * @param int $size - * @return int - */ public function writeStream(string $path, $stream, ?int $size = null): int { $target = $this->fopen($path, 'w'); if (!$target) { diff --git a/lib/private/Files/Storage/Home.php b/lib/private/Files/Storage/Home.php index a8d1f82b987..391042306dc 100644 --- a/lib/private/Files/Storage/Home.php +++ b/lib/private/Files/Storage/Home.php @@ -24,12 +24,6 @@ class Home extends Local implements \OCP\Files\IHomeStorage { */ protected $user; - /** - * Construct a Home storage instance - * - * @param array $arguments array with "user" containing the - * storage owner - */ public function __construct($arguments) { $this->user = $arguments['user']; $datadir = $this->user->getHome(); @@ -42,9 +36,6 @@ class Home extends Local implements \OCP\Files\IHomeStorage { return $this->id; } - /** - * @return \OC\Files\Cache\HomeCache - */ public function getCache($path = '', $storage = null) { if (!$storage) { $storage = $this; @@ -55,12 +46,6 @@ class Home extends Local implements \OCP\Files\IHomeStorage { return $this->cache; } - /** - * get a propagator instance for the cache - * - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher - * @return \OC\Files\Cache\Propagator - */ public function getPropagator($storage = null) { if (!$storage) { $storage = $this; @@ -72,21 +57,10 @@ class Home extends Local implements \OCP\Files\IHomeStorage { } - /** - * Returns the owner of this home storage - * - * @return \OC\User\User owner of this home storage - */ public function getUser(): IUser { 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) { return $this->user->getUID(); } diff --git a/lib/private/Files/Storage/StorageFactory.php b/lib/private/Files/Storage/StorageFactory.php index 612592e2d3a..2b578951247 100644 --- a/lib/private/Files/Storage/StorageFactory.php +++ b/lib/private/Files/Storage/StorageFactory.php @@ -16,18 +16,6 @@ class StorageFactory implements IStorageFactory { */ private $storageWrappers = []; - /** - * allow modifier storage behaviour by adding wrappers around storages - * - * $callback should be a function of type (string $mountPoint, Storage $storage) => Storage - * - * @param string $wrapperName name of the wrapper - * @param callable $callback callback - * @param int $priority wrappers with the lower priority are applied last (meaning they get called first) - * @param \OCP\Files\Mount\IMountPoint[] $existingMounts existing mount points to apply the wrapper to - * @return bool true if the wrapper was added, false if there was already a wrapper with this - * name registered - */ public function addStorageWrapper($wrapperName, $callback, $priority = 50, $existingMounts = []) { if (isset($this->storageWrappers[$wrapperName])) { return false; @@ -53,14 +41,6 @@ class StorageFactory implements IStorageFactory { unset($this->storageWrappers[$wrapperName]); } - /** - * Create an instance of a storage and apply the registered storage wrappers - * - * @param \OCP\Files\Mount\IMountPoint $mountPoint - * @param string $class - * @param array $arguments - * @return \OCP\Files\Storage - */ public function getInstance(IMountPoint $mountPoint, $class, $arguments) { return $this->wrap($mountPoint, new $class($arguments)); } diff --git a/lib/private/Files/Storage/Wrapper/Wrapper.php b/lib/private/Files/Storage/Wrapper/Wrapper.php index f8aa9d963dc..d26a119b8f0 100644 --- a/lib/private/Files/Storage/Wrapper/Wrapper.php +++ b/lib/private/Files/Storage/Wrapper/Wrapper.php @@ -8,7 +8,6 @@ namespace OC\Files\Storage\Wrapper; use OC\Files\Storage\FailedStorage; -use OCP\Files\InvalidPathException; use OCP\Files\Storage\ILockingStorage; use OCP\Files\Storage\IStorage; use OCP\Files\Storage\IWriteStreamStorage; @@ -28,9 +27,6 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea public $propagator; public $updater; - /** - * @param array $parameters - */ public function __construct($parameters) { $this->storage = $parameters['storage']; } @@ -48,270 +44,106 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea return $this->storage; } - /** - * Get the identifier for the storage, - * the returned id should be the same for every storage object that is created with the same parameters - * and two storage objects with the same id should refer to two storages that display the same files. - * - * @return string - */ public function getId() { return $this->getWrapperStorage()->getId(); } - /** - * see https://www.php.net/manual/en/function.mkdir.php - * - * @param string $path - * @return bool - */ public function mkdir($path) { return $this->getWrapperStorage()->mkdir($path); } - /** - * see https://www.php.net/manual/en/function.rmdir.php - * - * @param string $path - * @return bool - */ public function rmdir($path) { return $this->getWrapperStorage()->rmdir($path); } - /** - * see https://www.php.net/manual/en/function.opendir.php - * - * @param string $path - * @return resource|false - */ public function opendir($path) { return $this->getWrapperStorage()->opendir($path); } - /** - * see https://www.php.net/manual/en/function.is_dir.php - * - * @param string $path - * @return bool - */ public function is_dir($path) { return $this->getWrapperStorage()->is_dir($path); } - /** - * see https://www.php.net/manual/en/function.is_file.php - * - * @param string $path - * @return bool - */ public function is_file($path) { return $this->getWrapperStorage()->is_file($path); } - /** - * see https://www.php.net/manual/en/function.stat.php - * only the following keys are required in the result: size and mtime - * - * @param string $path - * @return array|bool - */ public function stat($path) { return $this->getWrapperStorage()->stat($path); } - /** - * see https://www.php.net/manual/en/function.filetype.php - * - * @param string $path - * @return string|bool - */ public function filetype($path) { return $this->getWrapperStorage()->filetype($path); } - /** - * see https://www.php.net/manual/en/function.filesize.php - * The result for filesize when called on a folder is required to be 0 - */ public function filesize($path): false|int|float { return $this->getWrapperStorage()->filesize($path); } - /** - * check if a file can be created in $path - * - * @param string $path - * @return bool - */ public function isCreatable($path) { return $this->getWrapperStorage()->isCreatable($path); } - /** - * check if a file can be read - * - * @param string $path - * @return bool - */ public function isReadable($path) { return $this->getWrapperStorage()->isReadable($path); } - /** - * check if a file can be written to - * - * @param string $path - * @return bool - */ public function isUpdatable($path) { return $this->getWrapperStorage()->isUpdatable($path); } - /** - * check if a file can be deleted - * - * @param string $path - * @return bool - */ public function isDeletable($path) { return $this->getWrapperStorage()->isDeletable($path); } - /** - * check if a file can be shared - * - * @param string $path - * @return bool - */ public function isSharable($path) { return $this->getWrapperStorage()->isSharable($path); } - /** - * get the full permissions of a path. - * Should return a combination of the PERMISSION_ constants defined in lib/public/constants.php - * - * @param string $path - * @return int - */ public function getPermissions($path) { return $this->getWrapperStorage()->getPermissions($path); } - /** - * see https://www.php.net/manual/en/function.file_exists.php - * - * @param string $path - * @return bool - */ public function file_exists($path) { return $this->getWrapperStorage()->file_exists($path); } - /** - * see https://www.php.net/manual/en/function.filemtime.php - * - * @param string $path - * @return int|bool - */ public function filemtime($path) { return $this->getWrapperStorage()->filemtime($path); } - /** - * see https://www.php.net/manual/en/function.file_get_contents.php - * - * @param string $path - * @return string|false - */ public function file_get_contents($path) { return $this->getWrapperStorage()->file_get_contents($path); } - /** - * see https://www.php.net/manual/en/function.file_put_contents.php - * - * @param string $path - * @param mixed $data - * @return int|float|false - */ public function file_put_contents($path, $data) { return $this->getWrapperStorage()->file_put_contents($path, $data); } - /** - * see https://www.php.net/manual/en/function.unlink.php - * - * @param string $path - * @return bool - */ public function unlink($path) { return $this->getWrapperStorage()->unlink($path); } - /** - * see https://www.php.net/manual/en/function.rename.php - * - * @param string $source - * @param string $target - * @return bool - */ public function rename($source, $target) { return $this->getWrapperStorage()->rename($source, $target); } - /** - * see https://www.php.net/manual/en/function.copy.php - * - * @param string $source - * @param string $target - * @return bool - */ public function copy($source, $target) { return $this->getWrapperStorage()->copy($source, $target); } - /** - * see https://www.php.net/manual/en/function.fopen.php - * - * @param string $path - * @param string $mode - * @return resource|bool - */ public function fopen($path, $mode) { return $this->getWrapperStorage()->fopen($path, $mode); } - /** - * get the mimetype for a file or folder - * The mimetype for a folder is required to be "httpd/unix-directory" - * - * @param string $path - * @return string|bool - */ public function getMimeType($path) { return $this->getWrapperStorage()->getMimeType($path); } - /** - * see https://www.php.net/manual/en/function.hash.php - * - * @param string $type - * @param string $path - * @param bool $raw - * @return string|bool - */ public function hash($type, $path, $raw = false) { return $this->getWrapperStorage()->hash($type, $path, $raw); } - /** - * see https://www.php.net/manual/en/function.free_space.php - * - * @param string $path - * @return int|float|bool - */ public function free_space($path) { return $this->getWrapperStorage()->free_space($path); } @@ -326,50 +158,18 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea return $this->getWrapperStorage()->search($query); } - /** - * see https://www.php.net/manual/en/function.touch.php - * If the backend does not support the operation, false should be returned - * - * @param string $path - * @param int $mtime - * @return bool - */ public function touch($path, $mtime = null) { return $this->getWrapperStorage()->touch($path, $mtime); } - /** - * get the path to a local version of the file. - * The local version of the file can be temporary and doesn't have to be persistent across requests - * - * @param string $path - * @return string|false - */ public function getLocalFile($path) { return $this->getWrapperStorage()->getLocalFile($path); } - /** - * check if a file or folder has been updated since $time - * - * @param string $path - * @param int $time - * @return bool - * - * hasUpdated for folders should return at least true if a file inside the folder is add, removed or renamed. - * returning true for other changes in the folder is optional - */ public function hasUpdated($path, $time) { return $this->getWrapperStorage()->hasUpdated($path, $time); } - /** - * get a cache instance for the storage - * - * @param string $path - * @param \OC\Files\Storage\Storage|null (optional) the storage to pass to the cache - * @return \OC\Files\Cache\Cache - */ public function getCache($path = '', $storage = null) { if (!$storage) { $storage = $this; @@ -377,13 +177,6 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea return $this->getWrapperStorage()->getCache($path, $storage); } - /** - * get a scanner instance for the storage - * - * @param string $path - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the scanner - * @return \OC\Files\Cache\Scanner - */ public function getScanner($path = '', $storage = null) { if (!$storage) { $storage = $this; @@ -392,23 +185,10 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea } - /** - * get the user id of the owner of a file or folder - * - * @param string $path - * @return string - */ public function getOwner($path) { return $this->getWrapperStorage()->getOwner($path); } - /** - * get a watcher instance for the cache - * - * @param string $path - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher - * @return \OC\Files\Cache\Watcher - */ public function getWatcher($path = '', $storage = null) { if (!$storage) { $storage = $this; @@ -437,40 +217,18 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea return $this->getWrapperStorage()->getStorageCache(); } - /** - * get the ETag for a file or folder - * - * @param string $path - * @return string|false - */ public function getETag($path) { return $this->getWrapperStorage()->getETag($path); } - /** - * Returns true - * - * @return true - */ public function test() { return $this->getWrapperStorage()->test(); } - /** - * Returns the wrapped storage's value for isLocal() - * - * @return bool wrapped storage's isLocal() value - */ public function isLocal() { return $this->getWrapperStorage()->isLocal(); } - /** - * Check if the storage is an instance of $class or is a wrapper for a storage that is an instance of $class - * - * @param class-string<IStorage> $class - * @return bool - */ public function instanceOfStorage($class) { if (ltrim($class, '\\') === 'OC\Files\Storage\Shared') { // FIXME Temporary fix to keep existing checks working @@ -509,52 +267,22 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea return call_user_func_array([$this->getWrapperStorage(), $method], $args); } - /** - * A custom storage implementation can return an url for direct download of a give file. - * - * For now the returned array can hold the parameter url - in future more attributes might follow. - * - * @param string $path - * @return array|bool - */ public function getDirectDownload($path) { return $this->getWrapperStorage()->getDirectDownload($path); } - /** - * Get availability of the storage - * - * @return array [ available, last_checked ] - */ public function getAvailability() { return $this->getWrapperStorage()->getAvailability(); } - /** - * Set availability of the storage - * - * @param bool $isAvailable - */ public function setAvailability($isAvailable) { $this->getWrapperStorage()->setAvailability($isAvailable); } - /** - * @param string $path the path of the target folder - * @param string $fileName the name of the file itself - * @return void - * @throws InvalidPathException - */ public function verifyPath($path, $fileName) { $this->getWrapperStorage()->verifyPath($path, $fileName); } - /** - * @param IStorage $sourceStorage - * @param string $sourceInternalPath - * @param string $targetInternalPath - * @return bool - */ public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { if ($sourceStorage === $this) { return $this->copy($sourceInternalPath, $targetInternalPath); @@ -563,12 +291,6 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea return $this->getWrapperStorage()->copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); } - /** - * @param IStorage $sourceStorage - * @param string $sourceInternalPath - * @param string $targetInternalPath - * @return bool - */ public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { if ($sourceStorage === $this) { return $this->rename($sourceInternalPath, $targetInternalPath); @@ -581,34 +303,18 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea return $this->getWrapperStorage()->getMetaData($path); } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - * @throws \OCP\Lock\LockedException - */ public function acquireLock($path, $type, ILockingProvider $provider) { if ($this->getWrapperStorage()->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { $this->getWrapperStorage()->acquireLock($path, $type, $provider); } } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - */ public function releaseLock($path, $type, ILockingProvider $provider) { if ($this->getWrapperStorage()->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { $this->getWrapperStorage()->releaseLock($path, $type, $provider); } } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - */ public function changeLock($path, $type, ILockingProvider $provider) { if ($this->getWrapperStorage()->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { $this->getWrapperStorage()->changeLock($path, $type, $provider); |