Skip to content

Commit 9a29025

Browse files
committed
Parameter of RepairAdvanceEvent is actually an increment, not a step id
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 parent 652ab6d commit 9a29025

6 files changed

Lines changed: 10 additions & 11 deletions

File tree

core/Command/Maintenance/Repair.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function handleRepairFeedBack(Event $event): void {
127127
if ($event instanceof RepairStartEvent) {
128128
$this->progress->start($event->getMaxStep());
129129
} elseif ($event instanceof RepairAdvanceEvent) {
130-
$this->progress->advance($event->getCurrentStep());
130+
$this->progress->advance($event->getIncrement());
131131
} elseif ($event instanceof RepairFinishEvent) {
132132
$this->progress->finish();
133133
$this->output->writeln('');

core/Command/Upgrade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
137137
if (!empty($desc)) {
138138
$progress->setMessage($desc);
139139
}
140-
$progress->advance($event->getCurrentStep());
140+
$progress->advance($event->getIncrement());
141141
} elseif ($event instanceof RepairFinishEvent) {
142142
$progress->setMessage('Done');
143143
$progress->finish();

core/ajax/update.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function handleRepairFeedback(Event $event): void {
7676
$this->progressStateStep = 0;
7777
$this->currentStep = $event->getCurrentStepName();
7878
} elseif ($event instanceof RepairAdvanceEvent) {
79-
$this->progressStateStep += $event->getCurrentStep();
79+
$this->progressStateStep += $event->getIncrement();
8080
$desc = $event->getDescription();
8181
if (empty($desc)) {
8282
$desc = $this->currentStep;

lib/private/Repair.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ public function startProgress($max = 0) {
279279
}
280280

281281
/**
282-
* @param int $step
282+
* @param int $step number of step to advance
283283
* @param string $description
284284
*/
285285
public function advance($step = 1, $description = '') {

lib/private/Repair/Events/RepairAdvanceEvent.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,19 @@
2727
use OCP\EventDispatcher\Event;
2828

2929
class RepairAdvanceEvent extends Event {
30-
// TODO Is that current step or step increment?
31-
private int $current;
30+
private int $increment;
3231
private string $description;
3332

3433
public function __construct(
35-
int $current,
34+
int $increment,
3635
string $description
3736
) {
38-
$this->current = $current;
37+
$this->increment = $increment;
3938
$this->description = $description;
4039
}
4140

42-
public function getCurrentStep(): int {
43-
return $this->current;
41+
public function getIncrement(): int {
42+
return $this->increment;
4443
}
4544

4645
public function getDescription(): string {

lib/private/Updater.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ function (MigratorExecuteSqlEvent $event) use ($log): void {
460460
if (empty($desc)) {
461461
$desc = '';
462462
}
463-
$log->info(get_class($event).': ' . $desc . ' (' . $event->getCurrentStep() . ')', ['app' => 'updater']);
463+
$log->info(get_class($event).': ' . $desc . ' (' . $event->getIncrement() . ')', ['app' => 'updater']);
464464
} elseif ($event instanceof RepairFinishEvent) {
465465
$log->info(get_class($event), ['app' => 'updater']);
466466
} elseif ($event instanceof RepairStepEvent) {

0 commit comments

Comments
 (0)