@@ -29,35 +29,35 @@ |
||
29 | 29 | use OCP\Security\ISecureRandom; |
30 | 30 | |
31 | 31 | class AddMissingSecretJob implements IRepairStep { |
32 | - private IConfig $config; |
|
33 | - private ISecureRandom $random; |
|
34 | - |
|
35 | - public function __construct(IConfig $config, ISecureRandom $random) { |
|
36 | - $this->config = $config; |
|
37 | - $this->random = $random; |
|
38 | - } |
|
39 | - |
|
40 | - public function getName(): string { |
|
41 | - return 'Add possibly missing system config'; |
|
42 | - } |
|
43 | - |
|
44 | - public function run(IOutput $output): void { |
|
45 | - $passwordSalt = $this->config->getSystemValue('passwordsalt', null); |
|
46 | - if ($passwordSalt === null || $passwordSalt === '') { |
|
47 | - try { |
|
48 | - $this->config->setSystemValue('passwordsalt', $this->random->generate(30)); |
|
49 | - } catch (HintException $e) { |
|
50 | - $output->warning("passwordsalt is missing from your config.php and your config.php is read only. Please fix it manually."); |
|
51 | - } |
|
52 | - } |
|
53 | - |
|
54 | - $secret = $this->config->getSystemValue('secret', null); |
|
55 | - if ($secret === null || $secret === '') { |
|
56 | - try { |
|
57 | - $this->config->setSystemValue('secret', $this->random->generate(48)); |
|
58 | - } catch (HintException $e) { |
|
59 | - $output->warning("secret is missing from your config.php and your config.php is read only. Please fix it manually."); |
|
60 | - } |
|
61 | - } |
|
62 | - } |
|
32 | + private IConfig $config; |
|
33 | + private ISecureRandom $random; |
|
34 | + |
|
35 | + public function __construct(IConfig $config, ISecureRandom $random) { |
|
36 | + $this->config = $config; |
|
37 | + $this->random = $random; |
|
38 | + } |
|
39 | + |
|
40 | + public function getName(): string { |
|
41 | + return 'Add possibly missing system config'; |
|
42 | + } |
|
43 | + |
|
44 | + public function run(IOutput $output): void { |
|
45 | + $passwordSalt = $this->config->getSystemValue('passwordsalt', null); |
|
46 | + if ($passwordSalt === null || $passwordSalt === '') { |
|
47 | + try { |
|
48 | + $this->config->setSystemValue('passwordsalt', $this->random->generate(30)); |
|
49 | + } catch (HintException $e) { |
|
50 | + $output->warning("passwordsalt is missing from your config.php and your config.php is read only. Please fix it manually."); |
|
51 | + } |
|
52 | + } |
|
53 | + |
|
54 | + $secret = $this->config->getSystemValue('secret', null); |
|
55 | + if ($secret === null || $secret === '') { |
|
56 | + try { |
|
57 | + $this->config->setSystemValue('secret', $this->random->generate(48)); |
|
58 | + } catch (HintException $e) { |
|
59 | + $output->warning("secret is missing from your config.php and your config.php is read only. Please fix it manually."); |
|
60 | + } |
|
61 | + } |
|
62 | + } |
|
63 | 63 | } |