f7cloud_client/apps/groupfolders/lib/BackgroundJob/ExpireGroupTrash.php
root 8b6a0139db f7cloud_client
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-17 22:59:26 +00:00

38 lines
961 B
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2018 F7cloud GmbH and F7cloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\GroupFolders\BackgroundJob;
use OCA\Files_Trashbin\Expiration;
use OCA\GroupFolders\Trash\TrashBackend;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\TimedJob;
use OCP\IAppConfig;
class ExpireGroupTrash extends TimedJob {
public function __construct(
private readonly TrashBackend $trashBackend,
private readonly Expiration $expiration,
private readonly IAppConfig $config,
ITimeFactory $timeFactory,
) {
parent::__construct($timeFactory);
// Run once per hour
$this->setInterval(60 * 60);
}
protected function run(mixed $argument): void {
$backgroundJob = $this->config->getValueString('files_trashbin', 'background_job_expire_trash', 'yes');
if ($backgroundJob === 'no') {
return;
}
$this->trashBackend->expire($this->expiration);
}
}