0
0
mirror of https://github.com/nextcloud/server.git synced 2024-12-29 16:38:28 +00:00
nextcloud_server/lib/private/Repair/NC21/AddCheckForUserCertificatesJob.php
Andy Scherzinger dae7c159f7
chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2024-05-24 13:11:22 +02:00

43 lines
1.1 KiB
PHP

<?php
/**
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OC\Repair\NC21;
use OC\Core\BackgroundJobs\CheckForUserCertificates;
use OCP\BackgroundJob\IJobList;
use OCP\IConfig;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
class AddCheckForUserCertificatesJob implements IRepairStep {
/** @var IJobList */
protected $jobList;
/** @var IConfig */
private $config;
public function __construct(IConfig $config, IJobList $jobList) {
$this->jobList = $jobList;
$this->config = $config;
}
public function getName() {
return 'Queue a one-time job to check for user uploaded certificates';
}
private function shouldRun() {
$versionFromBeforeUpdate = $this->config->getSystemValueString('version', '0.0.0.0');
// was added to 21.0.0.2
return version_compare($versionFromBeforeUpdate, '21.0.0.2', '<');
}
public function run(IOutput $output) {
if ($this->shouldRun()) {
$this->config->setAppValue('files_external', 'user_certificate_scan', 'not-run-yet');
$this->jobList->add(CheckForUserCertificates::class);
}
}
}