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:
Коммит
638f356876
|
@ -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;
|
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\IOutput;
|
||||||
use OCP\Migration\IRepairStep;
|
use OCP\Migration\IRepairStep;
|
||||||
|
|
||||||
class DeleteDuplicateUids implements IRepairStep {
|
class DeleteDuplicateUids implements IRepairStep {
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private MessageMapper $messageMapper,
|
private IJobList $jobList,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(): string {
|
public function getName(): string {
|
||||||
return 'Delete duplicated cached messages';
|
return 'Queue a job to delete duplicated cached messages';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function run(IOutput $output): void {
|
public function run(IOutput $output): void {
|
||||||
$this->messageMapper->deleteDuplicateUids();
|
$this->jobList->add(DeleteDuplicatedUidsJob::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче