summaryrefslogtreecommitdiffstats
path: root/core/Command
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-02-20 14:33:06 +0100
committerJoas Schilling <coding@schilljs.com>2023-02-23 16:57:52 +0100
commite0251ea24e581b1841da520d9668bcd3909a53fe (patch)
tree6aa19aab4055de6599c7508f32e456527565e166 /core/Command
parentb0e2a296ff4b69cbae9601211cbaaa997350593f (diff)
downloadnextcloud-server-e0251ea24e581b1841da520d9668bcd3909a53fe.tar.gz
nextcloud-server-e0251ea24e581b1841da520d9668bcd3909a53fe.zip
Fail the repair command when an error happened
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'core/Command')
-rw-r--r--core/Command/Maintenance/Repair.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/Command/Maintenance/Repair.php b/core/Command/Maintenance/Repair.php
index 01e62f2cd32..a1d97476f94 100644
--- a/core/Command/Maintenance/Repair.php
+++ b/core/Command/Maintenance/Repair.php
@@ -53,6 +53,7 @@ class Repair extends Command {
private ProgressBar $progress;
private OutputInterface $output;
private IAppManager $appManager;
+ protected bool $errored = false;
public function __construct(\OC\Repair $repair, IConfig $config, IEventDispatcher $dispatcher, IAppManager $appManager) {
$this->repair = $repair;
@@ -104,6 +105,8 @@ class Repair extends Command {
}
}
+
+
$maintenanceMode = $this->config->getSystemValueBool('maintenance');
$this->config->setSystemValue('maintenance', true);
@@ -120,7 +123,7 @@ class Repair extends Command {
$this->repair->run();
$this->config->setSystemValue('maintenance', $maintenanceMode);
- return 0;
+ return $this->errored ? 1 : 0;
}
public function handleRepairFeedBack(Event $event): void {
@@ -139,6 +142,7 @@ class Repair extends Command {
$this->output->writeln('<comment> - WARNING: ' . $event->getMessage() . '</comment>');
} elseif ($event instanceof RepairErrorEvent) {
$this->output->writeln('<error> - ERROR: ' . $event->getMessage() . '</error>');
+ $this->errored = true;
}
}
}