2022-10-12 05:41:26 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
/**
|
2024-05-28 10:42:42 -04:00
|
|
|
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2022-10-12 05:41:26 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
namespace OCA\Files\BackgroundJob;
|
|
|
|
|
|
|
|
|
|
use OCA\Files\Db\OpenLocalEditorMapper;
|
|
|
|
|
use OCP\AppFramework\Utility\ITimeFactory;
|
|
|
|
|
use OCP\BackgroundJob\TimedJob;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Delete all expired "Open local editor" token
|
|
|
|
|
*/
|
|
|
|
|
class DeleteExpiredOpenLocalEditor extends TimedJob {
|
|
|
|
|
public function __construct(
|
|
|
|
|
ITimeFactory $time,
|
2024-10-18 06:04:22 -04:00
|
|
|
protected OpenLocalEditorMapper $mapper,
|
2022-10-12 05:41:26 -04:00
|
|
|
) {
|
|
|
|
|
parent::__construct($time);
|
|
|
|
|
|
|
|
|
|
// Run every 12h
|
|
|
|
|
$this->interval = 12 * 3600;
|
2024-10-07 11:36:55 -04:00
|
|
|
$this->setTimeSensitivity(self::TIME_INSENSITIVE);
|
2022-10-12 05:41:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Makes the background job do its work
|
|
|
|
|
*
|
|
|
|
|
* @param array $argument unused argument
|
|
|
|
|
*/
|
|
|
|
|
public function run($argument): void {
|
|
|
|
|
$this->mapper->deleteExpiredTokens($this->time->getTime());
|
|
|
|
|
}
|
|
|
|
|
}
|