0
0
mirror of https://github.com/nextcloud/server.git synced 2024-12-29 16:38:28 +00:00
nextcloud_server/apps/contactsinteraction/lib/BackgroundJob/CleanupJob.php
provokateurin 54ec472d9a
fix(BackgroundJobs): Adjust intervals and time sensitivities
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-10-08 11:26:53 +02:00

34 lines
765 B
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\ContactsInteraction\BackgroundJob;
use OCA\ContactsInteraction\Db\RecentContactMapper;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\TimedJob;
class CleanupJob extends TimedJob {
public function __construct(
ITimeFactory $time,
private RecentContactMapper $mapper,
) {
parent::__construct($time);
$this->setInterval(24 * 60 * 60);
$this->setTimeSensitivity(self::TIME_INSENSITIVE);
}
protected function run(mixed $argument): void {
$time = $this->time->getDateTime();
$time->modify('-7days');
$this->mapper->cleanUp($time->getTimestamp());
}
}