Merge pull request #29507 from nextcloud/backport/29281/stable21

This commit is contained in:
John Molakvoæ 2021-11-04 08:51:37 +01:00 committed by GitHub
commit 8469b44d57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 6 deletions

View file

@ -587,8 +587,12 @@ class Cache implements ICache {
$query = $this->getQueryBuilder();
$query->delete('filecache_extended')
->where($query->expr()->in('fileid', $query->createNamedParameter($childIds, IQueryBuilder::PARAM_INT_ARRAY)));
$query->execute();
->where($query->expr()->in('fileid', $query->createParameter('childIds')));
foreach (array_chunk($childIds, 1000) as $childIdChunk) {
$query->setParameter('childIds', $childIdChunk, IQueryBuilder::PARAM_INT_ARRAY);
$query->execute();
}
/** @var ICacheEntry[] $childFolders */
$childFolders = array_filter($children, function ($child) {
@ -602,8 +606,12 @@ class Cache implements ICache {
$query = $this->getQueryBuilder();
$query->delete('filecache')
->whereParentIn($parentIds);
$query->execute();
->whereParentInParameter('parentIds');
foreach (array_chunk($parentIds, 1000) as $parentIdChunk) {
$query->setParameter('parentIds', $parentIdChunk, IQueryBuilder::PARAM_INT_ARRAY);
$query->execute();
}
}
/**

View file

@ -95,7 +95,7 @@ class CacheQueryBuilder extends QueryBuilder {
return $this;
}
public function whereParentIn(array $parents) {
public function whereParentInParameter(string $parameter) {
$alias = $this->alias;
if ($alias) {
$alias .= '.';
@ -103,7 +103,7 @@ class CacheQueryBuilder extends QueryBuilder {
$alias = '';
}
$this->andWhere($this->expr()->in("{$alias}parent", $this->createNamedParameter($parents, IQueryBuilder::PARAM_INT_ARRAY)));
$this->andWhere($this->expr()->in("{$alias}parent", $this->createParameter($parameter)));
return $this;
}