Passed
Push — master ( 37bb33...473c54 )
by Christoph
16:04 queued 11s
created
core/Command/Maintenance/Repair.php 2 patches
Indentation   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -47,98 +47,98 @@
 block discarded – undo
47 47
 use Symfony\Component\Console\Output\OutputInterface;
48 48
 
49 49
 class Repair extends Command {
50
-	protected \OC\Repair $repair;
51
-	protected IConfig $config;
52
-	private IEventDispatcher $dispatcher;
53
-	private ProgressBar $progress;
54
-	private OutputInterface $output;
55
-	private IAppManager $appManager;
50
+    protected \OC\Repair $repair;
51
+    protected IConfig $config;
52
+    private IEventDispatcher $dispatcher;
53
+    private ProgressBar $progress;
54
+    private OutputInterface $output;
55
+    private IAppManager $appManager;
56 56
 
57
-	public function __construct(\OC\Repair $repair, IConfig $config, IEventDispatcher $dispatcher, IAppManager $appManager) {
58
-		$this->repair = $repair;
59
-		$this->config = $config;
60
-		$this->dispatcher = $dispatcher;
61
-		$this->appManager = $appManager;
62
-		parent::__construct();
63
-	}
57
+    public function __construct(\OC\Repair $repair, IConfig $config, IEventDispatcher $dispatcher, IAppManager $appManager) {
58
+        $this->repair = $repair;
59
+        $this->config = $config;
60
+        $this->dispatcher = $dispatcher;
61
+        $this->appManager = $appManager;
62
+        parent::__construct();
63
+    }
64 64
 
65
-	protected function configure() {
66
-		$this
67
-			->setName('maintenance:repair')
68
-			->setDescription('repair this installation')
69
-			->addOption(
70
-				'include-expensive',
71
-				null,
72
-				InputOption::VALUE_NONE,
73
-				'Use this option when you want to include resource and load expensive tasks');
74
-	}
65
+    protected function configure() {
66
+        $this
67
+            ->setName('maintenance:repair')
68
+            ->setDescription('repair this installation')
69
+            ->addOption(
70
+                'include-expensive',
71
+                null,
72
+                InputOption::VALUE_NONE,
73
+                'Use this option when you want to include resource and load expensive tasks');
74
+    }
75 75
 
76
-	protected function execute(InputInterface $input, OutputInterface $output): int {
77
-		$repairSteps = $this->repair::getRepairSteps();
76
+    protected function execute(InputInterface $input, OutputInterface $output): int {
77
+        $repairSteps = $this->repair::getRepairSteps();
78 78
 
79
-		if ($input->getOption('include-expensive')) {
80
-			$repairSteps = array_merge($repairSteps, $this->repair::getExpensiveRepairSteps());
81
-		}
79
+        if ($input->getOption('include-expensive')) {
80
+            $repairSteps = array_merge($repairSteps, $this->repair::getExpensiveRepairSteps());
81
+        }
82 82
 
83
-		foreach ($repairSteps as $step) {
84
-			$this->repair->addStep($step);
85
-		}
83
+        foreach ($repairSteps as $step) {
84
+            $this->repair->addStep($step);
85
+        }
86 86
 
87
-		$apps = $this->appManager->getInstalledApps();
88
-		foreach ($apps as $app) {
89
-			if (!$this->appManager->isEnabledForUser($app)) {
90
-				continue;
91
-			}
92
-			$info = $this->appManager->getAppInfo($app);
93
-			if (!is_array($info)) {
94
-				continue;
95
-			}
96
-			\OC_App::loadApp($app);
97
-			$steps = $info['repair-steps']['post-migration'];
98
-			foreach ($steps as $step) {
99
-				try {
100
-					$this->repair->addStep($step);
101
-				} catch (Exception $ex) {
102
-					$output->writeln("<error>Failed to load repair step for $app: {$ex->getMessage()}</error>");
103
-				}
104
-			}
105
-		}
87
+        $apps = $this->appManager->getInstalledApps();
88
+        foreach ($apps as $app) {
89
+            if (!$this->appManager->isEnabledForUser($app)) {
90
+                continue;
91
+            }
92
+            $info = $this->appManager->getAppInfo($app);
93
+            if (!is_array($info)) {
94
+                continue;
95
+            }
96
+            \OC_App::loadApp($app);
97
+            $steps = $info['repair-steps']['post-migration'];
98
+            foreach ($steps as $step) {
99
+                try {
100
+                    $this->repair->addStep($step);
101
+                } catch (Exception $ex) {
102
+                    $output->writeln("<error>Failed to load repair step for $app: {$ex->getMessage()}</error>");
103
+                }
104
+            }
105
+        }
106 106
 
107
-		$maintenanceMode = $this->config->getSystemValueBool('maintenance');
108
-		$this->config->setSystemValue('maintenance', true);
107
+        $maintenanceMode = $this->config->getSystemValueBool('maintenance');
108
+        $this->config->setSystemValue('maintenance', true);
109 109
 
110
-		$this->progress = new ProgressBar($output);
111
-		$this->output = $output;
112
-		$this->dispatcher->addListener(RepairStartEvent::class, [$this, 'handleRepairFeedBack']);
113
-		$this->dispatcher->addListener(RepairAdvanceEvent::class, [$this, 'handleRepairFeedBack']);
114
-		$this->dispatcher->addListener(RepairFinishEvent::class, [$this, 'handleRepairFeedBack']);
115
-		$this->dispatcher->addListener(RepairStepEvent::class, [$this, 'handleRepairFeedBack']);
116
-		$this->dispatcher->addListener(RepairInfoEvent::class, [$this, 'handleRepairFeedBack']);
117
-		$this->dispatcher->addListener(RepairWarningEvent::class, [$this, 'handleRepairFeedBack']);
118
-		$this->dispatcher->addListener(RepairErrorEvent::class, [$this, 'handleRepairFeedBack']);
110
+        $this->progress = new ProgressBar($output);
111
+        $this->output = $output;
112
+        $this->dispatcher->addListener(RepairStartEvent::class, [$this, 'handleRepairFeedBack']);
113
+        $this->dispatcher->addListener(RepairAdvanceEvent::class, [$this, 'handleRepairFeedBack']);
114
+        $this->dispatcher->addListener(RepairFinishEvent::class, [$this, 'handleRepairFeedBack']);
115
+        $this->dispatcher->addListener(RepairStepEvent::class, [$this, 'handleRepairFeedBack']);
116
+        $this->dispatcher->addListener(RepairInfoEvent::class, [$this, 'handleRepairFeedBack']);
117
+        $this->dispatcher->addListener(RepairWarningEvent::class, [$this, 'handleRepairFeedBack']);
118
+        $this->dispatcher->addListener(RepairErrorEvent::class, [$this, 'handleRepairFeedBack']);
119 119
 
120
-		$this->repair->run();
120
+        $this->repair->run();
121 121
 
122
-		$this->config->setSystemValue('maintenance', $maintenanceMode);
123
-		return 0;
124
-	}
122
+        $this->config->setSystemValue('maintenance', $maintenanceMode);
123
+        return 0;
124
+    }
125 125
 
126
-	public function handleRepairFeedBack(Event $event): void {
127
-		if ($event instanceof RepairStartEvent) {
128
-			$this->progress->start($event->getMaxStep());
129
-		} elseif ($event instanceof RepairAdvanceEvent) {
130
-			$this->progress->advance($event->getIncrement());
131
-		} elseif ($event instanceof RepairFinishEvent) {
132
-			$this->progress->finish();
133
-			$this->output->writeln('');
134
-		} elseif ($event instanceof RepairStepEvent) {
135
-			$this->output->writeln('<info> - ' . $event->getStepName() . '</info>');
136
-		} elseif ($event instanceof RepairInfoEvent) {
137
-			$this->output->writeln('<info>     - ' . $event->getMessage() . '</info>');
138
-		} elseif ($event instanceof RepairWarningEvent) {
139
-			$this->output->writeln('<comment>     - WARNING: ' . $event->getMessage() . '</comment>');
140
-		} elseif ($event instanceof RepairErrorEvent) {
141
-			$this->output->writeln('<error>     - ERROR: ' . $event->getMessage() . '</error>');
142
-		}
143
-	}
126
+    public function handleRepairFeedBack(Event $event): void {
127
+        if ($event instanceof RepairStartEvent) {
128
+            $this->progress->start($event->getMaxStep());
129
+        } elseif ($event instanceof RepairAdvanceEvent) {
130
+            $this->progress->advance($event->getIncrement());
131
+        } elseif ($event instanceof RepairFinishEvent) {
132
+            $this->progress->finish();
133
+            $this->output->writeln('');
134
+        } elseif ($event instanceof RepairStepEvent) {
135
+            $this->output->writeln('<info> - ' . $event->getStepName() . '</info>');
136
+        } elseif ($event instanceof RepairInfoEvent) {
137
+            $this->output->writeln('<info>     - ' . $event->getMessage() . '</info>');
138
+        } elseif ($event instanceof RepairWarningEvent) {
139
+            $this->output->writeln('<comment>     - WARNING: ' . $event->getMessage() . '</comment>');
140
+        } elseif ($event instanceof RepairErrorEvent) {
141
+            $this->output->writeln('<error>     - ERROR: ' . $event->getMessage() . '</error>');
142
+        }
143
+    }
144 144
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -132,13 +132,13 @@
 block discarded – undo
132 132
 			$this->progress->finish();
133 133
 			$this->output->writeln('');
134 134
 		} elseif ($event instanceof RepairStepEvent) {
135
-			$this->output->writeln('<info> - ' . $event->getStepName() . '</info>');
135
+			$this->output->writeln('<info> - '.$event->getStepName().'</info>');
136 136
 		} elseif ($event instanceof RepairInfoEvent) {
137
-			$this->output->writeln('<info>     - ' . $event->getMessage() . '</info>');
137
+			$this->output->writeln('<info>     - '.$event->getMessage().'</info>');
138 138
 		} elseif ($event instanceof RepairWarningEvent) {
139
-			$this->output->writeln('<comment>     - WARNING: ' . $event->getMessage() . '</comment>');
139
+			$this->output->writeln('<comment>     - WARNING: '.$event->getMessage().'</comment>');
140 140
 		} elseif ($event instanceof RepairErrorEvent) {
141
-			$this->output->writeln('<error>     - ERROR: ' . $event->getMessage() . '</error>');
141
+			$this->output->writeln('<error>     - ERROR: '.$event->getMessage().'</error>');
142 142
 		}
143 143
 	}
144 144
 }
Please login to merge, or discard this patch.