aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Files')
-rw-r--r--lib/private/Files/Cache/Cache.php145
-rw-r--r--lib/private/Files/Cache/CacheEntry.php3
-rw-r--r--lib/private/Files/Cache/FileAccess.php9
-rw-r--r--lib/private/Files/Cache/Propagator.php16
-rw-r--r--lib/private/Files/Cache/Scanner.php32
-rw-r--r--lib/private/Files/Cache/Updater.php29
-rw-r--r--lib/private/Files/Cache/Watcher.php32
-rw-r--r--lib/private/Files/Config/CachedMountInfo.php26
-rw-r--r--lib/private/Files/Config/MountProviderCollection.php29
-rw-r--r--lib/private/Files/Config/UserMountCache.php29
-rw-r--r--lib/private/Files/FileInfo.php78
-rw-r--r--lib/private/Files/FilenameValidator.php6
-rw-r--r--lib/private/Files/Mount/CacheMountProvider.php7
-rw-r--r--lib/private/Files/Mount/LocalHomeMountProvider.php7
-rw-r--r--lib/private/Files/Mount/Manager.php44
-rw-r--r--lib/private/Files/Mount/MountPoint.php43
-rw-r--r--lib/private/Files/Mount/ObjectHomeMountProvider.php7
-rw-r--r--lib/private/Files/Mount/ObjectStorePreviewCacheMountProvider.php4
-rw-r--r--lib/private/Files/Node/File.php32
-rw-r--r--lib/private/Files/Node/Folder.php78
-rw-r--r--lib/private/Files/Node/LazyFolder.php148
-rw-r--r--lib/private/Files/Node/Node.php101
-rw-r--r--lib/private/Files/Node/Root.php88
-rw-r--r--lib/private/Files/Notify/Change.php12
-rw-r--r--lib/private/Files/Notify/RenameChange.php5
-rw-r--r--lib/private/Files/ObjectStore/Azure.php13
-rw-r--r--lib/private/Files/ObjectStore/HomeObjectStoreStorage.php12
-rw-r--r--lib/private/Files/ObjectStore/ObjectStoreStorage.php23
-rw-r--r--lib/private/Files/ObjectStore/S3.php4
-rw-r--r--lib/private/Files/ObjectStore/StorageObjectStore.php16
-rw-r--r--lib/private/Files/ObjectStore/Swift.php14
-rw-r--r--lib/private/Files/Search/SearchBinaryOperator.php6
-rw-r--r--lib/private/Files/Search/SearchComparison.php10
-rw-r--r--lib/private/Files/Search/SearchOrder.php10
-rw-r--r--lib/private/Files/Search/SearchQuery.php15
-rw-r--r--lib/private/Files/SimpleFS/NewSimpleFile.php53
-rw-r--r--lib/private/Files/SimpleFS/SimpleFile.php51
-rw-r--r--lib/private/Files/Storage/Common.php116
-rw-r--r--lib/private/Files/Storage/Home.php26
-rw-r--r--lib/private/Files/Storage/StorageFactory.php20
-rw-r--r--lib/private/Files/Storage/Wrapper/Wrapper.php294
-rw-r--r--lib/private/Files/Template/TemplateManager.php7
-rw-r--r--lib/private/Files/Type/Detection.php38
-rw-r--r--lib/private/Files/Type/Loader.php12
44 files changed, 0 insertions, 1750 deletions
diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php
index a8d9067050d..e7f1e259e03 100644
--- a/lib/private/Files/Cache/Cache.php
+++ b/lib/private/Files/Cache/Cache.php
@@ -97,21 +97,10 @@ class Cache implements ICache {
return $this->storageCache;
}
- /**
- * Get the numeric storage id for this cache's storage
- *
- * @return int
- */
public function getNumericStorageId() {
return $this->storageCache->getNumericId();
}
- /**
- * get the stored metadata of a file or folder
- *
- * @param string | int $file either the path of a file or folder or the file id for a file or folder
- * @return ICacheEntry|false the cache entry as array or false if the file is not found in the cache
- */
public function get($file) {
$query = $this->getQueryBuilder();
$query->selectFileCache();
@@ -178,23 +167,11 @@ class Cache implements ICache {
return new CacheEntry($data);
}
- /**
- * get the metadata of all files stored in $folder
- *
- * @param string $folder
- * @return ICacheEntry[]
- */
public function getFolderContents($folder) {
$fileId = $this->getId($folder);
return $this->getFolderContentsById($fileId);
}
- /**
- * get the metadata of all files stored in $folder
- *
- * @param int $fileId the file id of the folder
- * @return ICacheEntry[]
- */
public function getFolderContentsById($fileId) {
if ($fileId > -1) {
$query = $this->getQueryBuilder();
@@ -217,15 +194,6 @@ class Cache implements ICache {
return [];
}
- /**
- * insert or update meta data for a file or folder
- *
- * @param string $file
- * @param array $data
- *
- * @return int file id
- * @throws \RuntimeException
- */
public function put($file, array $data) {
if (($id = $this->getId($file)) > -1) {
$this->update($id, $data);
@@ -235,15 +203,6 @@ class Cache implements ICache {
}
}
- /**
- * insert meta data for a new file or folder
- *
- * @param string $file
- * @param array $data
- *
- * @return int file id
- * @throws \RuntimeException
- */
public function insert($file, array $data) {
// normalize file
$file = $this->normalize($file);
@@ -316,12 +275,6 @@ class Cache implements ICache {
}
}
- /**
- * update the metadata of an existing file or folder in the cache
- *
- * @param int $id the fileid of the existing file or folder
- * @param array $data [$key => $value] the metadata to update, only the fields provided in the array will be updated, non-provided values will remain unchanged
- */
public function update($id, array $data) {
if (isset($data['path'])) {
// normalize path
@@ -445,16 +398,6 @@ class Cache implements ICache {
return [$params, array_filter($extensionParams)];
}
- /**
- * get the file id for a file
- *
- * A file id is a numeric id for a file or folder that's unique within an owncloud instance which stays the same for the lifetime of a file
- *
- * File ids are easiest way for apps to store references to a file since unlike paths they are not affected by renames or sharing
- *
- * @param string $file
- * @return int
- */
public function getId($file) {
// normalize file
$file = $this->normalize($file);
@@ -472,12 +415,6 @@ class Cache implements ICache {
return $id === false ? -1 : (int)$id;
}
- /**
- * get the id of the parent folder of a file
- *
- * @param string $file
- * @return int
- */
public function getParentId($file) {
if ($file === '') {
return -1;
@@ -495,23 +432,10 @@ class Cache implements ICache {
return $parent;
}
- /**
- * check if a file is available in the cache
- *
- * @param string $file
- * @return bool
- */
public function inCache($file) {
return $this->getId($file) != -1;
}
- /**
- * remove a file or folder from the cache
- *
- * when removing a folder from the cache all files and folders inside the folder will be removed as well
- *
- * @param string $file
- */
public function remove($file) {
$entry = $this->get($file);
@@ -614,12 +538,6 @@ class Cache implements ICache {
}
}
- /**
- * Move a file or folder in the cache
- *
- * @param string $source
- * @param string $target
- */
public function move($source, $target) {
$this->moveFromCache($this, $source, $target);
}
@@ -638,15 +556,6 @@ class Cache implements ICache {
return $this->storage->instanceOfStorage(Encryption::class);
}
- /**
- * Move a file or folder in the cache
- *
- * @param ICache $sourceCache
- * @param string $sourcePath
- * @param string $targetPath
- * @throws \OC\DatabaseException
- * @throws \Exception if the given storages have an invalid id
- */
public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) {
if ($sourceCache instanceof Cache) {
// normalize source and target
@@ -805,18 +714,6 @@ class Cache implements ICache {
$query->execute();
}
- /**
- * Get the scan status of a file
- *
- * - Cache::NOT_FOUND: File is not in the cache
- * - Cache::PARTIAL: File is not stored in the cache but some incomplete data is known
- * - Cache::SHALLOW: The folder and it's direct children are in the cache but not all sub folders are fully scanned
- * - Cache::COMPLETE: The file or folder, with all it's children) are fully scanned
- *
- * @param string $file
- *
- * @return int Cache::NOT_FOUND, Cache::PARTIAL, Cache::SHALLOW or Cache::COMPLETE
- */
public function getStatus($file) {
// normalize file
$file = $this->normalize($file);
@@ -846,24 +743,11 @@ class Cache implements ICache {
}
}
- /**
- * search for files matching $pattern
- *
- * @param string $pattern the search pattern using SQL search syntax (e.g. '%searchstring%')
- * @return ICacheEntry[] an array of cache entries where the name matches the search pattern
- */
public function search($pattern) {
$operator = new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', $pattern);
return $this->searchQuery(new SearchQuery($operator, 0, 0, [], null));
}
- /**
- * search for files by mimetype
- *
- * @param string $mimetype either a full mimetype to search ('text/plain') or only the first part of a mimetype ('image')
- * where it will search for all mimetypes in the group ('image/*')
- * @return ICacheEntry[] an array of cache entries where the mimetype matches the search
- */
public function searchByMime($mimetype) {
if (!str_contains($mimetype, '/')) {
$operator = new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', $mimetype . '/%');
@@ -1045,15 +929,6 @@ class Cache implements ICache {
}, $files);
}
- /**
- * find a folder in the cache which has not been fully scanned
- *
- * If multiple incomplete folders are in the cache, the one with the highest id will be returned,
- * use the one with the highest id gives the best result with the background scanner, since that is most
- * likely the folder where we stopped scanning previously
- *
- * @return string|false the path of the folder or false when no folder matched
- */
public function getIncomplete() {
// we select the fileid here first instead of directly selecting the path since this helps mariadb/mysql
// to use the correct index.
@@ -1079,12 +954,6 @@ class Cache implements ICache {
return $path ?? false;
}
- /**
- * get the path of a file on this storage by it's file id
- *
- * @param int $id the file id of the file or folder to search
- * @return string|null the path of the file (relative to the storage) or null if a file with the given id does not exists within this cache
- */
public function getPathById($id) {
$query = $this->getQueryBuilder();
$query->select('path')
@@ -1136,24 +1005,10 @@ class Cache implements ICache {
}
}
- /**
- * normalize the given path
- *
- * @param string $path
- * @return string
- */
public function normalize($path) {
return trim(\OC_Util::normalizeUnicode($path), '/');
}
- /**
- * Copy a file or folder in the cache
- *
- * @param ICache $sourceCache
- * @param ICacheEntry $sourceEntry
- * @param string $targetPath
- * @return int fileId of copied entry
- */
public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, string $targetPath): int {
if ($sourceEntry->getId() < 0) {
throw new \RuntimeException('Invalid source cache entry on copyFromCache');
diff --git a/lib/private/Files/Cache/CacheEntry.php b/lib/private/Files/Cache/CacheEntry.php
index e9417c8012a..19f1dc941d3 100644
--- a/lib/private/Files/Cache/CacheEntry.php
+++ b/lib/private/Files/Cache/CacheEntry.php
@@ -34,9 +34,6 @@ class CacheEntry implements ICacheEntry {
unset($this->data[$offset]);
}
- /**
- * @return mixed
- */
#[\ReturnTypeWillChange]
public function offsetGet($offset) {
if (isset($this->data[$offset])) {
diff --git a/lib/private/Files/Cache/FileAccess.php b/lib/private/Files/Cache/FileAccess.php
index 11a95b5d897..5164318ea1b 100644
--- a/lib/private/Files/Cache/FileAccess.php
+++ b/lib/private/Files/Cache/FileAccess.php
@@ -68,10 +68,6 @@ class FileAccess implements IFileAccess {
return $result;
}
- /**
- * @param int[] $fileIds
- * @return array<int, CacheEntry>
- */
public function getByFileIds(array $fileIds): array {
$query = $this->getQuery()->selectFileCache();
$query->andWhere($query->expr()->in('filecache.fileid', $query->createNamedParameter($fileIds, IQueryBuilder::PARAM_INT_ARRAY)));
@@ -80,11 +76,6 @@ class FileAccess implements IFileAccess {
return $this->rowsToEntries($rows);
}
- /**
- * @param int[] $fileIds
- * @param int $storageId
- * @return array<int, CacheEntry>
- */
public function getByFileIdsInStorage(array $fileIds, int $storageId): array {
$fileIds = array_values($fileIds);
$query = $this->getQuery()->selectFileCache();
diff --git a/lib/private/Files/Cache/Propagator.php b/lib/private/Files/Cache/Propagator.php
index bbeb8c42075..eaf1dabf9aa 100644
--- a/lib/private/Files/Cache/Propagator.php
+++ b/lib/private/Files/Cache/Propagator.php
@@ -46,11 +46,6 @@ class Propagator implements IPropagator {
}
- /**
- * @param string $internalPath
- * @param int $time
- * @param int $sizeDifference number of bytes the file has grown
- */
public function propagateChange($internalPath, $time, $sizeDifference = 0) {
// Do not propagate changes in ignored paths
foreach ($this->ignore as $ignore) {
@@ -142,14 +137,6 @@ class Propagator implements IPropagator {
return $parents;
}
- /**
- * Mark the beginning of a propagation batch
- *
- * Note that not all cache setups support propagation in which case this will be a noop
- *
- * Batching for cache setups that do support it has to be explicit since the cache state is not fully consistent
- * before the batch is committed.
- */
public function beginBatch() {
$this->inBatch = true;
}
@@ -169,9 +156,6 @@ class Propagator implements IPropagator {
}
}
- /**
- * Commit the active propagation batch
- */
public function commitBatch() {
if (!$this->inBatch) {
throw new \BadMethodCallException('Not in batch');
diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php
index c85104ac4b9..3d645fdcb72 100644
--- a/lib/private/Files/Cache/Scanner.php
+++ b/lib/private/Files/Cache/Scanner.php
@@ -101,18 +101,6 @@ class Scanner extends BasicEmitter implements IScanner {
return $data;
}
- /**
- * scan a single file and store it in the cache
- *
- * @param string $file
- * @param int $reuseExisting
- * @param int $parentId
- * @param array|null|false $cacheData existing data in the cache for the file to be scanned
- * @param bool $lock set to false to disable getting an additional read lock during scanning
- * @param null $data the metadata for the file, as returned by the storage
- * @return array|null an array of metadata of the scanned file
- * @throws \OCP\Lock\LockedException
- */
public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true, $data = null) {
if ($file !== '') {
try {
@@ -305,15 +293,6 @@ class Scanner extends BasicEmitter implements IScanner {
}
}
- /**
- * scan a folder and all it's children
- *
- * @param string $path
- * @param bool $recursive
- * @param int $reuse
- * @param bool $lock set to false to disable getting an additional read lock during scanning
- * @return array|null an array of the meta data of the scanned file or folder
- */
public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true) {
if ($reuse === -1) {
$reuse = ($recursive === self::SCAN_SHALLOW) ? self::REUSE_ETAG | self::REUSE_SIZE : self::REUSE_ETAG;
@@ -553,14 +532,6 @@ class Scanner extends BasicEmitter implements IScanner {
return $childQueue;
}
- /**
- * check if the file should be ignored when scanning
- * NOTE: files with a '.part' extension are ignored as well!
- * prevents unfinished put requests to be scanned
- *
- * @param string $file
- * @return boolean
- */
public static function isPartialFile($file) {
if (pathinfo($file, PATHINFO_EXTENSION) === 'part') {
return true;
@@ -572,9 +543,6 @@ class Scanner extends BasicEmitter implements IScanner {
return false;
}
- /**
- * walk over any folders that are not fully scanned yet and scan them
- */
public function backgroundScan() {
if ($this->storage->instanceOfStorage(Jail::class)) {
// for jail storage wrappers (shares, groupfolders) we run the background scan on the source storage
diff --git a/lib/private/Files/Cache/Updater.php b/lib/private/Files/Cache/Updater.php
index eab68b4f545..67329e0e3d9 100644
--- a/lib/private/Files/Cache/Updater.php
+++ b/lib/private/Files/Cache/Updater.php
@@ -71,21 +71,10 @@ class Updater implements IUpdater {
$this->enabled = true;
}
- /**
- * Get the propagator for etags and mtime for the view the updater works on
- *
- * @return Propagator
- */
public function getPropagator() {
return $this->propagator;
}
- /**
- * Propagate etag and mtime changes for the parent folders of $path up to the root of the filesystem
- *
- * @param string $path the path of the file to propagate the changes for
- * @param int|null $time the timestamp to set as mtime for the parent folders, if left out the current time is used
- */
public function propagate($path, $time = null) {
if (Scanner::isPartialFile($path)) {
return;
@@ -93,12 +82,6 @@ class Updater implements IUpdater {
$this->propagator->propagateChange($path, $time);
}
- /**
- * Update the cache for $path and update the size, etag and mtime of the parent folders
- *
- * @param string $path
- * @param int $time
- */
public function update($path, $time = null, ?int $sizeDifference = null) {
if (!$this->enabled or Scanner::isPartialFile($path)) {
return;
@@ -126,11 +109,6 @@ class Updater implements IUpdater {
$this->propagator->propagateChange($path, $time, $sizeDifference ?? 0);
}
- /**
- * Remove $path from the cache and update the size, etag and mtime of the parent folders
- *
- * @param string $path
- */
public function remove($path) {
if (!$this->enabled or Scanner::isPartialFile($path)) {
return;
@@ -156,13 +134,6 @@ class Updater implements IUpdater {
}
}
- /**
- * Rename a file or folder in the cache and update the size, etag and mtime of the parent folders
- *
- * @param IStorage $sourceStorage
- * @param string $source
- * @param string $target
- */
public function renameFromStorage(IStorage $sourceStorage, $source, $target) {
if (!$this->enabled or Scanner::isPartialFile($source) or Scanner::isPartialFile($target)) {
return;
diff --git a/lib/private/Files/Cache/Watcher.php b/lib/private/Files/Cache/Watcher.php
index 2e42b716695..7863d2b71e3 100644
--- a/lib/private/Files/Cache/Watcher.php
+++ b/lib/private/Files/Cache/Watcher.php
@@ -7,7 +7,6 @@
*/
namespace OC\Files\Cache;
-use OCP\Files\Cache\ICacheEntry;
use OCP\Files\Cache\IWatcher;
/**
@@ -42,27 +41,14 @@ class Watcher implements IWatcher {
$this->scanner = $storage->getScanner();
}
- /**
- * @param int $policy either \OC\Files\Cache\Watcher::CHECK_NEVER, \OC\Files\Cache\Watcher::CHECK_ONCE, \OC\Files\Cache\Watcher::CHECK_ALWAYS
- */
public function setPolicy($policy) {
$this->watchPolicy = $policy;
}
- /**
- * @return int either \OC\Files\Cache\Watcher::CHECK_NEVER, \OC\Files\Cache\Watcher::CHECK_ONCE, \OC\Files\Cache\Watcher::CHECK_ALWAYS
- */
public function getPolicy() {
return $this->watchPolicy;
}
- /**
- * check $path for updates and update if needed
- *
- * @param string $path
- * @param ICacheEntry|null $cachedEntry
- * @return boolean true if path was updated
- */
public function checkUpdate($path, $cachedEntry = null) {
if (is_null($cachedEntry)) {
$cachedEntry = $this->cache->get($path);
@@ -82,12 +68,6 @@ class Watcher implements IWatcher {
}
}
- /**
- * Update the cache for changes to $path
- *
- * @param string $path
- * @param ICacheEntry $cachedData
- */
public function update($path, $cachedData) {
if ($this->storage->is_dir($path)) {
$this->scanner->scan($path, Scanner::SCAN_SHALLOW);
@@ -102,13 +82,6 @@ class Watcher implements IWatcher {
}
}
- /**
- * Check if the cache for $path needs to be updated
- *
- * @param string $path
- * @param ICacheEntry $cachedData
- * @return bool
- */
public function needsUpdate($path, $cachedData) {
if ($this->watchPolicy === self::CHECK_ALWAYS or ($this->watchPolicy === self::CHECK_ONCE and !in_array($path, $this->checkedPaths))) {
$this->checkedPaths[] = $path;
@@ -117,11 +90,6 @@ class Watcher implements IWatcher {
return false;
}
- /**
- * remove deleted files in $path from the cache
- *
- * @param string $path
- */
public function cleanFolder($path) {
$cachedContent = $this->cache->getFolderContents($path);
foreach ($cachedContent as $entry) {
diff --git a/lib/private/Files/Config/CachedMountInfo.php b/lib/private/Files/Config/CachedMountInfo.php
index 80423dcae40..dc1504c943c 100644
--- a/lib/private/Files/Config/CachedMountInfo.php
+++ b/lib/private/Files/Config/CachedMountInfo.php
@@ -54,30 +54,18 @@ class CachedMountInfo implements ICachedMountInfo {
$this->key = $rootId . '::' . $mountPoint;
}
- /**
- * @return IUser
- */
public function getUser(): IUser {
return $this->user;
}
- /**
- * @return int the numeric storage id of the mount
- */
public function getStorageId(): int {
return $this->storageId;
}
- /**
- * @return int the fileid of the root of the mount
- */
public function getRootId(): int {
return $this->rootId;
}
- /**
- * @return Node|null the root node of the mount
- */
public function getMountPointNode(): ?Node {
// TODO injection etc
Filesystem::initMountPoints($this->getUser()->getUID());
@@ -85,28 +73,14 @@ class CachedMountInfo implements ICachedMountInfo {
return $userNode->getParent()->getFirstNodeById($this->getRootId());
}
- /**
- * @return string the mount point of the mount for the user
- */
public function getMountPoint(): string {
return $this->mountPoint;
}
- /**
- * Get the id of the configured mount
- *
- * @return int|null mount id or null if not applicable
- * @since 9.1.0
- */
public function getMountId(): ?int {
return $this->mountId;
}
- /**
- * Get the internal path (within the storage) of the root of the mount
- *
- * @return string
- */
public function getRootInternalPath(): string {
return $this->rootInternalPath;
}
diff --git a/lib/private/Files/Config/MountProviderCollection.php b/lib/private/Files/Config/MountProviderCollection.php
index 1dbc469c8c3..36e19854e46 100644
--- a/lib/private/Files/Config/MountProviderCollection.php
+++ b/lib/private/Files/Config/MountProviderCollection.php
@@ -138,13 +138,6 @@ class MountProviderCollection implements IMountProviderCollection, Emitter {
return array_merge($lateMounts, $firstMounts);
}
- /**
- * Get the configured home mount for this user
- *
- * @param \OCP\IUser $user
- * @return \OCP\Files\Mount\IMountPoint
- * @since 9.1.0
- */
public function getHomeMountForUser(IUser $user) {
/** @var \OCP\Files\Config\IHomeMountProvider[] $providers */
$providers = array_reverse($this->homeProviders); // call the latest registered provider first to give apps an opportunity to overwrite builtin
@@ -157,11 +150,6 @@ class MountProviderCollection implements IMountProviderCollection, Emitter {
throw new \Exception('No home storage configured for user ' . $user);
}
- /**
- * Add a provider for mount points
- *
- * @param \OCP\Files\Config\IMountProvider $provider
- */
public function registerProvider(IMountProvider $provider) {
$this->providers[] = $provider;
@@ -183,22 +171,11 @@ class MountProviderCollection implements IMountProviderCollection, Emitter {
});
}
- /**
- * Add a provider for home mount points
- *
- * @param \OCP\Files\Config\IHomeMountProvider $provider
- * @since 9.1.0
- */
public function registerHomeProvider(IHomeMountProvider $provider) {
$this->homeProviders[] = $provider;
$this->emit('\OC\Files\Config', 'registerHomeMountProvider', [$provider]);
}
- /**
- * Get the mount cache which can be used to search for mounts without setting up the filesystem
- *
- * @return IUserMountCache
- */
public function getMountCache() {
return $this->mountCache;
}
@@ -207,12 +184,6 @@ class MountProviderCollection implements IMountProviderCollection, Emitter {
$this->rootProviders[] = $provider;
}
- /**
- * Get all root mountpoints
- *
- * @return \OCP\Files\Mount\IMountPoint[]
- * @since 20.0.0
- */
public function getRootMounts(): array {
$loader = $this->loader;
$mounts = array_map(function (IRootMountProvider $provider) use ($loader) {
diff --git a/lib/private/Files/Config/UserMountCache.php b/lib/private/Files/Config/UserMountCache.php
index 94da770b63f..e3a41131af0 100644
--- a/lib/private/Files/Config/UserMountCache.php
+++ b/lib/private/Files/Config/UserMountCache.php
@@ -11,7 +11,6 @@ use OC\User\LazyUser;
use OCP\Cache\CappedMemoryCache;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Diagnostics\IEventLogger;
-use OCP\Files\Config\ICachedMountFileInfo;
use OCP\Files\Config\ICachedMountInfo;
use OCP\Files\Config\IUserMountCache;
use OCP\Files\NotFoundException;
@@ -224,10 +223,6 @@ class UserMountCache implements IUserMountCache {
}
}
- /**
- * @param IUser $user
- * @return ICachedMountInfo[]
- */
public function getMountsForUser(IUser $user) {
$userUID = $user->getUID();
if (!$this->userManager->userExists($userUID)) {
@@ -268,11 +263,6 @@ class UserMountCache implements IUserMountCache {
return $query->executeQuery()->fetchOne() ?: '';
}
- /**
- * @param int $numericStorageId
- * @param string|null $user limit the results to a single user
- * @return CachedMountInfo[]
- */
public function getMountsForStorageId($numericStorageId, $user = null) {
$builder = $this->connection->getQueryBuilder();
$query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point', 'mount_id', 'f.path', 'mount_provider_class')
@@ -291,10 +281,6 @@ class UserMountCache implements IUserMountCache {
return array_filter(array_map([$this, 'dbRowToMountInfo'], $rows));
}
- /**
- * @param int $rootFileId
- * @return CachedMountInfo[]
- */
public function getMountsForRootId($rootFileId) {
$builder = $this->connection->getQueryBuilder();
$query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point', 'mount_id', 'f.path', 'mount_provider_class')
@@ -338,12 +324,6 @@ class UserMountCache implements IUserMountCache {
return $this->cacheInfoCache[$fileId];
}
- /**
- * @param int $fileId
- * @param string|null $user optionally restrict the results to a single user
- * @return ICachedMountFileInfo[]
- * @since 9.0.0
- */
public function getMountsForFileId($fileId, $user = null) {
try {
[$storageId, $internalPath] = $this->getCacheInfoFromFileId($fileId);
@@ -380,11 +360,6 @@ class UserMountCache implements IUserMountCache {
}, $filteredMounts);
}
- /**
- * Remove all cached mounts for a user
- *
- * @param IUser $user
- */
public function removeUserMounts(IUser $user) {
$builder = $this->connection->getQueryBuilder();
@@ -410,10 +385,6 @@ class UserMountCache implements IUserMountCache {
$query->execute();
}
- /**
- * @param array $users
- * @return array
- */
public function getUsedSpaceForUsers(array $users) {
$builder = $this->connection->getQueryBuilder();
diff --git a/lib/private/Files/FileInfo.php b/lib/private/Files/FileInfo.php
index 0679dc1ae72..b31387574aa 100644
--- a/lib/private/Files/FileInfo.php
+++ b/lib/private/Files/FileInfo.php
@@ -106,9 +106,6 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
};
}
- /**
- * @return string
- */
public function getPath() {
return $this->path;
}
@@ -117,48 +114,28 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
return $this->storage;
}
- /**
- * @return string
- */
public function getInternalPath() {
return $this->internalPath;
}
- /**
- * Get FileInfo ID or null in case of part file
- *
- * @return int|null
- */
public function getId() {
return isset($this->data['fileid']) ? (int)$this->data['fileid'] : null;
}
- /**
- * @return string
- */
public function getMimetype() {
return $this->data['mimetype'];
}
- /**
- * @return string
- */
public function getMimePart() {
return $this->data['mimepart'];
}
- /**
- * @return string
- */
public function getName() {
return empty($this->data['name'])
? basename($this->getPath())
: $this->data['name'];
}
- /**
- * @return string
- */
public function getEtag() {
$this->updateEntryFromSubMounts();
if (count($this->childEtags) > 0) {
@@ -169,10 +146,6 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
}
}
- /**
- * @param bool $includeMounts
- * @return int|float
- */
public function getSize($includeMounts = true) {
if ($includeMounts) {
$this->updateEntryFromSubMounts();
@@ -187,17 +160,11 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
}
}
- /**
- * @return int
- */
public function getMTime() {
$this->updateEntryFromSubMounts();
return (int)$this->data['mtime'];
}
- /**
- * @return bool
- */
public function isEncrypted() {
return $this->data['encrypted'] ?? false;
}
@@ -209,16 +176,10 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
return isset($this->data['encryptedVersion']) ? (int)$this->data['encryptedVersion'] : 1;
}
- /**
- * @return int
- */
public function getPermissions() {
return (int)$this->data['permissions'];
}
- /**
- * @return string \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER
- */
public function getType() {
if (!isset($this->data['type'])) {
$this->data['type'] = ($this->getMimetype() === self::MIMETYPE_FOLDER) ? self::TYPE_FOLDER : self::TYPE_FILE;
@@ -238,48 +199,26 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
return ($this->getPermissions() & $permissions) === $permissions;
}
- /**
- * @return bool
- */
public function isReadable() {
return $this->checkPermissions(\OCP\Constants::PERMISSION_READ);
}
- /**
- * @return bool
- */
public function isUpdateable() {
return $this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE);
}
- /**
- * Check whether new files or folders can be created inside this folder
- *
- * @return bool
- */
public function isCreatable() {
return $this->checkPermissions(\OCP\Constants::PERMISSION_CREATE);
}
- /**
- * @return bool
- */
public function isDeletable() {
return $this->checkPermissions(\OCP\Constants::PERMISSION_DELETE);
}
- /**
- * @return bool
- */
public function isShareable() {
return $this->checkPermissions(\OCP\Constants::PERMISSION_SHARE);
}
- /**
- * Check if a file or folder is shared
- *
- * @return bool
- */
public function isShared() {
return $this->mount instanceof ISharedMountPoint;
}
@@ -289,20 +228,10 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
return !$isHome && !$this->isShared();
}
- /**
- * Get the mountpoint the file belongs to
- *
- * @return \OCP\Files\Mount\IMountPoint
- */
public function getMountPoint() {
return $this->mount;
}
- /**
- * Get the owner of the file
- *
- * @return ?IUser
- */
public function getOwner() {
return $this->owner;
}
@@ -363,9 +292,6 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
}
}
- /**
- * @inheritdoc
- */
public function getChecksum() {
return $this->data['checksum'];
}
@@ -386,10 +312,6 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
return $this->data['parent'] ?? -1;
}
- /**
- * @inheritDoc
- * @return array<string, int|string|bool|float|string[]|int[]>
- */
public function getMetadata(): array {
return $this->data['metadata'] ?? [];
}
diff --git a/lib/private/Files/FilenameValidator.php b/lib/private/Files/FilenameValidator.php
index fde45068df7..96e0c736c3b 100644
--- a/lib/private/Files/FilenameValidator.php
+++ b/lib/private/Files/FilenameValidator.php
@@ -156,9 +156,6 @@ class FilenameValidator implements IFilenameValidator {
return $this->forbiddenCharacters;
}
- /**
- * @inheritdoc
- */
public function isFilenameValid(string $filename): bool {
try {
$this->validateFilename($filename);
@@ -168,9 +165,6 @@ class FilenameValidator implements IFilenameValidator {
return true;
}
- /**
- * @inheritdoc
- */
public function validateFilename(string $filename): void {
$trimmed = trim($filename);
if ($trimmed === '') {
diff --git a/lib/private/Files/Mount/CacheMountProvider.php b/lib/private/Files/Mount/CacheMountProvider.php
index 27c7eec9da3..44b3f6a63f0 100644
--- a/lib/private/Files/Mount/CacheMountProvider.php
+++ b/lib/private/Files/Mount/CacheMountProvider.php
@@ -30,13 +30,6 @@ class CacheMountProvider implements IMountProvider {
$this->config = $config;
}
- /**
- * Get the cache mount for a user
- *
- * @param IUser $user
- * @param IStorageFactory $loader
- * @return \OCP\Files\Mount\IMountPoint[]
- */
public function getMountsForUser(IUser $user, IStorageFactory $loader) {
$cacheBaseDir = $this->config->getSystemValueString('cache_path', '');
if ($cacheBaseDir !== '') {
diff --git a/lib/private/Files/Mount/LocalHomeMountProvider.php b/lib/private/Files/Mount/LocalHomeMountProvider.php
index a2b3d3b2a99..daf4485fed6 100644
--- a/lib/private/Files/Mount/LocalHomeMountProvider.php
+++ b/lib/private/Files/Mount/LocalHomeMountProvider.php
@@ -15,13 +15,6 @@ use OCP\IUser;
* Mount provider for regular posix home folders
*/
class LocalHomeMountProvider implements IHomeMountProvider {
- /**
- * Get the cache mount for a user
- *
- * @param IUser $user
- * @param IStorageFactory $loader
- * @return \OCP\Files\Mount\IMountPoint|null
- */
public function getHomeMountForUser(IUser $user, IStorageFactory $loader) {
$arguments = ['user' => $user];
return new HomeMountPoint($user, '\OC\Files\Storage\Home', '/' . $user->getUID(), $arguments, $loader, null, null, self::class);
diff --git a/lib/private/Files/Mount/Manager.php b/lib/private/Files/Mount/Manager.php
index d118021afa2..2cf5b0b23b2 100644
--- a/lib/private/Files/Mount/Manager.php
+++ b/lib/private/Files/Mount/Manager.php
@@ -32,18 +32,12 @@ class Manager implements IMountManager {
$this->setupManager = $setupManagerFactory->create($this);
}
- /**
- * @param IMountPoint $mount
- */
public function addMount(IMountPoint $mount) {
$this->mounts[$mount->getMountPoint()] = $mount;
$this->pathCache->clear();
$this->inPathCache->clear();
}
- /**
- * @param string $mountPoint
- */
public function removeMount(string $mountPoint) {
$mountPoint = Filesystem::normalizePath($mountPoint);
if (\strlen($mountPoint) > 1) {
@@ -54,10 +48,6 @@ class Manager implements IMountManager {
$this->inPathCache->clear();
}
- /**
- * @param string $mountPoint
- * @param string $target
- */
public function moveMount(string $mountPoint, string $target) {
$this->mounts[$target] = $this->mounts[$mountPoint];
unset($this->mounts[$mountPoint]);
@@ -65,12 +55,6 @@ class Manager implements IMountManager {
$this->inPathCache->clear();
}
- /**
- * Find the mount for $path
- *
- * @param string $path
- * @return IMountPoint
- */
public function find(string $path): IMountPoint {
$this->setupManager->setupForPath($path);
$path = Filesystem::normalizePath($path);
@@ -107,12 +91,6 @@ class Manager implements IMountManager {
throw new NotFoundException('No mount for path ' . $path . ' existing mounts (' . count($this->mounts) .'): ' . implode(',', array_keys($this->mounts)));
}
- /**
- * Find all mounts in $path
- *
- * @param string $path
- * @return IMountPoint[]
- */
public function findIn(string $path): array {
$this->setupManager->setupForPath($path, true);
$path = $this->formatPath($path);
@@ -140,12 +118,6 @@ class Manager implements IMountManager {
$this->inPathCache->clear();
}
- /**
- * Find mounts by storage id
- *
- * @param string $id
- * @return IMountPoint[]
- */
public function findByStorageId(string $id): array {
if (\strlen($id) > 64) {
$id = md5($id);
@@ -159,19 +131,10 @@ class Manager implements IMountManager {
return $result;
}
- /**
- * @return IMountPoint[]
- */
public function getAll(): array {
return $this->mounts;
}
- /**
- * Find mounts by numeric storage id
- *
- * @param int $id
- * @return IMountPoint[]
- */
public function findByNumericId(int $id): array {
$result = [];
foreach ($this->mounts as $mount) {
@@ -216,13 +179,6 @@ class Manager implements IMountManager {
}
}
- /**
- * Return the mount matching a cached mount info (or mount file info)
- *
- * @param ICachedMountInfo $info
- *
- * @return IMountPoint|null
- */
public function getMountFromMountInfo(ICachedMountInfo $info): ?IMountPoint {
$this->setupManager->setupForPath($info->getMountPoint());
foreach ($this->mounts as $mount) {
diff --git a/lib/private/Files/Mount/MountPoint.php b/lib/private/Files/Mount/MountPoint.php
index cb3a3e8a22d..a71855a5f92 100644
--- a/lib/private/Files/Mount/MountPoint.php
+++ b/lib/private/Files/Mount/MountPoint.php
@@ -112,20 +112,10 @@ class MountPoint implements IMountPoint {
$this->mountProvider = $mountProvider ?? '';
}
- /**
- * get complete path to the mount point, relative to data/
- *
- * @return string
- */
public function getMountPoint() {
return $this->mountPoint;
}
- /**
- * Sets the mount point path, relative to data/
- *
- * @param string $mountPoint new mount point
- */
public function setMountPoint($mountPoint) {
$this->mountPoint = $this->formatPath($mountPoint);
}
@@ -162,9 +152,6 @@ class MountPoint implements IMountPoint {
}
}
- /**
- * @return \OC\Files\Storage\Storage|null
- */
public function getStorage() {
if (is_null($this->storage)) {
$this->createStorage();
@@ -172,9 +159,6 @@ class MountPoint implements IMountPoint {
return $this->storage;
}
- /**
- * @return string|null
- */
public function getStorageId() {
if (!$this->storageId) {
$storage = $this->getStorage();
@@ -189,9 +173,6 @@ class MountPoint implements IMountPoint {
return $this->storageId;
}
- /**
- * @return int
- */
public function getNumericStorageId() {
if (is_null($this->numericStorageId)) {
$storage = $this->getStorage();
@@ -203,10 +184,6 @@ class MountPoint implements IMountPoint {
return $this->numericStorageId;
}
- /**
- * @param string $path
- * @return string
- */
public function getInternalPath($path) {
$path = Filesystem::normalizePath($path, true, false, true);
if ($this->mountPoint === $path or $this->mountPoint . '/' === $path) {
@@ -230,9 +207,6 @@ class MountPoint implements IMountPoint {
return $path;
}
- /**
- * @param callable $wrapper
- */
public function wrapStorage($wrapper) {
$storage = $this->getStorage();
// storage can be null if it couldn't be initialized
@@ -241,31 +215,14 @@ class MountPoint implements IMountPoint {
}
}
- /**
- * Get a mount option
- *
- * @param string $name Name of the mount option to get
- * @param mixed $default Default value for the mount option
- * @return mixed
- */
public function getOption($name, $default) {
return $this->mountOptions[$name] ?? $default;
}
- /**
- * Get all options for the mount
- *
- * @return array
- */
public function getOptions() {
return $this->mountOptions;
}
- /**
- * Get the file id of the root of the storage
- *
- * @return int
- */
public function getStorageRootId() {
if (is_null($this->rootId) || $this->rootId === -1) {
$storage = $this->getStorage();
diff --git a/lib/private/Files/Mount/ObjectHomeMountProvider.php b/lib/private/Files/Mount/ObjectHomeMountProvider.php
index 99c52108fa8..5b37b86733b 100644
--- a/lib/private/Files/Mount/ObjectHomeMountProvider.php
+++ b/lib/private/Files/Mount/ObjectHomeMountProvider.php
@@ -31,13 +31,6 @@ class ObjectHomeMountProvider implements IHomeMountProvider {
$this->config = $config;
}
- /**
- * Get the cache mount for a user
- *
- * @param IUser $user
- * @param IStorageFactory $loader
- * @return \OCP\Files\Mount\IMountPoint
- */
public function getHomeMountForUser(IUser $user, IStorageFactory $loader) {
$config = $this->getMultiBucketObjectStoreConfig($user);
if ($config === null) {
diff --git a/lib/private/Files/Mount/ObjectStorePreviewCacheMountProvider.php b/lib/private/Files/Mount/ObjectStorePreviewCacheMountProvider.php
index 1546ef98f50..b6e24b0e4df 100644
--- a/lib/private/Files/Mount/ObjectStorePreviewCacheMountProvider.php
+++ b/lib/private/Files/Mount/ObjectStorePreviewCacheMountProvider.php
@@ -29,10 +29,6 @@ class ObjectStorePreviewCacheMountProvider implements IRootMountProvider {
$this->config = $config;
}
- /**
- * @return MountPoint[]
- * @throws \Exception
- */
public function getRootMounts(IStorageFactory $loader): array {
if (!is_array($this->config->getSystemValue('objectstore_multibucket'))) {
return [];
diff --git a/lib/private/Files/Node/File.php b/lib/private/Files/Node/File.php
index eb6411d7d13..9ee6e90ede7 100644
--- a/lib/private/Files/Node/File.php
+++ b/lib/private/Files/Node/File.php
@@ -9,7 +9,6 @@ namespace OC\Files\Node;
use OCP\Files\GenericFileException;
use OCP\Files\NotPermittedException;
-use OCP\Lock\LockedException;
class File extends Node implements \OCP\Files\File {
/**
@@ -22,12 +21,6 @@ class File extends Node implements \OCP\Files\File {
return new NonExistingFile($this->root, $this->view, $path);
}
- /**
- * @return string
- * @throws NotPermittedException
- * @throws GenericFileException
- * @throws LockedException
- */
public function getContent() {
if ($this->checkPermissions(\OCP\Constants::PERMISSION_READ)) {
$content = $this->view->file_get_contents($this->path);
@@ -40,12 +33,6 @@ class File extends Node implements \OCP\Files\File {
}
}
- /**
- * @param string|resource $data
- * @throws NotPermittedException
- * @throws GenericFileException
- * @throws LockedException
- */
public function putContent($data) {
if ($this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE)) {
$this->sendHooks(['preWrite']);
@@ -59,12 +46,6 @@ class File extends Node implements \OCP\Files\File {
}
}
- /**
- * @param string $mode
- * @return resource|false
- * @throws NotPermittedException
- * @throws LockedException
- */
public function fopen($mode) {
$preHooks = [];
$postHooks = [];
@@ -100,11 +81,6 @@ class File extends Node implements \OCP\Files\File {
}
}
- /**
- * @throws NotPermittedException
- * @throws \OCP\Files\InvalidPathException
- * @throws \OCP\Files\NotFoundException
- */
public function delete() {
if ($this->checkPermissions(\OCP\Constants::PERMISSION_DELETE)) {
$this->sendHooks(['preDelete']);
@@ -118,18 +94,10 @@ class File extends Node implements \OCP\Files\File {
}
}
- /**
- * @param string $type
- * @param bool $raw
- * @return string
- */
public function hash($type, $raw = false) {
return $this->view->hash($type, $this->path, $raw);
}
- /**
- * @inheritdoc
- */
public function getChecksum() {
return $this->getFileInfo()->getChecksum();
}
diff --git a/lib/private/Files/Node/Folder.php b/lib/private/Files/Node/Folder.php
index ca256b09d33..2302b57f052 100644
--- a/lib/private/Files/Node/Folder.php
+++ b/lib/private/Files/Node/Folder.php
@@ -40,11 +40,6 @@ class Folder extends Node implements \OCP\Files\Folder {
return new NonExistingFolder($this->root, $this->view, $path);
}
- /**
- * @param string $path path relative to the folder
- * @return string
- * @throws \OCP\Files\NotPermittedException
- */
public function getFullPath($path) {
$path = $this->normalizePath($path);
if (!$this->isValidPath($path)) {
@@ -53,30 +48,14 @@ class Folder extends Node implements \OCP\Files\Folder {
return $this->path . $path;
}
- /**
- * @param string $path
- * @return string|null
- */
public function getRelativePath($path) {
return PathHelper::getRelativePath($this->getPath(), $path);
}
- /**
- * check if a node is a (grand-)child of the folder
- *
- * @param \OC\Files\Node\Node $node
- * @return bool
- */
public function isSubNode($node) {
return str_starts_with($node->getPath(), $this->path . '/');
}
- /**
- * get the content of this directory
- *
- * @return Node[]
- * @throws \OCP\Files\NotFoundException
- */
public function getDirectoryListing() {
$folderContent = $this->view->getDirectoryContent($this->path, '', $this->getFileInfo(false));
@@ -103,21 +82,10 @@ class Folder extends Node implements \OCP\Files\Folder {
}
}
- /**
- * Get the node at $path
- *
- * @param string $path
- * @return \OC\Files\Node\Node
- * @throws \OCP\Files\NotFoundException
- */
public function get($path) {
return $this->root->get($this->getFullPath($path));
}
- /**
- * @param string $path
- * @return bool
- */
public function nodeExists($path) {
try {
$this->get($path);
@@ -127,11 +95,6 @@ class Folder extends Node implements \OCP\Files\Folder {
}
}
- /**
- * @param string $path
- * @return \OC\Files\Node\Folder
- * @throws \OCP\Files\NotPermittedException
- */
public function newFolder($path) {
if ($this->checkPermissions(\OCP\Constants::PERMISSION_CREATE)) {
$fullPath = $this->getFullPath($path);
@@ -149,12 +112,6 @@ class Folder extends Node implements \OCP\Files\Folder {
}
}
- /**
- * @param string $path
- * @param string | resource | null $content
- * @return \OC\Files\Node\File
- * @throws \OCP\Files\NotPermittedException
- */
public function newFile($path, $content = null) {
if ($path === '') {
throw new NotPermittedException('Could not create as provided path is empty');
@@ -189,12 +146,6 @@ class Folder extends Node implements \OCP\Files\Folder {
return new SearchQuery($operator, $limit, $offset, [], $user);
}
- /**
- * search for files with the name matching $query
- *
- * @param string|ISearchQuery $query
- * @return \OC\Files\Node\Node[]
- */
public function search($query) {
if (is_string($query)) {
$query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', '%' . $query . '%'));
@@ -271,12 +222,6 @@ class Folder extends Node implements \OCP\Files\Folder {
);
}
- /**
- * search for files by mimetype
- *
- * @param string $mimetype
- * @return Node[]
- */
public function searchByMime($mimetype) {
if (!str_contains($mimetype, '/')) {
$query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', $mimetype . '/%'));
@@ -286,13 +231,6 @@ class Folder extends Node implements \OCP\Files\Folder {
return $this->search($query);
}
- /**
- * search for files by tag
- *
- * @param string|int $tag name or tag id
- * @param string $userId owner of the tags
- * @return Node[]
- */
public function searchByTag($tag, $userId) {
$query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'tagname', $tag), $userId);
return $this->search($query);
@@ -303,10 +241,6 @@ class Folder extends Node implements \OCP\Files\Folder {
return $this->search($query);
}
- /**
- * @param int $id
- * @return \OCP\Files\Node[]
- */
public function getById($id) {
return $this->root->getByIdInPath((int)$id, $this->getPath());
}
@@ -379,23 +313,11 @@ class Folder extends Node implements \OCP\Files\Folder {
}
}
- /**
- * Add a suffix to the name in case the file exists
- *
- * @param string $name
- * @return string
- * @throws NotPermittedException
- */
public function getNonExistingName($name) {
$uniqueName = \OC_Helper::buildNotExistingFileNameForView($this->getPath(), $name, $this->view);
return trim($this->getRelativePath($uniqueName), '/');
}
- /**
- * @param int $limit
- * @param int $offset
- * @return INode[]
- */
public function getRecent($limit, $offset = 0) {
$filterOutNonEmptyFolder = new SearchBinaryOperator(
// filter out non empty folders
diff --git a/lib/private/Files/Node/LazyFolder.php b/lib/private/Files/Node/LazyFolder.php
index 83ed7e534a7..028368483fe 100644
--- a/lib/private/Files/Node/LazyFolder.php
+++ b/lib/private/Files/Node/LazyFolder.php
@@ -134,9 +134,6 @@ class LazyFolder implements Folder {
$this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function get($path) {
return $this->getRootFolder()->get($this->getFullPath($path));
}
@@ -148,37 +145,22 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function delete() {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function copy($targetPath) {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function touch($mtime = null) {
$this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function getStorage() {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function getPath() {
if (isset($this->data['path'])) {
return $this->data['path'];
@@ -186,16 +168,10 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function getInternalPath() {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function getId() {
if (isset($this->data['fileid'])) {
return $this->data['fileid'];
@@ -203,16 +179,10 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function stat() {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function getMTime() {
if (isset($this->data['mtime'])) {
return $this->data['mtime'];
@@ -220,9 +190,6 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function getSize($includeMounts = true): int|float {
if (isset($this->data['size'])) {
return $this->data['size'];
@@ -230,9 +197,6 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function getEtag() {
if (isset($this->data['etag'])) {
return $this->data['etag'];
@@ -240,9 +204,6 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function getPermissions() {
if (isset($this->data['permissions'])) {
return $this->data['permissions'];
@@ -250,9 +211,6 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function isReadable() {
if (isset($this->data['permissions'])) {
return ($this->data['permissions'] & Constants::PERMISSION_READ) == Constants::PERMISSION_READ;
@@ -260,9 +218,6 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function isUpdateable() {
if (isset($this->data['permissions'])) {
return ($this->data['permissions'] & Constants::PERMISSION_UPDATE) == Constants::PERMISSION_UPDATE;
@@ -270,9 +225,6 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function isDeletable() {
if (isset($this->data['permissions'])) {
return ($this->data['permissions'] & Constants::PERMISSION_DELETE) == Constants::PERMISSION_DELETE;
@@ -280,9 +232,6 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function isShareable() {
if (isset($this->data['permissions'])) {
return ($this->data['permissions'] & Constants::PERMISSION_SHARE) == Constants::PERMISSION_SHARE;
@@ -290,16 +239,10 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function getParent() {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function getName() {
if (isset($this->data['path'])) {
return basename($this->data['path']);
@@ -317,9 +260,6 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function getMimetype() {
if (isset($this->data['mimetype'])) {
return $this->data['mimetype'];
@@ -327,9 +267,6 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function getMimePart() {
if (isset($this->data['mimetype'])) {
[$part,] = explode('/', $this->data['mimetype']);
@@ -338,16 +275,10 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function isEncrypted() {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function getType() {
if (isset($this->data['type'])) {
return $this->data['type'];
@@ -355,37 +286,22 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function isShared() {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function isMounted() {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function getMountPoint() {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function getOwner() {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function getChecksum() {
return $this->__call(__FUNCTION__, func_get_args());
}
@@ -394,9 +310,6 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function getFullPath($path) {
if (isset($this->data['path'])) {
$path = PathHelper::normalizePath($path);
@@ -408,58 +321,34 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function isSubNode($node) {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function getDirectoryListing() {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function nodeExists($path) {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function newFolder($path) {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function newFile($path, $content = null) {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function search($query) {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function searchByMime($mimetype) {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function searchByTag($tag, $userId) {
return $this->__call(__FUNCTION__, func_get_args());
}
@@ -468,9 +357,6 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function getById($id) {
return $this->getRootFolder()->getByIdInPath((int)$id, $this->getPath());
}
@@ -479,72 +365,42 @@ class LazyFolder implements Folder {
return $this->getRootFolder()->getFirstNodeByIdInPath($id, $this->getPath());
}
- /**
- * @inheritDoc
- */
public function getFreeSpace() {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function isCreatable() {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function getNonExistingName($name) {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function move($targetPath) {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function lock($type) {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function changeLock($targetType) {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function unlock($type) {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function getRecent($limit, $offset = 0) {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function getCreationTime(): int {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- */
public function getUploadTime(): int {
return $this->__call(__FUNCTION__, func_get_args());
}
@@ -560,10 +416,6 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
- /**
- * @inheritDoc
- * @return array<string, int|string|bool|float|string[]|int[]>
- */
public function getMetadata(): array {
return $this->data['metadata'] ?? $this->__call(__FUNCTION__, func_get_args());
}
diff --git a/lib/private/Files/Node/Node.php b/lib/private/Files/Node/Node.php
index 5dbdc4054bf..66c74a8158e 100644
--- a/lib/private/Files/Node/Node.php
+++ b/lib/private/Files/Node/Node.php
@@ -18,7 +18,6 @@ use OCP\Files\IRootFolder;
use OCP\Files\Node as INode;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
-use OCP\Lock\LockedException;
use OCP\PreConditionNotMetException;
// FIXME: this class really should be abstract (+1)
@@ -133,12 +132,6 @@ class Node implements INode {
public function delete() {
}
- /**
- * @param int $mtime
- * @throws InvalidPathException
- * @throws NotFoundException
- * @throws NotPermittedException
- */
public function touch($mtime = null) {
if ($this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE)) {
$this->sendHooks(['preTouch']);
@@ -163,114 +156,54 @@ class Node implements INode {
return $storage;
}
- /**
- * @return string
- */
public function getPath() {
return $this->path;
}
- /**
- * @return string
- */
public function getInternalPath() {
return $this->getFileInfo(false)->getInternalPath();
}
- /**
- * @return int
- * @throws InvalidPathException
- * @throws NotFoundException
- */
public function getId() {
return $this->getFileInfo(false)->getId() ?? -1;
}
- /**
- * @return array
- */
public function stat() {
return $this->view->stat($this->path);
}
- /**
- * @return int
- * @throws InvalidPathException
- * @throws NotFoundException
- */
public function getMTime() {
return $this->getFileInfo()->getMTime();
}
- /**
- * @param bool $includeMounts
- * @return int|float
- * @throws InvalidPathException
- * @throws NotFoundException
- */
public function getSize($includeMounts = true): int|float {
return $this->getFileInfo()->getSize($includeMounts);
}
- /**
- * @return string
- * @throws InvalidPathException
- * @throws NotFoundException
- */
public function getEtag() {
return $this->getFileInfo()->getEtag();
}
- /**
- * @return int
- * @throws InvalidPathException
- * @throws NotFoundException
- */
public function getPermissions() {
return $this->getFileInfo(false)->getPermissions();
}
- /**
- * @return bool
- * @throws InvalidPathException
- * @throws NotFoundException
- */
public function isReadable() {
return $this->getFileInfo(false)->isReadable();
}
- /**
- * @return bool
- * @throws InvalidPathException
- * @throws NotFoundException
- */
public function isUpdateable() {
return $this->getFileInfo(false)->isUpdateable();
}
- /**
- * @return bool
- * @throws InvalidPathException
- * @throws NotFoundException
- */
public function isDeletable() {
return $this->getFileInfo(false)->isDeletable();
}
- /**
- * @return bool
- * @throws InvalidPathException
- * @throws NotFoundException
- */
public function isShareable() {
return $this->getFileInfo(false)->isShareable();
}
- /**
- * @return bool
- * @throws InvalidPathException
- * @throws NotFoundException
- */
public function isCreatable() {
return $this->getFileInfo(false)->isCreatable();
}
@@ -306,9 +239,6 @@ class Node implements INode {
return $this->parent;
}
- /**
- * @return string
- */
public function getName() {
return basename($this->path);
}
@@ -370,37 +300,18 @@ class Node implements INode {
return $this->getFileInfo(false)->getExtension();
}
- /**
- * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
- * @throws LockedException
- */
public function lock($type) {
$this->view->lockFile($this->path, $type);
}
- /**
- * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
- * @throws LockedException
- */
public function changeLock($type) {
$this->view->changeLock($this->path, $type);
}
- /**
- * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
- * @throws LockedException
- */
public function unlock($type) {
$this->view->unlockFile($this->path, $type);
}
- /**
- * @param string $targetPath
- * @return INode
- * @throws InvalidPathException
- * @throws NotFoundException
- * @throws NotPermittedException if copy not allowed or failed
- */
public function copy($targetPath) {
$targetPath = $this->normalizePath($targetPath);
$parent = $this->root->get(dirname($targetPath));
@@ -420,14 +331,6 @@ class Node implements INode {
}
}
- /**
- * @param string $targetPath
- * @return INode
- * @throws InvalidPathException
- * @throws NotFoundException
- * @throws NotPermittedException if move not allowed or failed
- * @throws LockedException
- */
public function move($targetPath) {
$targetPath = $this->normalizePath($targetPath);
$parent = $this->root->get(dirname($targetPath));
@@ -479,10 +382,6 @@ class Node implements INode {
return $this->fileInfo->getParentId();
}
- /**
- * @inheritDoc
- * @return array<string, int|string|bool|float|string[]|int[]>
- */
public function getMetadata(): array {
return $this->fileInfo->getMetadata();
}
diff --git a/lib/private/Files/Node/Root.php b/lib/private/Files/Node/Root.php
index 416adc7f374..755167f0eb4 100644
--- a/lib/private/Files/Node/Root.php
+++ b/lib/private/Files/Node/Root.php
@@ -98,20 +98,10 @@ class Root extends Folder implements IRootFolder {
return $this->user;
}
- /**
- * @param string $scope
- * @param string $method
- * @param callable $callback
- */
public function listen($scope, $method, callable $callback) {
$this->emitter->listen($scope, $method, $callback);
}
- /**
- * @param string $scope optional
- * @param string $method optional
- * @param callable $callback optional
- */
public function removeListener($scope = null, $method = null, ?callable $callback = null) {
$this->emitter->removeListener($scope, $method, $callback);
}
@@ -139,10 +129,6 @@ class Root extends Folder implements IRootFolder {
return $this->mountManager->find($mountPoint);
}
- /**
- * @param string $mountPoint
- * @return \OC\Files\Mount\MountPoint[]
- */
public function getMountsIn(string $mountPoint): array {
return $this->mountManager->findIn($mountPoint);
}
@@ -170,12 +156,6 @@ class Root extends Folder implements IRootFolder {
$this->mountManager->remove($mount);
}
- /**
- * @param string $path
- * @return Node
- * @throws \OCP\Files\NotPermittedException
- * @throws \OCP\Files\NotFoundException
- */
public function get($path) {
$path = $this->normalizePath($path);
if ($this->isValidPath($path)) {
@@ -206,138 +186,74 @@ class Root extends Folder implements IRootFolder {
throw new NotPermittedException();
}
- /**
- * @param string $targetPath
- * @return Node
- * @throws \OCP\Files\NotPermittedException
- */
public function copy($targetPath) {
throw new NotPermittedException();
}
- /**
- * @param int $mtime
- * @throws \OCP\Files\NotPermittedException
- */
public function touch($mtime = null) {
throw new NotPermittedException();
}
- /**
- * @return \OC\Files\Storage\Storage
- * @throws \OCP\Files\NotFoundException
- */
public function getStorage() {
throw new NotFoundException();
}
- /**
- * @return string
- */
public function getPath() {
return '/';
}
- /**
- * @return string
- */
public function getInternalPath() {
return '';
}
- /**
- * @return int
- */
public function getId() {
return 0;
}
- /**
- * @return array
- */
public function stat() {
return [];
}
- /**
- * @return int
- */
public function getMTime() {
return 0;
}
- /**
- * @param bool $includeMounts
- * @return int|float
- */
public function getSize($includeMounts = true): int|float {
return 0;
}
- /**
- * @return string
- */
public function getEtag() {
return '';
}
- /**
- * @return int
- */
public function getPermissions() {
return \OCP\Constants::PERMISSION_CREATE;
}
- /**
- * @return bool
- */
public function isReadable() {
return false;
}
- /**
- * @return bool
- */
public function isUpdateable() {
return false;
}
- /**
- * @return bool
- */
public function isDeletable() {
return false;
}
- /**
- * @return bool
- */
public function isShareable() {
return false;
}
- /**
- * @throws \OCP\Files\NotFoundException
- */
public function getParent(): INode|IRootFolder {
throw new NotFoundException();
}
- /**
- * @return string
- */
public function getName() {
return '';
}
- /**
- * Returns a view to user's files folder
- *
- * @param string $userId user ID
- * @return \OCP\Files\Folder
- * @throws NoUserException
- * @throws NotPermittedException
- */
public function getUserFolder($userId) {
$userObject = $this->userManager->get($userId);
@@ -410,10 +326,6 @@ class Root extends Folder implements IRootFolder {
return $node;
}
- /**
- * @param int $id
- * @return Node[]
- */
public function getByIdInPath(int $id, string $path): array {
$mountCache = $this->getUserMountCache();
if (strpos($path, '/', 1) > 0) {
diff --git a/lib/private/Files/Notify/Change.php b/lib/private/Files/Notify/Change.php
index d2448e5deec..cbffffc75ef 100644
--- a/lib/private/Files/Notify/Change.php
+++ b/lib/private/Files/Notify/Change.php
@@ -25,22 +25,10 @@ class Change implements IChange {
$this->path = $path;
}
- /**
- * Get the type of the change
- *
- * @return int IChange::ADDED, IChange::REMOVED, IChange::MODIFIED or IChange::RENAMED
- */
public function getType() {
return $this->type;
}
- /**
- * Get the path of the file that was changed relative to the root of the storage
- *
- * Note, for rename changes this path is the old path for the file
- *
- * @return mixed
- */
public function getPath() {
return $this->path;
}
diff --git a/lib/private/Files/Notify/RenameChange.php b/lib/private/Files/Notify/RenameChange.php
index 98fd7099a58..ab3bfe1b7ef 100644
--- a/lib/private/Files/Notify/RenameChange.php
+++ b/lib/private/Files/Notify/RenameChange.php
@@ -23,11 +23,6 @@ class RenameChange extends Change implements IRenameChange {
$this->targetPath = $targetPath;
}
- /**
- * Get the new path of the renamed file relative to the storage root
- *
- * @return string
- */
public function getTargetPath() {
return $this->targetPath;
}
diff --git a/lib/private/Files/ObjectStore/Azure.php b/lib/private/Files/ObjectStore/Azure.php
index 2dacdac1f8d..9359289da04 100644
--- a/lib/private/Files/ObjectStore/Azure.php
+++ b/lib/private/Files/ObjectStore/Azure.php
@@ -66,18 +66,10 @@ class Azure implements IObjectStore {
return $this->blobClient;
}
- /**
- * @return string the container or bucket name where objects are stored
- */
public function getStorageId() {
return 'azure::blob::' . $this->containerName;
}
- /**
- * @param string $urn the unified resource name used to identify the object
- * @return resource stream with the read data
- * @throws \Exception when something goes wrong, message will be logged
- */
public function readObject($urn) {
$blob = $this->getBlobClient()->getBlob($this->containerName, $urn);
return $blob->getContentStream();
@@ -91,11 +83,6 @@ class Azure implements IObjectStore {
$this->getBlobClient()->createBlockBlob($this->containerName, $urn, $stream, $options);
}
- /**
- * @param string $urn the unified resource name used to identify the object
- * @return void
- * @throws \Exception when something goes wrong, message will be logged
- */
public function deleteObject($urn) {
$this->getBlobClient()->deleteBlob($this->containerName, $urn);
}
diff --git a/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php b/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php
index b543d223f4c..daf6b5c83c9 100644
--- a/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php
+++ b/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php
@@ -14,12 +14,6 @@ use OCP\IUser;
class HomeObjectStoreStorage extends ObjectStoreStorage implements IHomeStorage {
protected IUser $user;
- /**
- * The home user storage requires a user object to create a unique storage id
- *
- * @param array $params
- * @throws Exception
- */
public function __construct($params) {
if (! isset($params['user']) || ! $params['user'] instanceof IUser) {
throw new Exception('missing user object in parameters');
@@ -32,12 +26,6 @@ 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 {
return $this->user->getUID();
}
diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
index 228fc516677..8465ccede9d 100644
--- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php
+++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
@@ -38,10 +38,6 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil
private bool $handleCopiesAsOwned;
protected bool $validateWrites = true;
- /**
- * @param array $params
- * @throws \Exception
- */
public function __construct($params) {
if (isset($params['objectstore']) && $params['objectstore'] instanceof IObjectStore) {
$this->objectStore = $params['objectstore'];
@@ -126,14 +122,6 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil
return $path;
}
- /**
- * 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.
- *
- * @param string $path
- * @param \OC\Files\Storage\Storage (optional) the storage to pass to the scanner
- * @return \OC\Files\ObjectStore\ObjectStoreScanner
- */
public function getScanner($path = '', $storage = null) {
if (!$storage) {
$storage = $this;
@@ -446,13 +434,6 @@ 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) {
return false;
}
@@ -686,10 +667,6 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil
return $this->objectStore->initiateMultipartUpload($urn);
}
- /**
- *
- * @throws GenericFileException
- */
public function putChunkedWritePart(
string $targetPath,
string $writeToken,
diff --git a/lib/private/Files/ObjectStore/S3.php b/lib/private/Files/ObjectStore/S3.php
index 72c19d951e4..63f2e53b5a8 100644
--- a/lib/private/Files/ObjectStore/S3.php
+++ b/lib/private/Files/ObjectStore/S3.php
@@ -19,10 +19,6 @@ class S3 implements IObjectStore, IObjectStoreMultiPartUpload {
$this->parseParams($parameters);
}
- /**
- * @return string the container or bucket name where objects are stored
- * @since 7.0.0
- */
public function getStorageId() {
return $this->id;
}
diff --git a/lib/private/Files/ObjectStore/StorageObjectStore.php b/lib/private/Files/ObjectStore/StorageObjectStore.php
index 5e7125e18a6..56f950dc09e 100644
--- a/lib/private/Files/ObjectStore/StorageObjectStore.php
+++ b/lib/private/Files/ObjectStore/StorageObjectStore.php
@@ -23,20 +23,10 @@ class StorageObjectStore implements IObjectStore {
$this->storage = $storage;
}
- /**
- * @return string the container or bucket name where objects are stored
- * @since 7.0.0
- */
public function getStorageId() {
$this->storage->getId();
}
- /**
- * @param string $urn the unified resource name used to identify the object
- * @return resource stream with the read data
- * @throws \Exception when something goes wrong, message will be logged
- * @since 7.0.0
- */
public function readObject($urn) {
$handle = $this->storage->fopen($urn, 'r');
if (is_resource($handle)) {
@@ -56,12 +46,6 @@ class StorageObjectStore implements IObjectStore {
}
}
- /**
- * @param string $urn the unified resource name used to identify the object
- * @return void
- * @throws \Exception when something goes wrong, message will be logged
- * @since 7.0.0
- */
public function deleteObject($urn) {
$this->storage->unlink($urn);
}
diff --git a/lib/private/Files/ObjectStore/Swift.php b/lib/private/Files/ObjectStore/Swift.php
index aa8b3bb34ec..857b9674a2c 100644
--- a/lib/private/Files/ObjectStore/Swift.php
+++ b/lib/private/Files/ObjectStore/Swift.php
@@ -45,9 +45,6 @@ class Swift implements IObjectStore {
return $this->swiftFactory->getContainer();
}
- /**
- * @return string the container name where objects are stored
- */
public function getStorageId() {
if (isset($this->params['bucket'])) {
return $this->params['bucket'];
@@ -77,12 +74,6 @@ class Swift implements IObjectStore {
}
}
- /**
- * @param string $urn the unified resource name used to identify the object
- * @return resource stream with the read data
- * @throws \Exception from openstack or GuzzleHttp libs when something goes wrong
- * @throws NotFoundException if file does not exist
- */
public function readObject($urn) {
try {
$publicUri = $this->getContainer()->getObject($urn)->getPublicUri();
@@ -108,11 +99,6 @@ class Swift implements IObjectStore {
return RetryWrapper::wrap($response->getBody()->detach());
}
- /**
- * @param string $urn Unified Resource Name
- * @return void
- * @throws \Exception from openstack lib when something goes wrong
- */
public function deleteObject($urn) {
$this->getContainer()->getObject($urn)->delete();
}
diff --git a/lib/private/Files/Search/SearchBinaryOperator.php b/lib/private/Files/Search/SearchBinaryOperator.php
index 59a1ba2dfaf..d4ef19aad33 100644
--- a/lib/private/Files/Search/SearchBinaryOperator.php
+++ b/lib/private/Files/Search/SearchBinaryOperator.php
@@ -26,16 +26,10 @@ class SearchBinaryOperator implements ISearchBinaryOperator {
$this->arguments = $arguments;
}
- /**
- * @return string
- */
public function getType() {
return $this->type;
}
- /**
- * @return ISearchOperator[]
- */
public function getArguments() {
return $this->arguments;
}
diff --git a/lib/private/Files/Search/SearchComparison.php b/lib/private/Files/Search/SearchComparison.php
index e3a8f800506..e648f34d804 100644
--- a/lib/private/Files/Search/SearchComparison.php
+++ b/lib/private/Files/Search/SearchComparison.php
@@ -24,16 +24,10 @@ class SearchComparison implements ISearchComparison {
) {
}
- /**
- * @return string
- */
public function getType(): string {
return $this->type;
}
- /**
- * @return string
- */
public function getField(): string {
return $this->field;
}
@@ -42,10 +36,6 @@ class SearchComparison implements ISearchComparison {
return $this->value;
}
- /**
- * @return string
- * @since 28.0.0
- */
public function getExtra(): string {
return $this->extra;
}
diff --git a/lib/private/Files/Search/SearchOrder.php b/lib/private/Files/Search/SearchOrder.php
index f3f62b933a1..aa34325346c 100644
--- a/lib/private/Files/Search/SearchOrder.php
+++ b/lib/private/Files/Search/SearchOrder.php
@@ -16,24 +16,14 @@ class SearchOrder implements ISearchOrder {
) {
}
- /**
- * @return string
- */
public function getDirection(): string {
return $this->direction;
}
- /**
- * @return string
- */
public function getField(): string {
return $this->field;
}
- /**
- * @return string
- * @since 28.0.0
- */
public function getExtra(): string {
return $this->extra;
}
diff --git a/lib/private/Files/Search/SearchQuery.php b/lib/private/Files/Search/SearchQuery.php
index 3c8711facd8..fe868be726a 100644
--- a/lib/private/Files/Search/SearchQuery.php
+++ b/lib/private/Files/Search/SearchQuery.php
@@ -49,37 +49,22 @@ class SearchQuery implements ISearchQuery {
$this->limitToHome = $limitToHome;
}
- /**
- * @return ISearchOperator
- */
public function getSearchOperation() {
return $this->searchOperation;
}
- /**
- * @return int
- */
public function getLimit() {
return $this->limit;
}
- /**
- * @return int
- */
public function getOffset() {
return $this->offset;
}
- /**
- * @return ISearchOrder[]
- */
public function getOrder() {
return $this->order;
}
- /**
- * @return ?IUser
- */
public function getUser() {
return $this->user;
}
diff --git a/lib/private/Files/SimpleFS/NewSimpleFile.php b/lib/private/Files/SimpleFS/NewSimpleFile.php
index d0986592c03..a6cc5289dda 100644
--- a/lib/private/Files/SimpleFS/NewSimpleFile.php
+++ b/lib/private/Files/SimpleFS/NewSimpleFile.php
@@ -12,7 +12,6 @@ use Icewind\Streams\CallbackWrapper;
use OCP\Files\File;
use OCP\Files\Folder;
use OCP\Files\NotFoundException;
-use OCP\Files\NotPermittedException;
use OCP\Files\SimpleFS\ISimpleFile;
class NewSimpleFile implements ISimpleFile {
@@ -28,16 +27,10 @@ class NewSimpleFile implements ISimpleFile {
$this->name = $name;
}
- /**
- * Get the name
- */
public function getName(): string {
return $this->name;
}
- /**
- * Get the size in bytes
- */
public function getSize(): int|float {
if ($this->file) {
return $this->file->getSize();
@@ -46,9 +39,6 @@ class NewSimpleFile implements ISimpleFile {
}
}
- /**
- * Get the ETag
- */
public function getETag(): string {
if ($this->file) {
return $this->file->getEtag();
@@ -57,9 +47,6 @@ class NewSimpleFile implements ISimpleFile {
}
}
- /**
- * Get the last modification time
- */
public function getMTime(): int {
if ($this->file) {
return $this->file->getMTime();
@@ -68,12 +55,6 @@ class NewSimpleFile implements ISimpleFile {
}
}
- /**
- * Get the content
- *
- * @throws NotFoundException
- * @throws NotPermittedException
- */
public function getContent(): string {
if ($this->file) {
$result = $this->file->getContent();
@@ -88,13 +69,6 @@ class NewSimpleFile implements ISimpleFile {
}
}
- /**
- * Overwrite the file
- *
- * @param string|resource $data
- * @throws NotPermittedException
- * @throws NotFoundException
- */
public function putContent($data): void {
try {
if ($this->file) {
@@ -140,22 +114,12 @@ class NewSimpleFile implements ISimpleFile {
}
- /**
- * Delete the file
- *
- * @throws NotPermittedException
- */
public function delete(): void {
if ($this->file) {
$this->file->delete();
}
}
- /**
- * Get the MimeType
- *
- * @return string
- */
public function getMimeType(): string {
if ($this->file) {
return $this->file->getMimeType();
@@ -164,9 +128,6 @@ class NewSimpleFile implements ISimpleFile {
}
}
- /**
- * {@inheritDoc}
- */
public function getExtension(): string {
if ($this->file) {
return $this->file->getExtension();
@@ -175,13 +136,6 @@ class NewSimpleFile implements ISimpleFile {
}
}
- /**
- * Open the file as stream for reading, resulting resource can be operated as stream like the result from php's own fopen
- *
- * @return resource|false
- * @throws \OCP\Files\NotPermittedException
- * @since 14.0.0
- */
public function read() {
if ($this->file) {
return $this->file->fopen('r');
@@ -190,13 +144,6 @@ class NewSimpleFile implements ISimpleFile {
}
}
- /**
- * Open the file as stream for writing, resulting resource can be operated as stream like the result from php's own fopen
- *
- * @return resource|bool
- * @throws \OCP\Files\NotPermittedException
- * @since 14.0.0
- */
public function write() {
if ($this->file) {
return $this->file->fopen('w');
diff --git a/lib/private/Files/SimpleFS/SimpleFile.php b/lib/private/Files/SimpleFS/SimpleFile.php
index cbb3af4db29..b69df95e0ae 100644
--- a/lib/private/Files/SimpleFS/SimpleFile.php
+++ b/lib/private/Files/SimpleFS/SimpleFile.php
@@ -7,7 +7,6 @@ namespace OC\Files\SimpleFS;
use OCP\Files\File;
use OCP\Files\NotFoundException;
-use OCP\Files\NotPermittedException;
use OCP\Files\SimpleFS\ISimpleFile;
class SimpleFile implements ISimpleFile {
@@ -17,40 +16,22 @@ class SimpleFile implements ISimpleFile {
$this->file = $file;
}
- /**
- * Get the name
- */
public function getName(): string {
return $this->file->getName();
}
- /**
- * Get the size in bytes
- */
public function getSize(): int|float {
return $this->file->getSize();
}
- /**
- * Get the ETag
- */
public function getETag(): string {
return $this->file->getEtag();
}
- /**
- * Get the last modification time
- */
public function getMTime(): int {
return $this->file->getMTime();
}
- /**
- * Get the content
- *
- * @throws NotPermittedException
- * @throws NotFoundException
- */
public function getContent(): string {
$result = $this->file->getContent();
@@ -61,13 +42,6 @@ class SimpleFile implements ISimpleFile {
return $result;
}
- /**
- * Overwrite the file
- *
- * @param string|resource $data
- * @throws NotPermittedException
- * @throws NotFoundException
- */
public function putContent($data): void {
try {
$this->file->putContent($data);
@@ -105,47 +79,22 @@ class SimpleFile implements ISimpleFile {
}
- /**
- * Delete the file
- *
- * @throws NotPermittedException
- */
public function delete(): void {
$this->file->delete();
}
- /**
- * Get the MimeType
- */
public function getMimeType(): string {
return $this->file->getMimeType();
}
- /**
- * {@inheritDoc}
- */
public function getExtension(): string {
return $this->file->getExtension();
}
- /**
- * Open the file as stream for reading, resulting resource can be operated as stream like the result from php's own fopen
- *
- * @return resource|false
- * @throws \OCP\Files\NotPermittedException
- * @since 14.0.0
- */
public function read() {
return $this->file->fopen('r');
}
- /**
- * Open the file as stream for writing, resulting resource can be operated as stream like the result from php's own fopen
- *
- * @return resource|false
- * @throws \OCP\Files\NotPermittedException
- * @since 14.0.0
- */
public function write() {
return $this->file->fopen('w');
}
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);
diff --git a/lib/private/Files/Template/TemplateManager.php b/lib/private/Files/Template/TemplateManager.php
index 8b20e86930a..50c5ef165d4 100644
--- a/lib/private/Files/Template/TemplateManager.php
+++ b/lib/private/Files/Template/TemplateManager.php
@@ -125,13 +125,6 @@ class TemplateManager implements ITemplateManager {
}, $this->listCreators());
}
- /**
- * @param string $filePath
- * @param string $templateId
- * @param array $templateFields
- * @return array
- * @throws GenericFileException
- */
public function createFromTemplate(string $filePath, string $templateId = '', string $templateType = 'user', array $templateFields = []): array {
$userFolder = $this->rootFolder->getUserFolder($this->userId);
try {
diff --git a/lib/private/Files/Type/Detection.php b/lib/private/Files/Type/Detection.php
index b1e4c098e54..6fce1dbfb0e 100644
--- a/lib/private/Files/Type/Detection.php
+++ b/lib/private/Files/Type/Detection.php
@@ -104,9 +104,6 @@ class Detection implements IMimeTypeDetector {
$this->mimeTypeAlias = $this->loadCustomDefinitions(self::CUSTOM_MIMETYPEALIASES, $this->mimeTypeAlias);
}
- /**
- * @return array<string,string>
- */
public function getAllAliases(): array {
$this->loadAliases();
return $this->mimeTypeAlias;
@@ -140,12 +137,6 @@ class Detection implements IMimeTypeDetector {
return $this->mimetypes;
}
- /**
- * detect mimetype only based on filename, content of file is not used
- *
- * @param string $path
- * @return string
- */
public function detectPath($path): string {
$this->loadMappings();
@@ -171,12 +162,6 @@ class Detection implements IMimeTypeDetector {
return 'application/octet-stream';
}
- /**
- * detect mimetype only based on the content of file
- * @param string $path
- * @return string
- * @since 18.0.0
- */
public function detectContent(string $path): string {
$this->loadMappings();
@@ -236,12 +221,6 @@ class Detection implements IMimeTypeDetector {
return 'application/octet-stream';
}
- /**
- * detect mimetype based on both filename and content
- *
- * @param string $path
- * @return string
- */
public function detect($path): string {
$mimeType = $this->detectPath($path);
@@ -252,12 +231,6 @@ class Detection implements IMimeTypeDetector {
return $this->detectContent($path);
}
- /**
- * detect mimetype based on the content of a string
- *
- * @param string $data
- * @return string
- */
public function detectString($data): string {
if (function_exists('finfo_open') && function_exists('finfo_file')) {
$finfo = finfo_open(FILEINFO_MIME);
@@ -274,23 +247,12 @@ class Detection implements IMimeTypeDetector {
return $mime;
}
- /**
- * Get a secure mimetype that won't expose potential XSS.
- *
- * @param string $mimeType
- * @return string
- */
public function getSecureMimeType($mimeType): string {
$this->loadMappings();
return $this->secureMimeTypes[$mimeType] ?? 'application/octet-stream';
}
- /**
- * Get path to the icon of a file type
- * @param string $mimetype the MIME type
- * @return string the url
- */
public function mimeTypeIcon($mimetype): string {
$this->loadAliases();
diff --git a/lib/private/Files/Type/Loader.php b/lib/private/Files/Type/Loader.php
index 407df59b2e2..79c71a1bd2e 100644
--- a/lib/private/Files/Type/Loader.php
+++ b/lib/private/Files/Type/Loader.php
@@ -38,9 +38,6 @@ class Loader implements IMimeTypeLoader {
$this->mimetypeIds = [];
}
- /**
- * Get a mimetype from its ID
- */
public function getMimetypeById(int $id): ?string {
if (!$this->mimetypes) {
$this->loadMimetypes();
@@ -51,9 +48,6 @@ class Loader implements IMimeTypeLoader {
return null;
}
- /**
- * Get a mimetype ID, adding the mimetype to the DB if it does not exist
- */
public function getId(string $mimetype): int {
if (!$this->mimetypeIds) {
$this->loadMimetypes();
@@ -64,9 +58,6 @@ class Loader implements IMimeTypeLoader {
return $this->store($mimetype);
}
- /**
- * Test if a mimetype exists in the database
- */
public function exists(string $mimetype): bool {
if (!$this->mimetypeIds) {
$this->loadMimetypes();
@@ -74,9 +65,6 @@ class Loader implements IMimeTypeLoader {
return isset($this->mimetypeIds[$mimetype]);
}
- /**
- * Clear all loaded mimetypes, allow for re-loading
- */
public function reset(): void {
$this->mimetypes = [];
$this->mimetypeIds = [];