mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-25 12:33:29 +01:00
[ticket/14742] Further improve progress bar in db updater
PHPBB3-14742
This commit is contained in:
parent
0d1b7b3935
commit
758fe20f4b
@ -141,16 +141,17 @@ class update extends task_base
|
|||||||
|
|
||||||
$this->migrator->set_migrations($migrations);
|
$this->migrator->set_migrations($migrations);
|
||||||
|
|
||||||
$migration_count = $this->installer_config->get('database_update_migrations', -1);
|
$migration_step_count = $this->installer_config->get('database_update_migration_steps', -1);
|
||||||
if ($migration_count < 0)
|
if ($migration_step_count < 0)
|
||||||
{
|
{
|
||||||
$migration_count = count($this->migrator->get_installable_migrations());
|
$migration_step_count = count($this->migrator->get_installable_migrations()) * 2;
|
||||||
$this->installer_config->set('database_update_migrations', $migration_count);
|
$this->installer_config->set('database_update_migration_steps', $migration_step_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->iohandler->set_task_count($migration_count, true);
|
|
||||||
$this->installer_config->set_task_progress_count($migration_count);
|
|
||||||
$progress_count = $this->installer_config->get('database_update_count', 0);
|
$progress_count = $this->installer_config->get('database_update_count', 0);
|
||||||
|
$restart_progress_bar = ($progress_count === 0); // Only "restart" when the update runs for the first time
|
||||||
|
$this->iohandler->set_task_count($migration_step_count, $restart_progress_bar);
|
||||||
|
$this->installer_config->set_task_progress_count($migration_step_count);
|
||||||
|
|
||||||
while (!$this->migrator->finished())
|
while (!$this->migrator->finished())
|
||||||
{
|
{
|
||||||
@ -159,12 +160,17 @@ class update extends task_base
|
|||||||
$this->migrator->update();
|
$this->migrator->update();
|
||||||
|
|
||||||
$last_run_migration = $this->migrator->get_last_run_migration();
|
$last_run_migration = $this->migrator->get_last_run_migration();
|
||||||
|
if (isset($last_run_migration['effectively_installed']) && $last_run_migration['effectively_installed'])
|
||||||
if ($last_run_migration['state']['migration_data_done'])
|
{
|
||||||
|
$progress_count += 2;
|
||||||
|
}
|
||||||
|
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++;
|
$progress_count++;
|
||||||
$this->iohandler->set_progress('STAGE_UPDATE_DATABASE', $progress_count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->iohandler->set_progress('STAGE_UPDATE_DATABASE', $progress_count);
|
||||||
}
|
}
|
||||||
catch (exception $e)
|
catch (exception $e)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user