Merge pull request #9864 from nextcloud/fix/delete-duplicate-uids-job

fix: move delete duplicate uids repair step to a job
This commit is contained in:
Christoph Wurst 2024-07-16 15:29:27 +02:00 коммит произвёл GitHub
Родитель 44604ad788 c361202178
Коммит 638f356876
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 32 добавлений и 4 удалений

Просмотреть файл

@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Mail\BackgroundJob;
use OCA\Mail\Db\MessageMapper;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\QueuedJob;
class DeleteDuplicatedUidsJob extends QueuedJob {
public function __construct(
ITimeFactory $time,
private MessageMapper $messageMapper,
) {
parent::__construct($time);
}
protected function run($argument): void {
$this->messageMapper->deleteDuplicateUids();
}
}

Просмотреть файл

@ -9,21 +9,22 @@ declare(strict_types=1);
namespace OCA\Mail\Migration;
use OCA\Mail\Db\MessageMapper;
use OCA\Mail\BackgroundJob\DeleteDuplicatedUidsJob;
use OCP\BackgroundJob\IJobList;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
class DeleteDuplicateUids implements IRepairStep {
public function __construct(
private MessageMapper $messageMapper,
private IJobList $jobList,
) {
}
public function getName(): string {
return 'Delete duplicated cached messages';
return 'Queue a job to delete duplicated cached messages';
}
public function run(IOutput $output): void {
$this->messageMapper->deleteDuplicateUids();
$this->jobList->add(DeleteDuplicatedUidsJob::class);
}
}