diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-08-22 15:58:50 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-08-25 16:13:46 +0200 |
commit | 4f260dce6e43ddef835105a1d4dc13f2b8742526 (patch) | |
tree | e69cf7ca3be76975519dba86179fc39609efe7f8 /lib/private/Repair.php | |
parent | 4ba30d40cfc892bee0ea28486e63c479e1aadd20 (diff) | |
download | nextcloud-server-4f260dce6e43ddef835105a1d4dc13f2b8742526.tar.gz nextcloud-server-4f260dce6e43ddef835105a1d4dc13f2b8742526.zip |
Moving to string key for arguments of GenericEvent in Repair
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/private/Repair.php')
-rw-r--r-- | lib/private/Repair.php | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/lib/private/Repair.php b/lib/private/Repair.php index 98a1f4ce036..496e9b15e2e 100644 --- a/lib/private/Repair.php +++ b/lib/private/Repair.php @@ -112,19 +112,19 @@ class Repair implements IOutput { */ public function run() { if (count($this->repairSteps) === 0) { - $this->emit('\OC\Repair', 'info', ['No repair steps available']); + $this->emit('\OC\Repair', 'info', ['message' => 'No repair steps available']); return; } // run each repair step foreach ($this->repairSteps as $step) { $this->currentStep = $step->getName(); - $this->emit('\OC\Repair', 'step', [$this->currentStep]); + $this->emit('\OC\Repair', 'step', ['step' => $this->currentStep]); try { $step->run($this); } catch (\Exception $e) { $this->logger->error("Exception while executing repair step " . $step->getName(), ['exception' => $e]); - $this->emit('\OC\Repair', 'error', [$e->getMessage()]); + $this->emit('\OC\Repair', 'error', ['message' => $e->getMessage()]); } } } @@ -250,20 +250,16 @@ class Repair implements IOutput { } /** - * @param string $scope - * @param string $method - * @param array $arguments + * @param array<string, mixed> $arguments */ - public function emit($scope, $method, array $arguments = []) { - if (!is_null($this->dispatcher)) { - $this->dispatcher->dispatch("$scope::$method", + public function emit(string $scope, string $method, array $arguments = []): void { + $this->dispatcher->dispatch("$scope::$method", new GenericEvent("$scope::$method", $arguments)); - } } public function info($string) { // for now just emit as we did in the past - $this->emit('\OC\Repair', 'info', [$string]); + $this->emit('\OC\Repair', 'info', ['message' => $string]); } /** @@ -271,7 +267,7 @@ class Repair implements IOutput { */ public function warning($message) { // for now just emit as we did in the past - $this->emit('\OC\Repair', 'warning', [$message]); + $this->emit('\OC\Repair', 'warning', ['message' => $message]); } /** @@ -279,7 +275,7 @@ class Repair implements IOutput { */ public function startProgress($max = 0) { // for now just emit as we did in the past - $this->emit('\OC\Repair', 'startProgress', [$max, $this->currentStep]); + $this->emit('\OC\Repair', 'startProgress', ['max' => $max, 'step' => $this->currentStep]); } /** @@ -288,7 +284,7 @@ class Repair implements IOutput { */ public function advance($step = 1, $description = '') { // for now just emit as we did in the past - $this->emit('\OC\Repair', 'advance', [$step, $description]); + $this->emit('\OC\Repair', 'advance', ['step' => $step, 'desc' => $description]); } /** |