aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-01-13 13:52:29 +0100
committerGitHub <noreply@github.com>2022-01-13 13:52:29 +0100
commit992c26f8ed56f02e35691b19f874e126c623d10b (patch)
treebe8be8de69e175577532fb5e653936c1a444af4b /lib
parent89d109a4d9a9c471f9dde7d5bd12a60ca91fe1f9 (diff)
parentcbf9064b8ecde6f497146f6711fff83307a0730f (diff)
downloadnextcloud-server-992c26f8ed56f02e35691b19f874e126c623d10b.tar.gz
nextcloud-server-992c26f8ed56f02e35691b19f874e126c623d10b.zip
Merge pull request #30531 from nextcloud/performance/optimize-filesystemtags-flow-groupfolder
Optimize FileSystemTags workflow for groupfolder
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/Storage/Wrapper/Wrapper.php21
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/private/Files/Storage/Wrapper/Wrapper.php b/lib/private/Files/Storage/Wrapper/Wrapper.php
index 5faffece67e..6bc66bf9c89 100644
--- a/lib/private/Files/Storage/Wrapper/Wrapper.php
+++ b/lib/private/Files/Storage/Wrapper/Wrapper.php
@@ -486,7 +486,7 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea
/**
* 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
+ * @param class-string<IStorage> $class
* @return bool
*/
public function instanceOfStorage($class) {
@@ -498,6 +498,25 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea
}
/**
+ * @psalm-template T of IStorage
+ * @psalm-param class-string<T> $class
+ * @psalm-return T|null
+ */
+ public function getInstanceOfStorage(string $class) {
+ $storage = $this;
+ while ($storage instanceof Wrapper) {
+ if ($storage instanceof $class) {
+ break;
+ }
+ $storage = $storage->getWrapperStorage();
+ }
+ if (!($storage instanceof $class)) {
+ return null;
+ }
+ return $storage;
+ }
+
+ /**
* Pass any methods custom to specific storage implementations to the wrapped storage
*
* @param string $method