mirror of
https://github.com/nextcloud/server.git
synced 2026-02-27 12:00:39 -05:00
fix(perf): use index when deleting old previews
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
This commit is contained in:
parent
cad2e6dc6b
commit
fd925b95ce
1 changed files with 5 additions and 1 deletions
|
|
@ -161,12 +161,16 @@ class PreviewMigrationService {
|
|||
private function deleteFolder(string $path): void {
|
||||
$current = $path;
|
||||
|
||||
$rootFolderId = $this->rootFolder->getMountPoint()->getNumericStorageId();
|
||||
while (true) {
|
||||
$appDataPath = $this->previewRootPath . $current;
|
||||
$qb = $this->connection->getQueryBuilder();
|
||||
$qb->delete('filecache')
|
||||
->where($qb->expr()->eq('path_hash', $qb->createNamedParameter(md5($appDataPath))))
|
||||
->hintShardKey('storage', $this->rootFolder->getMountPoint()->getNumericStorageId())
|
||||
->andWhere($qb->expr()->eq(
|
||||
'storage',
|
||||
$qb->createNamedParameter($rootFolderId),
|
||||
))
|
||||
->executeStatement();
|
||||
|
||||
$current = dirname($current);
|
||||
|
|
|
|||
Loading…
Reference in a new issue