@@ -28,51 +28,51 @@ |
||
28 | 28 | |
29 | 29 | class MoveUpdaterStepFile implements IRepairStep { |
30 | 30 | |
31 | - /** @var \OCP\IConfig */ |
|
32 | - protected $config; |
|
31 | + /** @var \OCP\IConfig */ |
|
32 | + protected $config; |
|
33 | 33 | |
34 | - /** |
|
35 | - * @param \OCP\IConfig $config |
|
36 | - */ |
|
37 | - public function __construct($config) { |
|
38 | - $this->config = $config; |
|
39 | - } |
|
34 | + /** |
|
35 | + * @param \OCP\IConfig $config |
|
36 | + */ |
|
37 | + public function __construct($config) { |
|
38 | + $this->config = $config; |
|
39 | + } |
|
40 | 40 | |
41 | - public function getName() { |
|
42 | - return 'Move .step file of updater to backup location'; |
|
43 | - } |
|
41 | + public function getName() { |
|
42 | + return 'Move .step file of updater to backup location'; |
|
43 | + } |
|
44 | 44 | |
45 | - public function run(IOutput $output) { |
|
46 | - $updateDir = $this->config->getSystemValue('updatedirectory') ?? $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data'); |
|
47 | - $instanceId = $this->config->getSystemValue('instanceid', null); |
|
45 | + public function run(IOutput $output) { |
|
46 | + $updateDir = $this->config->getSystemValue('updatedirectory') ?? $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data'); |
|
47 | + $instanceId = $this->config->getSystemValue('instanceid', null); |
|
48 | 48 | |
49 | - if (!is_string($instanceId) || empty($instanceId)) { |
|
50 | - return; |
|
51 | - } |
|
49 | + if (!is_string($instanceId) || empty($instanceId)) { |
|
50 | + return; |
|
51 | + } |
|
52 | 52 | |
53 | - $updaterFolderPath = $updateDir . '/updater-' . $instanceId; |
|
54 | - $stepFile = $updaterFolderPath . '/.step'; |
|
55 | - if (file_exists($stepFile)) { |
|
56 | - $output->info('.step file exists'); |
|
53 | + $updaterFolderPath = $updateDir . '/updater-' . $instanceId; |
|
54 | + $stepFile = $updaterFolderPath . '/.step'; |
|
55 | + if (file_exists($stepFile)) { |
|
56 | + $output->info('.step file exists'); |
|
57 | 57 | |
58 | - $previousStepFile = $updaterFolderPath . '/.step-previous-update'; |
|
58 | + $previousStepFile = $updaterFolderPath . '/.step-previous-update'; |
|
59 | 59 | |
60 | - // cleanup |
|
61 | - if (file_exists($previousStepFile)) { |
|
62 | - if (\OC_Helper::rmdirr($previousStepFile)) { |
|
63 | - $output->info('.step-previous-update removed'); |
|
64 | - } else { |
|
65 | - $output->info('.step-previous-update can\'t be removed - abort move of .step file'); |
|
66 | - return; |
|
67 | - } |
|
68 | - } |
|
60 | + // cleanup |
|
61 | + if (file_exists($previousStepFile)) { |
|
62 | + if (\OC_Helper::rmdirr($previousStepFile)) { |
|
63 | + $output->info('.step-previous-update removed'); |
|
64 | + } else { |
|
65 | + $output->info('.step-previous-update can\'t be removed - abort move of .step file'); |
|
66 | + return; |
|
67 | + } |
|
68 | + } |
|
69 | 69 | |
70 | - // move step file |
|
71 | - if (rename($stepFile, $previousStepFile)) { |
|
72 | - $output->info('.step file moved to .step-previous-update'); |
|
73 | - } else { |
|
74 | - $output->warning('.step file can\'t be moved'); |
|
75 | - } |
|
76 | - } |
|
77 | - } |
|
70 | + // move step file |
|
71 | + if (rename($stepFile, $previousStepFile)) { |
|
72 | + $output->info('.step file moved to .step-previous-update'); |
|
73 | + } else { |
|
74 | + $output->warning('.step file can\'t be moved'); |
|
75 | + } |
|
76 | + } |
|
77 | + } |
|
78 | 78 | } |
@@ -43,19 +43,19 @@ |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | public function run(IOutput $output) { |
46 | - $updateDir = $this->config->getSystemValue('updatedirectory') ?? $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data'); |
|
46 | + $updateDir = $this->config->getSystemValue('updatedirectory') ?? $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data'); |
|
47 | 47 | $instanceId = $this->config->getSystemValue('instanceid', null); |
48 | 48 | |
49 | 49 | if (!is_string($instanceId) || empty($instanceId)) { |
50 | 50 | return; |
51 | 51 | } |
52 | 52 | |
53 | - $updaterFolderPath = $updateDir . '/updater-' . $instanceId; |
|
54 | - $stepFile = $updaterFolderPath . '/.step'; |
|
53 | + $updaterFolderPath = $updateDir.'/updater-'.$instanceId; |
|
54 | + $stepFile = $updaterFolderPath.'/.step'; |
|
55 | 55 | if (file_exists($stepFile)) { |
56 | 56 | $output->info('.step file exists'); |
57 | 57 | |
58 | - $previousStepFile = $updaterFolderPath . '/.step-previous-update'; |
|
58 | + $previousStepFile = $updaterFolderPath.'/.step-previous-update'; |
|
59 | 59 | |
60 | 60 | // cleanup |
61 | 61 | if (file_exists($previousStepFile)) { |