Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
7 / 7 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| SignSingleFileJob | |
100.00% |
7 / 7 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| run | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | /** |
| 5 | * SPDX-FileCopyrightText: 2026 LibreCode coop and contributors |
| 6 | * SPDX-License-Identifier: AGPL-3.0-or-later |
| 7 | */ |
| 8 | |
| 9 | namespace OCA\Libresign\BackgroundJob; |
| 10 | |
| 11 | use OCA\Libresign\Service\SigningAttemptGuard; |
| 12 | use OCA\Libresign\Service\SignJobCoordinator; |
| 13 | use OCP\AppFramework\Utility\ITimeFactory; |
| 14 | use OCP\BackgroundJob\IJobList; |
| 15 | |
| 16 | /** Background job to process a single file signing request asynchronously. */ |
| 17 | class SignSingleFileJob extends RecoverableSigningJob { |
| 18 | public function __construct( |
| 19 | ITimeFactory $time, |
| 20 | private SignJobCoordinator $coordinator, |
| 21 | IJobList $jobList, |
| 22 | SigningAttemptGuard $attemptGuard, |
| 23 | ) { |
| 24 | parent::__construct($time, $jobList, $attemptGuard); |
| 25 | } |
| 26 | |
| 27 | /** @param array|null $argument */ |
| 28 | #[\Override] |
| 29 | public function run($argument): void { |
| 30 | $argument = is_array($argument) ? $argument : []; |
| 31 | $this->executeSigning( |
| 32 | $argument, |
| 33 | fn () => $this->coordinator->runSignSingleFile($argument), |
| 34 | fn () => $this->coordinator->discardJobCredentials($argument), |
| 35 | ); |
| 36 | } |
| 37 | } |