diff options
author | Robin Appelman <robin@icewind.nl> | 2021-05-05 18:09:53 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2021-06-14 16:11:25 +0200 |
commit | 9774fb1573d30e79eb57f8956f64b13b52b7dee9 (patch) | |
tree | f7431f41db9d421773ff23381c943c82e0471e51 /apps/files_sharing | |
parent | e198dc1b200f3ade93498e0ea7b468c87d46748a (diff) | |
download | nextcloud-server-9774fb1573d30e79eb57f8956f64b13b52b7dee9.tar.gz nextcloud-server-9774fb1573d30e79eb57f8956f64b13b52b7dee9.zip |
use searchoperation for storage filter instead of db expression
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/files_sharing')
-rw-r--r-- | apps/files_sharing/lib/Cache.php | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/apps/files_sharing/lib/Cache.php b/apps/files_sharing/lib/Cache.php index b703a672a25..25e92d23962 100644 --- a/apps/files_sharing/lib/Cache.php +++ b/apps/files_sharing/lib/Cache.php @@ -30,9 +30,13 @@ namespace OCA\Files_Sharing; use OC\Files\Cache\FailedCache; use OC\Files\Cache\Wrapper\CacheJail; +use OC\Files\Search\SearchBinaryOperator; +use OC\Files\Search\SearchComparison; use OC\Files\Storage\Wrapper\Jail; -use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\Files\Cache\ICacheEntry; +use OCP\Files\Search\ISearchBinaryOperator; +use OCP\Files\Search\ISearchComparison; +use OCP\Files\Search\ISearchOperator; use OCP\Files\StorageNotAvailableException; /** @@ -182,18 +186,19 @@ class Cache extends CacheJail { // Not a valid action for Shared Cache } - public function getQueryFilterForStorage(IQueryBuilder $builder) { + public function getQueryFilterForStorage(): ISearchOperator { // Do the normal jail behavior for non files if ($this->storage->getItemType() !== 'file') { - return parent::getQueryFilterForStorage($builder); + return parent::getQueryFilterForStorage(); } // for single file shares we don't need to do the LIKE - return $builder->expr()->andX( - parent::getQueryFilterForStorage($builder), - $builder->expr()->orX( - $builder->expr()->eq('path_hash', $builder->createNamedParameter(md5($this->getGetUnjailedRoot()))), - ) + return new SearchBinaryOperator( + ISearchBinaryOperator::OPERATOR_AND, + [ + \OC\Files\Cache\Cache::getQueryFilterForStorage(), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', $this->getGetUnjailedRoot()), + ] ); } } |