Browse Source

directly build the search filter for shared storage instead of setting up the source cache

Signed-off-by: Robin Appelman <robin@icewind.nl>
tags/v25.0.0beta3
Robin Appelman 1 year ago
parent
commit
b6f8b8da60
2 changed files with 10 additions and 4 deletions
  1. 4
    2
      apps/files_sharing/lib/Cache.php
  2. 6
    2
      lib/private/Files/Cache/Wrapper/CacheJail.php

+ 4
- 2
apps/files_sharing/lib/Cache.php View File

@@ -183,16 +183,18 @@ class Cache extends CacheJail {
}

public function getQueryFilterForStorage(): ISearchOperator {
$storageFilter = \OC\Files\Cache\Cache::getQueryFilterForStorage();

// Do the normal jail behavior for non files
if ($this->storage->getItemType() !== 'file') {
return parent::getQueryFilterForStorage();
return $this->addJailFilterQuery($storageFilter);
}

// for single file shares we don't need to do the LIKE
return new SearchBinaryOperator(
ISearchBinaryOperator::OPERATOR_AND,
[
\OC\Files\Cache\Cache::getQueryFilterForStorage(),
$storageFilter,
new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', $this->getGetUnjailedRoot()),
]
);

+ 6
- 2
lib/private/Files/Cache/Wrapper/CacheJail.php View File

@@ -306,10 +306,14 @@ class CacheJail extends CacheWrapper {
}

public function getQueryFilterForStorage(): ISearchOperator {
return $this->addJailFilterQuery($this->getCache()->getQueryFilterForStorage());
}

protected function addJailFilterQuery(ISearchOperator $filter): ISearchOperator {
if ($this->getGetUnjailedRoot() !== '' && $this->getGetUnjailedRoot() !== '/') {
return new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND,
[
$this->getCache()->getQueryFilterForStorage(),
$filter,
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR,
[
new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', $this->getGetUnjailedRoot()),
@@ -319,7 +323,7 @@ class CacheJail extends CacheWrapper {
]
);
} else {
return $this->getCache()->getQueryFilterForStorage();
return $filter;
}
}


Loading…
Cancel
Save