-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathPreGenerate.php
More file actions
41 lines (33 loc) · 1.1 KB
/
PreGenerate.php
File metadata and controls
41 lines (33 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\PreviewGenerator\Command;
use OCA\PreviewGenerator\Exceptions\EncryptionEnabledException;
use OCA\PreviewGenerator\Service\PreGenerateService;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class PreGenerate extends Command {
public function __construct(
private readonly PreGenerateService $preGenerateService,
) {
parent::__construct();
}
protected function configure(): void {
$this
->setName('preview:pre-generate')
->setDescription('Pre generate only images that have been added or changed since the last regular run');
}
protected function execute(InputInterface $input, OutputInterface $output): int {
try {
$this->preGenerateService->preGenerate($output);
} catch (EncryptionEnabledException $e) {
$output->writeln('<error>Encryption is enabled. Aborted.</error>');
return 1;
}
return 0;
}
}