blob: b89a2c1fbb3cf085eb3c5f853037d9a608c28298 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
<?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());
}
}
|