mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/13740] Add backend support for install progress tracking
PHPBB3-13740
This commit is contained in:
@@ -30,6 +30,11 @@ class installer
|
||||
*/
|
||||
protected $installer_modules;
|
||||
|
||||
/**
|
||||
* @var \phpbb\install\helper\iohandler\iohandler_interface
|
||||
*/
|
||||
protected $iohandler;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -58,6 +63,16 @@ class installer
|
||||
$this->installer_modules = $modules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets input-output handler objects
|
||||
*
|
||||
* @param helper\iohandler\iohandler_interface $iohandler
|
||||
*/
|
||||
public function set_iohandler(\phpbb\install\helper\iohandler\iohandler_interface $iohandler)
|
||||
{
|
||||
$this->iohandler = $iohandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run phpBB installer
|
||||
*/
|
||||
@@ -69,6 +84,20 @@ class installer
|
||||
// Recover install progress
|
||||
$module_index = $this->recover_progress();
|
||||
|
||||
// Count all tasks in the current installer modules
|
||||
$task_count = 0;
|
||||
foreach ($this->installer_modules as $name)
|
||||
{
|
||||
/** @var \phpbb\install\module_interface $module */
|
||||
$module = $this->container->get($name);
|
||||
|
||||
$task_count += $module->get_task_count();
|
||||
}
|
||||
|
||||
// Set task count
|
||||
$this->install_config->set_task_progress_count($task_count);
|
||||
$this->iohandler->set_task_count($task_count);
|
||||
|
||||
$install_finished = false;
|
||||
|
||||
try
|
||||
@@ -107,11 +136,12 @@ class installer
|
||||
|
||||
if ($install_finished)
|
||||
{
|
||||
die ("install finished");
|
||||
// Send install finished message
|
||||
$this->iohandler->set_progress('INSTALLER_FINISHED', $this->install_config->get_task_progress_count());
|
||||
}
|
||||
else
|
||||
{
|
||||
die ("install memory or time limit reached");
|
||||
// @todo: Send refresh request
|
||||
}
|
||||
}
|
||||
catch (\phpbb\install\exception\user_interaction_required_exception $e)
|
||||
|
Reference in New Issue
Block a user