Add background job for token cleanup

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2019-11-06 10:41:08 +01:00
parent bccf236738
commit 103c6fb39e
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
2 changed files with 32 additions and 0 deletions

View File

@ -26,6 +26,7 @@
<job>OCA\Files\BackgroundJob\ScanFiles</job>
<job>OCA\Files\BackgroundJob\DeleteOrphanedItems</job>
<job>OCA\Files\BackgroundJob\CleanupFileLocks</job>
<job>OCA\Files\BackgroundJob\CleanupDirectEditingTokens</job>
</background-jobs>
<commands>

View File

@ -0,0 +1,31 @@
<?php
namespace OCA\Files\BackgroundJob;
use OC\BackgroundJob\TimedJob;
use OCP\DirectEditing\IManager;
class CleanupDirectEditingTokens extends TimedJob {
const INTERVAL_MINUTES = 15 * 60;
/**
* @var IManager
*/
private $manager;
public function __construct(IManager $manager) {
$this->interval = self::INTERVAL_MINUTES;
$this->manager = $manager;
}
/**
* Makes the background job do its work
*
* @param array $argument unused argument
* @throws \Exception
*/
public function run($argument) {
$this->manager->cleanup();
}
}