Skip to content

Commit

Permalink
Merge pull request #29281 from vijfhoek/master
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored Nov 1, 2021
2 parents e1bf5c1 + 34600c7 commit 63d3931
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
16 changes: 12 additions & 4 deletions lib/private/Files/Cache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -589,8 +589,12 @@ private function removeChildren(ICacheEntry $entry) {

$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) {
Expand All @@ -604,8 +608,12 @@ private function removeChildren(ICacheEntry $entry) {

$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();
}
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/private/Files/Cache/CacheQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ public function whereParent(int $parent) {
return $this;
}

public function whereParentIn(array $parents) {
public function whereParentInParameter(string $parameter) {
$alias = $this->alias;
if ($alias) {
$alias .= '.';
} else {
$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;
}
Expand Down

0 comments on commit 63d3931

Please sign in to comment.