summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2022-08-23 14:15:24 +0200
committerGitHub <noreply@github.com>2022-08-23 14:15:24 +0200
commit5f90a6a5e2da08e7098cc44937c1713375823e74 (patch)
treece109edb86529bc41ad7e19124b03e97643f4009
parent1a2c008011a185fdccfefa37c1b56a5010a07320 (diff)
parentb6f8b8da60c1349204d6aecf5c9781bb6193ef68 (diff)
downloadnextcloud-server-5f90a6a5e2da08e7098cc44937c1713375823e74.tar.gz
nextcloud-server-5f90a6a5e2da08e7098cc44937c1713375823e74.zip
Merge pull request #33574 from nextcloud/search-share-query-filter-no-init
directly build the search filter for shared storage instead of setting up the source cache
-rw-r--r--apps/files_sharing/lib/Cache.php6
-rw-r--r--lib/private/Files/Cache/Wrapper/CacheJail.php8
2 files changed, 10 insertions, 4 deletions
diff --git a/apps/files_sharing/lib/Cache.php b/apps/files_sharing/lib/Cache.php
index 80f9f64d1aa..0025bb98fbb 100644
--- a/apps/files_sharing/lib/Cache.php
+++ b/apps/files_sharing/lib/Cache.php
@@ -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()),
]
);
diff --git a/lib/private/Files/Cache/Wrapper/CacheJail.php b/lib/private/Files/Cache/Wrapper/CacheJail.php
index 834c9fd3d72..996f0c02603 100644
--- a/lib/private/Files/Cache/Wrapper/CacheJail.php
+++ b/lib/private/Files/Cache/Wrapper/CacheJail.php
@@ -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;
}
}