Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-01-10 13:36:51 +0300
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2022-01-14 17:16:09 +0300
commit33f49b13ed9cbbd07faca50d4c7788dccc751c01 (patch)
tree3fbdfcab89b1c35baf3f20460496f6e31fe08d0f
parent27334942cac5d16818402c8213e4462b378a8e46 (diff)
Add helper method in Wrapper
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
-rw-r--r--apps/workflowengine/lib/Check/FileSystemTags.php5
-rw-r--r--lib/private/Files/Storage/Wrapper/Wrapper.php21
2 files changed, 20 insertions, 6 deletions
diff --git a/apps/workflowengine/lib/Check/FileSystemTags.php b/apps/workflowengine/lib/Check/FileSystemTags.php
index eafd4e97b40..1cc9509ba81 100644
--- a/apps/workflowengine/lib/Check/FileSystemTags.php
+++ b/apps/workflowengine/lib/Check/FileSystemTags.php
@@ -68,11 +68,6 @@ class FileSystemTags implements ICheck, IFileCheck {
* @return bool
*/
public function executeCheck($operator, $value) {
- if (str_starts_with($this->path, '__groupfolders')) {
- // System tags are always empty in this case and executeCheck is called
- // a second time with the jailedPath
- return false;
- }
$systemTags = $this->getSystemTags();
return ($operator === 'is') === in_array($value, $systemTags);
}
diff --git a/lib/private/Files/Storage/Wrapper/Wrapper.php b/lib/private/Files/Storage/Wrapper/Wrapper.php
index 61e10262f8b..d87922c8c3e 100644
--- a/lib/private/Files/Storage/Wrapper/Wrapper.php
+++ b/lib/private/Files/Storage/Wrapper/Wrapper.php
@@ -485,7 +485,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) {
@@ -497,6 +497,25 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea
}
/**
+ * @template T of IStorage
+ * @param class-string<T> $class
+ * @return ?T
+ */
+ public function getInstanceOfStorage(string $class): ?IStorage {
+ $storage = $this;
+ while ($storage->instanceOfStorage(Wrapper::class)) {
+ if ($storage instanceof $class) {
+ break;
+ }
+ $storage = $storage->getWrapperStorage();
+ }
+ if (!is_a($storage, $class)) {
+ return null;
+ }
+ return $storage;
+ }
+
+ /**
* Pass any methods custom to specific storage implementations to the wrapped storage
*
* @param string $method