Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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 <[email protected]>
  • Loading branch information
CarlSchwan authored and backportbot[bot] committed Jan 14, 2022
commit a8539c808414dc09b202991bb977573f25e86611
10 changes: 7 additions & 3 deletions apps/workflowengine/lib/Check/FileSystemTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use OCP\SystemTag\TagNotFoundException;
use OCP\WorkflowEngine\ICheck;
use OCP\WorkflowEngine\IFileCheck;
use OC\Files\Storage\Wrapper\Wrapper;

class FileSystemTags implements ICheck, IFileCheck {
use TFileCheck;
Expand Down Expand Up @@ -67,6 +68,11 @@ public function __construct(IL10N $l, ISystemTagManager $systemTagManager, ISyst
* @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);
}
Expand Down Expand Up @@ -149,9 +155,7 @@ protected function getFileIds(ICache $cache, $path, $isExternalStorage) {
$parentIds[] = $cache->getId($path);
}

if ($shouldCacheFileIds) {
$this->fileIds[$cacheId][$path] = $parentIds;
}
$this->fileIds[$cacheId][$path] = $parentIds;

return $parentIds;
}
Expand Down