Skip to content

Commit a8539c8

Browse files
CarlSchwanbackportbot[bot]
authored andcommitted
Optimize FileSystemTags workflow for groupfolder
In #28774 we disabled the caching for the groupfolder application since it worked due to the fact that in groupfolders, getFileIds could be called with the same $cacheId and path for actually different groupfolders. This revert this change and instead add the folderId from the groupFolder to the cacheId. This solve the issue of the uniqueness of the cacheId inside GroupFolder. Downside is that we introduce groupfolder specific implementation inside the server repo. The seconf optimization is to not consider paths starting with __groupfolders in executeCheck. This is due to the fact that files in the groupfolder application call two times executeCheck one time with the url __groupfolder/<folderId>/<path> and the other time with <path>. The first time will always return an empty systemTags array while the second call will return the correct system tags. Signed-off-by: Carl Schwan <carl@carlschwan.eu>
1 parent 1ead55e commit a8539c8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

apps/workflowengine/lib/Check/FileSystemTags.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
use OCP\SystemTag\TagNotFoundException;
3232
use OCP\WorkflowEngine\ICheck;
3333
use OCP\WorkflowEngine\IFileCheck;
34+
use OC\Files\Storage\Wrapper\Wrapper;
3435

3536
class FileSystemTags implements ICheck, IFileCheck {
3637
use TFileCheck;
@@ -67,6 +68,11 @@ public function __construct(IL10N $l, ISystemTagManager $systemTagManager, ISyst
6768
* @return bool
6869
*/
6970
public function executeCheck($operator, $value) {
71+
if (str_starts_with($this->path, '__groupfolders')) {
72+
// System tags are always empty in this case and executeCheck is called
73+
// a second time with the jailedPath
74+
return false;
75+
}
7076
$systemTags = $this->getSystemTags();
7177
return ($operator === 'is') === in_array($value, $systemTags);
7278
}
@@ -149,9 +155,7 @@ protected function getFileIds(ICache $cache, $path, $isExternalStorage) {
149155
$parentIds[] = $cache->getId($path);
150156
}
151157

152-
if ($shouldCacheFileIds) {
153-
$this->fileIds[$cacheId][$path] = $parentIds;
154-
}
158+
$this->fileIds[$cacheId][$path] = $parentIds;
155159

156160
return $parentIds;
157161
}

0 commit comments

Comments
 (0)