mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-25 20:58:55 +00:00
[ticket/13740] Tasks can appear as multiple steps for the progress bar
PHPBB3-13740
This commit is contained in:
parent
63c3500dac
commit
0dc6029bfe
27 changed files with 190 additions and 21 deletions
|
@ -1,5 +1,5 @@
|
|||
services:
|
||||
installer.filesystem.create_config:
|
||||
installer.install_filesystem.create_config_file:
|
||||
class: phpbb\install\module\install_filesystem\task\create_config_file
|
||||
arguments:
|
||||
- @filesystem
|
||||
|
@ -13,4 +13,4 @@ services:
|
|||
class: phpbb\install\module\install_filesystem\module
|
||||
parent: installer.module_base
|
||||
arguments:
|
||||
- ["installer.filesystem.create_config"]
|
||||
- ["installer.install_filesystem.create_config_file"]
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
services:
|
||||
installer.finish.populate_migrations:
|
||||
installer.install_finish.populate_migrations:
|
||||
class: phpbb\install\module\install_finish\task\populate_migrations
|
||||
arguments:
|
||||
- @installer.helper.container_factory
|
||||
|
||||
installer.finish.notify_user:
|
||||
installer.install_finish.notify_user:
|
||||
class: phpbb\install\module\install_finish\task\notify_user
|
||||
arguments:
|
||||
- @installer.helper.container_factory
|
||||
|
@ -17,4 +17,4 @@ services:
|
|||
class: phpbb\install\module\install_filesystem\module
|
||||
parent: installer.module_base
|
||||
arguments:
|
||||
- ["installer.finish.populate_migrations", "installer.finish.notify_user"]
|
||||
- ["installer.install_finish.populate_migrations", "installer.install_finish.notify_user"]
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
services:
|
||||
installer.obtain_data.admin:
|
||||
installer.obtain_data.obtain_admin_data:
|
||||
class: phpbb\install\module\obtain_data\task\obtain_admin_data
|
||||
arguments:
|
||||
- @installer.helper.config
|
||||
- @installer.helper.iohandler
|
||||
|
||||
installer.obtain_data.board:
|
||||
installer.obtain_data.obtain_board_data:
|
||||
class: phpbb\install\module\obtain_data\task\obtain_board_data
|
||||
arguments:
|
||||
- @installer.helper.config
|
||||
- @installer.helper.iohandler
|
||||
- @language.helper.language_file
|
||||
|
||||
installer.obtain_data.database:
|
||||
installer.obtain_data.obtain_database_data:
|
||||
class: phpbb\install\module\obtain_data\task\obtain_database_data
|
||||
arguments:
|
||||
- @installer.helper.database
|
||||
- @installer.helper.config
|
||||
- @installer.helper.iohandler
|
||||
|
||||
installer.obtain_data.email:
|
||||
installer.obtain_data.obtain_email_data:
|
||||
class: phpbb\install\module\obtain_data\task\obtain_email_data
|
||||
arguments:
|
||||
- @installer.helper.config
|
||||
- @installer.helper.iohandler
|
||||
|
||||
installer.obtain_data.imagick:
|
||||
installer.obtain_data.obtain_imagick_path:
|
||||
class: phpbb\install\module\obtain_data\task\obtain_imagick_path
|
||||
arguments:
|
||||
- @installer.helper.config
|
||||
|
||||
installer.obtain_data.server:
|
||||
installer.obtain_data.obtain_server_data:
|
||||
class: phpbb\install\module\obtain_data\task\obtain_server_data
|
||||
arguments:
|
||||
- @installer.helper.config
|
||||
|
@ -40,4 +40,4 @@ services:
|
|||
class: phpbb\install\module\obtain_data\module
|
||||
parent: installer.module_base
|
||||
arguments:
|
||||
- ["installer.obtain_data.admin", "installer.obtain_data.database", "installer.obtain_data.server", "installer.obtain_data.email", "installer.obtain_data.board", "installer.obtain_data.imagick"]
|
||||
- ["installer.obtain_data.obtain_admin_data", "installer.obtain_data.obtain_database_data", "installer.obtain_data.obtain_server_data", "installer.obtain_data.obtain_email_data", "installer.obtain_data.obtain_board_data", "installer.obtain_data.obtain_imagick_path"]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
services:
|
||||
installer.requirements.task.filesystem:
|
||||
installer.requirements.check_filesystem:
|
||||
class: phpbb\install\module\requirements\task\check_filesystem
|
||||
arguments:
|
||||
- @filesystem
|
||||
|
@ -7,7 +7,7 @@ services:
|
|||
- %core.root_path%
|
||||
- %core.php_ext%
|
||||
|
||||
installer.requirements.task.server:
|
||||
installer.requirements.check_server_environment:
|
||||
class: phpbb\install\module\requirements\task\check_server_environment
|
||||
arguments:
|
||||
- @installer.helper.database
|
||||
|
@ -17,4 +17,4 @@ services:
|
|||
class: phpbb\install\module\requirements\module
|
||||
parent: installer.module_base
|
||||
arguments:
|
||||
- ["installer.requirements.task.filesystem", "installer.requirements.task.server"]
|
||||
- ["installer.requirements.check_filesystem", "installer.requirements.check_server_environment"]
|
||||
|
|
|
@ -91,7 +91,7 @@ class installer
|
|||
/** @var \phpbb\install\module_interface $module */
|
||||
$module = $this->container->get($name);
|
||||
|
||||
$task_count += $module->get_task_count();
|
||||
$task_count += $module->get_step_count();
|
||||
}
|
||||
|
||||
// Set task count
|
||||
|
|
|
@ -222,6 +222,14 @@ class add_bots extends \phpbb\install\task_base
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -103,6 +103,14 @@ class add_languages extends \phpbb\install\task_base
|
|||
$insert_buffer->flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -450,6 +450,14 @@ class add_modules extends \phpbb\install\task_base
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -323,6 +323,14 @@ class add_config_settings extends \phpbb\install\task_base
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -143,6 +143,14 @@ class add_default_data extends \phpbb\install\task_base
|
|||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -196,6 +196,14 @@ class create_schema extends \phpbb\install\task_base
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -217,6 +217,14 @@ class create_config_file extends \phpbb\install\task_base
|
|||
return $config_content;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -111,6 +111,14 @@ class notify_user extends \phpbb\install\task_base
|
|||
@unlink($this->phpbb_root_path . 'cache/install_lock');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -52,6 +52,14 @@ class populate_migrations extends \phpbb\install\task_base
|
|||
$this->migrator->populate_migrations($migrations);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -56,7 +56,7 @@ class module extends \phpbb\install\module_base
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_task_count()
|
||||
public function get_step_count()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -201,6 +201,14 @@ class obtain_admin_data extends \phpbb\install\task_base implements \phpbb\insta
|
|||
return $data_valid;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -168,6 +168,14 @@ class obtain_board_data extends \phpbb\install\task_base implements \phpbb\insta
|
|||
throw new user_interaction_required_exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -253,6 +253,14 @@ class obtain_database_data extends \phpbb\install\task_base implements \phpbb\in
|
|||
return $data_valid;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -149,6 +149,14 @@ class obtain_email_data extends \phpbb\install\task_base implements \phpbb\insta
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -71,6 +71,14 @@ class obtain_imagick_path extends \phpbb\install\task_base implements \phpbb\ins
|
|||
$this->config->set('img_imagick', $img_imagick);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -185,6 +185,14 @@ class obtain_server_data extends \phpbb\install\task_base implements \phpbb\inst
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -66,7 +66,7 @@ class module extends \phpbb\install\module_base
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_task_count()
|
||||
public function get_step_count()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -255,6 +255,14 @@ class check_filesystem extends \phpbb\install\task_base
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -172,6 +172,14 @@ class check_server_environment extends \phpbb\install\task_base
|
|||
$this->set_test_passed(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -173,8 +173,28 @@ abstract class module_base implements module_interface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_task_count()
|
||||
public function get_step_count()
|
||||
{
|
||||
return sizeof($this->task_collection);
|
||||
$step_count = 0;
|
||||
|
||||
foreach ($this->task_collection as $task_service_name)
|
||||
{
|
||||
$task_service_name_parts = explode('.', $task_service_name);
|
||||
|
||||
if ($task_service_name_parts[0] !== 'installer')
|
||||
{
|
||||
// @todo throw an exception
|
||||
}
|
||||
|
||||
$class_name = '\\phpbb\\install\\module\\' . $task_service_name_parts[1] . '\\task\\' . $task_service_name_parts[2];
|
||||
if (!class_exists($class_name))
|
||||
{
|
||||
// @todo throw an exception
|
||||
}
|
||||
|
||||
$step_count += $class_name::get_step_count();
|
||||
}
|
||||
|
||||
return $step_count;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,5 +52,5 @@ interface module_interface
|
|||
*
|
||||
* @return int
|
||||
*/
|
||||
public function get_task_count();
|
||||
public function get_step_count();
|
||||
}
|
||||
|
|
|
@ -15,9 +15,22 @@ namespace phpbb\install;
|
|||
|
||||
/**
|
||||
* Interface for installer tasks
|
||||
*
|
||||
* Note: The task service ID must match up with the namespace and class name.
|
||||
* For example: if your task is located at \phpbb\install\module\module_name\task\task_name
|
||||
* then the service ID must be installer.module_name.task_name.
|
||||
*/
|
||||
interface task_interface
|
||||
{
|
||||
/**
|
||||
* Returns the number of steps the task contains
|
||||
*
|
||||
* This is a helper method to provide a better progress bar for the front-end.
|
||||
*
|
||||
* @return int The number of steps that the task contains
|
||||
*/
|
||||
static public function get_step_count();
|
||||
|
||||
/**
|
||||
* Checks if the task is essential to install phpBB or it can be skipped
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue