From 821d8736c89eae3ad35c0ddc726a583b0c0cf99c Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Wed, 27 Apr 2016 12:21:31 +0200 Subject: Adding progress to web upgrade --- lib/private/Repair/DropOldTables.php | 2 +- lib/private/repair.php | 12 ++++++++---- lib/public/migration/ioutput.php | 3 ++- 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/private/Repair/DropOldTables.php b/lib/private/Repair/DropOldTables.php index 59e8487c2a3..b9963b50775 100644 --- a/lib/private/Repair/DropOldTables.php +++ b/lib/private/Repair/DropOldTables.php @@ -61,7 +61,7 @@ class DropOldTables implements IRepairStep { if ($this->connection->tableExists($tableName)){ $this->connection->dropTable($tableName); } - $output->advance(); + $output->advance(1, "Drop old database table: $tableName"); } $output->finishProgress(); } diff --git a/lib/private/repair.php b/lib/private/repair.php index c6887ab5ce6..590b0bee721 100644 --- a/lib/private/repair.php +++ b/lib/private/repair.php @@ -55,6 +55,8 @@ class Repair implements IOutput{ private $repairSteps; /** @var EventDispatcher */ private $dispatcher; + /** @var string */ + private $currentStep; /** * Creates a new repair step runner @@ -78,7 +80,8 @@ class Repair implements IOutput{ } // run each repair step foreach ($this->repairSteps as $step) { - $this->emit('\OC\Repair', 'step', array($step->getName())); + $this->currentStep = $step->getName(); + $this->emit('\OC\Repair', 'step', [$this->currentStep]); if ($step instanceof Emitter) { $step->listen('\OC\Repair', 'warning', function ($description) use ($self) { @@ -206,15 +209,16 @@ 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->emit('\OC\Repair', 'startProgress', [$max, $this->currentStep]); } /** * @param int $step + * @param string $description */ - public function advance($step = 1) { + public function advance($step = 1, $description = '') { // for now just emit as we did in the past - $this->emit('\OC\Repair', 'advance', [$step]); + $this->emit('\OC\Repair', 'advance', [$step, $description]); } /** diff --git a/lib/public/migration/ioutput.php b/lib/public/migration/ioutput.php index c52f13b31dc..d3b43028495 100644 --- a/lib/public/migration/ioutput.php +++ b/lib/public/migration/ioutput.php @@ -48,9 +48,10 @@ interface IOutput { /** * @param int $step + * @param string $description * @since 9.1.0 */ - public function advance($step = 1); + public function advance($step = 1, $description = ''); /** * @param int $max -- cgit v1.2.3