mirror of
https://github.com/nextcloud/server.git
synced 2026-06-05 23:06:48 -04:00
fix: Backport to 30
Signed-off-by: Louis Chemineau <louis@chmn.me>
This commit is contained in:
parent
e5a8f996bd
commit
140b36fcea
3 changed files with 16 additions and 12 deletions
|
|
@ -48,16 +48,10 @@ class DeleteOrphanedFiles extends Command {
|
|||
$deleteQuery->delete('filecache')
|
||||
->where($deleteQuery->expr()->in('storage', $deleteQuery->createParameter('storage_ids')));
|
||||
|
||||
$deletedInLastChunk = self::CHUNK_SIZE;
|
||||
while ($deletedInLastChunk === self::CHUNK_SIZE) {
|
||||
$deletedInLastChunk = 0;
|
||||
$result = $query->execute();
|
||||
while ($row = $result->fetch()) {
|
||||
$deletedInLastChunk++;
|
||||
$deletedEntries += $deleteQuery->setParameter('objectid', (int) $row['fileid'])
|
||||
->execute();
|
||||
}
|
||||
$result->closeCursor();
|
||||
$deletedStorageChunks = array_chunk($deletedStorages, self::CHUNK_SIZE);
|
||||
foreach ($deletedStorageChunks as $deletedStorageChunk) {
|
||||
$deleteQuery->setParameter('storage_ids', $deletedStorageChunk, IQueryBuilder::PARAM_INT_ARRAY);
|
||||
$deletedEntries += $deleteQuery->executeStatement();
|
||||
}
|
||||
|
||||
$output->writeln("$deletedEntries orphaned file cache entries deleted");
|
||||
|
|
|
|||
|
|
@ -1365,4 +1365,14 @@ class QueryBuilder implements IQueryBuilder {
|
|||
|
||||
return $this->helper->quoteColumnName($alias);
|
||||
}
|
||||
|
||||
public function hintShardKey(string $column, mixed $value, bool $overwrite = false) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function runAcrossAllShards() {
|
||||
// noop
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ class CleanTagsTest extends \Test\TestCase {
|
|||
])
|
||||
->execute();
|
||||
|
||||
return (int) $this->getLastInsertID('vcategory', 'id');
|
||||
return $qb->getLastInsertId();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -191,7 +191,7 @@ class CleanTagsTest extends \Test\TestCase {
|
|||
])
|
||||
->execute();
|
||||
|
||||
$this->createdFile = (int) $this->getLastInsertID('filecache', 'fileid');
|
||||
$this->createdFile = $qb->getLastInsertId();
|
||||
return $this->createdFile;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue