mirror of
https://github.com/nextcloud/server.git
synced 2026-02-18 18:28:50 -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
a6d1fa1fa6
commit
30e35a8411
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