diff options
| author | Oliver Schramm <oliver.schramm97@gmail.com> | 2016-08-20 22:40:37 +0200 | 
|---|---|---|
| committer | Oliver Schramm <oliver.schramm97@gmail.com> | 2016-08-20 22:40:37 +0200 | 
| commit | a37f10ae0951f16b115f4a175cc546a515cf7937 (patch) | |
| tree | b8aade382cdf3718ecff6450089d8f2e9fdc3d9e /phpBB/phpbb | |
| parent | 88384a1e6313f827a098fcd90e3a7209cc6bb204 (diff) | |
| download | forums-a37f10ae0951f16b115f4a175cc546a515cf7937.tar forums-a37f10ae0951f16b115f4a175cc546a515cf7937.tar.gz forums-a37f10ae0951f16b115f4a175cc546a515cf7937.tar.bz2 forums-a37f10ae0951f16b115f4a175cc546a515cf7937.tar.xz forums-a37f10ae0951f16b115f4a175cc546a515cf7937.zip  | |
[ticket/14742] Increase user feedback by improving progress bar
We now count and display each step that was done
by increasing the task count.
PHPBB3-14742
Diffstat (limited to 'phpBB/phpbb')
| -rw-r--r-- | phpBB/phpbb/install/helper/iohandler/cli_iohandler.php | 11 | ||||
| -rw-r--r-- | phpBB/phpbb/install/module/update_database/task/update.php | 14 | 
2 files changed, 20 insertions, 5 deletions
diff --git a/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php b/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php index 2a41cb10ba..196cdcdaab 100644 --- a/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php +++ b/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php @@ -198,6 +198,16 @@ class cli_iohandler extends iohandler_base  		if ($this->output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL)  		{ +			if ($this->progress_bar !== null) +			{ +				// Symfony's ProgressBar is immutable regarding task_count, so delete the old and create a new one. +				$this->progress_bar->clear(); +			} +			else +			{ +				$this->io->newLine(2); +			} +  			$this->progress_bar = $this->io->createProgressBar($task_count);  			$this->progress_bar->setFormat(  				"    %current:3s%/%max:-3s% %bar%  %percent:3s%%\n" . @@ -212,7 +222,6 @@ class cli_iohandler extends iohandler_base  			}  			$this->progress_bar->setMessage(''); -			$this->io->newLine(2);  			$this->progress_bar->start();  		}  	} diff --git a/phpBB/phpbb/install/module/update_database/task/update.php b/phpBB/phpbb/install/module/update_database/task/update.php index c69dafaa10..9d7ba2f919 100644 --- a/phpBB/phpbb/install/module/update_database/task/update.php +++ b/phpBB/phpbb/install/module/update_database/task/update.php @@ -158,18 +158,23 @@ class update extends task_base  			try  			{  				$this->migrator->update(); +				$progress_count++;  				$last_run_migration = $this->migrator->get_last_run_migration();  				if (isset($last_run_migration['effectively_installed']) && $last_run_migration['effectively_installed'])  				{ -					$progress_count += 2; +					// We skipped two step, so increment $progress_count by another one +					$progress_count++;  				} -				else if (($last_run_migration['task'] === 'process_schema_step' && $last_run_migration['state']['migration_schema_done']) || -					($last_run_migration['task'] === 'process_data_step' && $last_run_migration['state']['migration_data_done'])) +				else if (($last_run_migration['task'] === 'process_schema_step' && !$last_run_migration['state']['migration_schema_done']) || +					($last_run_migration['task'] === 'process_data_step' && !$last_run_migration['state']['migration_data_done']))  				{ -					$progress_count++; +					// We just run a step that wasn't counted yet so make it count +					$migration_step_count++;  				} +				$this->iohandler->set_task_count($migration_step_count); +				$this->installer_config->set_task_progress_count($migration_step_count);  				$this->iohandler->set_progress('STAGE_UPDATE_DATABASE', $progress_count);  			}  			catch (exception $e) @@ -184,6 +189,7 @@ class update extends task_base  			if ($this->installer_config->get_time_remaining() <= 0 || $this->installer_config->get_memory_remaining() <= 0)  			{  				$this->installer_config->set('database_update_count', $progress_count); +				$this->installer_config->set('database_update_migration_steps', $migration_step_count);  				throw new resource_limit_reached_exception();  			}  		}  | 
