diff options
27 files changed, 190 insertions, 21 deletions
diff --git a/phpBB/config/installer/container/services_install_filesystem.yml b/phpBB/config/installer/container/services_install_filesystem.yml index 24497d330a..077b1ccb98 100644 --- a/phpBB/config/installer/container/services_install_filesystem.yml +++ b/phpBB/config/installer/container/services_install_filesystem.yml @@ -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"] diff --git a/phpBB/config/installer/container/services_install_finish.yml b/phpBB/config/installer/container/services_install_finish.yml index 20cd60983b..d2002f9fd7 100644 --- a/phpBB/config/installer/container/services_install_finish.yml +++ b/phpBB/config/installer/container/services_install_finish.yml @@ -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"] diff --git a/phpBB/config/installer/container/services_install_obtain_data.yml b/phpBB/config/installer/container/services_install_obtain_data.yml index 2800392c58..2cfe210309 100644 --- a/phpBB/config/installer/container/services_install_obtain_data.yml +++ b/phpBB/config/installer/container/services_install_obtain_data.yml @@ -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"] diff --git a/phpBB/config/installer/container/services_install_requirements.yml b/phpBB/config/installer/container/services_install_requirements.yml index afbe341c06..89c517c0cd 100644 --- a/phpBB/config/installer/container/services_install_requirements.yml +++ b/phpBB/config/installer/container/services_install_requirements.yml @@ -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"] diff --git a/phpBB/install/installer.php b/phpBB/install/installer.php index 4779bc43c4..cb3dacfbe0 100644 --- a/phpBB/install/installer.php +++ b/phpBB/install/installer.php @@ -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 diff --git a/phpBB/install/module/install_data/task/add_bots.php b/phpBB/install/module/install_data/task/add_bots.php index cba228bdba..c31700e97f 100644 --- a/phpBB/install/module/install_data/task/add_bots.php +++ b/phpBB/install/module/install_data/task/add_bots.php @@ -225,6 +225,14 @@ class add_bots extends \phpbb\install\task_base /** * {@inheritdoc} */ + static public function get_step_count() + { + return 1; + } + + /** + * {@inheritdoc} + */ public function get_task_lang_name() { return 'TASK_ADD_BOTS'; diff --git a/phpBB/install/module/install_data/task/add_languages.php b/phpBB/install/module/install_data/task/add_languages.php index 8418829ca6..7ffdf4f276 100644 --- a/phpBB/install/module/install_data/task/add_languages.php +++ b/phpBB/install/module/install_data/task/add_languages.php @@ -106,6 +106,14 @@ class add_languages extends \phpbb\install\task_base /** * {@inheritdoc} */ + static public function get_step_count() + { + return 1; + } + + /** + * {@inheritdoc} + */ public function get_task_lang_name() { return 'TASK_ADD_LANGUAGES'; diff --git a/phpBB/install/module/install_data/task/add_modules.php b/phpBB/install/module/install_data/task/add_modules.php index d47c2cd106..6a77f8973b 100644 --- a/phpBB/install/module/install_data/task/add_modules.php +++ b/phpBB/install/module/install_data/task/add_modules.php @@ -453,6 +453,14 @@ class add_modules extends \phpbb\install\task_base /** * {@inheritdoc} */ + static public function get_step_count() + { + return 1; + } + + /** + * {@inheritdoc} + */ public function get_task_lang_name() { return 'TASK_ADD_MODULES'; diff --git a/phpBB/install/module/install_database/task/add_config_settings.php b/phpBB/install/module/install_database/task/add_config_settings.php index be008da1d2..25da36e01d 100644 --- a/phpBB/install/module/install_database/task/add_config_settings.php +++ b/phpBB/install/module/install_database/task/add_config_settings.php @@ -326,6 +326,14 @@ class add_config_settings extends \phpbb\install\task_base /** * {@inheritdoc} */ + static public function get_step_count() + { + return 1; + } + + /** + * {@inheritdoc} + */ public function get_task_lang_name() { return 'TASK_ADD_CONFIG_SETTINGS'; diff --git a/phpBB/install/module/install_database/task/add_default_data.php b/phpBB/install/module/install_database/task/add_default_data.php index c6ca3b5c87..5dbfbb4478 100644 --- a/phpBB/install/module/install_database/task/add_default_data.php +++ b/phpBB/install/module/install_database/task/add_default_data.php @@ -146,6 +146,14 @@ class add_default_data extends \phpbb\install\task_base /** * {@inheritdoc} */ + static public function get_step_count() + { + return 1; + } + + /** + * {@inheritdoc} + */ public function get_task_lang_name() { return 'TASK_ADD_DEFAULT_DATA'; diff --git a/phpBB/install/module/install_database/task/create_schema.php b/phpBB/install/module/install_database/task/create_schema.php index e17f0d08d9..7cc521eee8 100644 --- a/phpBB/install/module/install_database/task/create_schema.php +++ b/phpBB/install/module/install_database/task/create_schema.php @@ -199,6 +199,14 @@ class create_schema extends \phpbb\install\task_base /** * {@inheritdoc} */ + static public function get_step_count() + { + return 1; + } + + /** + * {@inheritdoc} + */ public function get_task_lang_name() { return 'TASK_CREATE_DATABASE_SCHEMA'; diff --git a/phpBB/install/module/install_filesystem/task/create_config_file.php b/phpBB/install/module/install_filesystem/task/create_config_file.php index b0afa9a7fc..337d401216 100644 --- a/phpBB/install/module/install_filesystem/task/create_config_file.php +++ b/phpBB/install/module/install_filesystem/task/create_config_file.php @@ -220,6 +220,14 @@ class create_config_file extends \phpbb\install\task_base /** * {@inheritdoc} */ + static public function get_step_count() + { + return 1; + } + + /** + * {@inheritdoc} + */ public function get_task_lang_name() { return 'TASK_CREATE_CONFIG_FILE'; diff --git a/phpBB/install/module/install_finish/task/notify_user.php b/phpBB/install/module/install_finish/task/notify_user.php index c39e561c56..4ab6ec56c6 100644 --- a/phpBB/install/module/install_finish/task/notify_user.php +++ b/phpBB/install/module/install_finish/task/notify_user.php @@ -114,6 +114,14 @@ class notify_user extends \phpbb\install\task_base /** * {@inheritdoc} */ + static public function get_step_count() + { + return 1; + } + + /** + * {@inheritdoc} + */ public function get_task_lang_name() { return 'TASK_NOTIFY_USER'; diff --git a/phpBB/install/module/install_finish/task/populate_migrations.php b/phpBB/install/module/install_finish/task/populate_migrations.php index 1441351bf8..b2a4800f86 100644 --- a/phpBB/install/module/install_finish/task/populate_migrations.php +++ b/phpBB/install/module/install_finish/task/populate_migrations.php @@ -55,6 +55,14 @@ class populate_migrations extends \phpbb\install\task_base /** * {@inheritdoc} */ + static public function get_step_count() + { + return 1; + } + + /** + * {@inheritdoc} + */ public function get_task_lang_name() { return 'TASK_POPULATE_MIGRATIONS'; diff --git a/phpBB/install/module/obtain_data/module.php b/phpBB/install/module/obtain_data/module.php index 9a3307cd6f..d846593315 100644 --- a/phpBB/install/module/obtain_data/module.php +++ b/phpBB/install/module/obtain_data/module.php @@ -56,7 +56,7 @@ class module extends \phpbb\install\module_base /** * {@inheritdoc} */ - public function get_task_count() + public function get_step_count() { return 0; } diff --git a/phpBB/install/module/obtain_data/task/obtain_admin_data.php b/phpBB/install/module/obtain_data/task/obtain_admin_data.php index 4b070aa19b..b2250e524b 100644 --- a/phpBB/install/module/obtain_data/task/obtain_admin_data.php +++ b/phpBB/install/module/obtain_data/task/obtain_admin_data.php @@ -204,6 +204,14 @@ class obtain_admin_data extends \phpbb\install\task_base implements \phpbb\insta /** * {@inheritdoc} */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ public function get_task_lang_name() { return ''; diff --git a/phpBB/install/module/obtain_data/task/obtain_board_data.php b/phpBB/install/module/obtain_data/task/obtain_board_data.php index 8a2507f073..821c221123 100644 --- a/phpBB/install/module/obtain_data/task/obtain_board_data.php +++ b/phpBB/install/module/obtain_data/task/obtain_board_data.php @@ -171,6 +171,14 @@ class obtain_board_data extends \phpbb\install\task_base implements \phpbb\insta /** * {@inheritdoc} */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ public function get_task_lang_name() { return ''; diff --git a/phpBB/install/module/obtain_data/task/obtain_database_data.php b/phpBB/install/module/obtain_data/task/obtain_database_data.php index 38a6dac0c2..0c1146d9f5 100644 --- a/phpBB/install/module/obtain_data/task/obtain_database_data.php +++ b/phpBB/install/module/obtain_data/task/obtain_database_data.php @@ -256,6 +256,14 @@ class obtain_database_data extends \phpbb\install\task_base implements \phpbb\in /** * {@inheritdoc} */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ public function get_task_lang_name() { return ''; diff --git a/phpBB/install/module/obtain_data/task/obtain_email_data.php b/phpBB/install/module/obtain_data/task/obtain_email_data.php index 9a3edefd54..ae7526a9e3 100644 --- a/phpBB/install/module/obtain_data/task/obtain_email_data.php +++ b/phpBB/install/module/obtain_data/task/obtain_email_data.php @@ -152,6 +152,14 @@ class obtain_email_data extends \phpbb\install\task_base implements \phpbb\insta /** * {@inheritdoc} */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ public function get_task_lang_name() { return ''; diff --git a/phpBB/install/module/obtain_data/task/obtain_imagick_path.php b/phpBB/install/module/obtain_data/task/obtain_imagick_path.php index 15570eac43..9f74b61770 100644 --- a/phpBB/install/module/obtain_data/task/obtain_imagick_path.php +++ b/phpBB/install/module/obtain_data/task/obtain_imagick_path.php @@ -74,6 +74,14 @@ class obtain_imagick_path extends \phpbb\install\task_base implements \phpbb\ins /** * {@inheritdoc} */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ public function get_task_lang_name() { return ''; diff --git a/phpBB/install/module/obtain_data/task/obtain_server_data.php b/phpBB/install/module/obtain_data/task/obtain_server_data.php index 3f5a1c769f..2d1e37b10e 100644 --- a/phpBB/install/module/obtain_data/task/obtain_server_data.php +++ b/phpBB/install/module/obtain_data/task/obtain_server_data.php @@ -188,6 +188,14 @@ class obtain_server_data extends \phpbb\install\task_base implements \phpbb\inst /** * {@inheritdoc} */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ public function get_task_lang_name() { return ''; diff --git a/phpBB/install/module/requirements/module.php b/phpBB/install/module/requirements/module.php index aae8c75cbe..f3d1cc71ec 100644 --- a/phpBB/install/module/requirements/module.php +++ b/phpBB/install/module/requirements/module.php @@ -66,7 +66,7 @@ class module extends \phpbb\install\module_base /** * {@inheritdoc} */ - public function get_task_count() + public function get_step_count() { return 0; } diff --git a/phpBB/install/module/requirements/task/check_filesystem.php b/phpBB/install/module/requirements/task/check_filesystem.php index dea59d618e..5b944b8415 100644 --- a/phpBB/install/module/requirements/task/check_filesystem.php +++ b/phpBB/install/module/requirements/task/check_filesystem.php @@ -258,6 +258,14 @@ class check_filesystem extends \phpbb\install\task_base /** * {@inheritdoc} */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ public function get_task_lang_name() { return ''; diff --git a/phpBB/install/module/requirements/task/check_server_environment.php b/phpBB/install/module/requirements/task/check_server_environment.php index f8dde51883..50efdc55a2 100644 --- a/phpBB/install/module/requirements/task/check_server_environment.php +++ b/phpBB/install/module/requirements/task/check_server_environment.php @@ -175,6 +175,14 @@ class check_server_environment extends \phpbb\install\task_base /** * {@inheritdoc} */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ public function get_task_lang_name() { return ''; diff --git a/phpBB/install/module_base.php b/phpBB/install/module_base.php index 3629903747..179884c039 100644 --- a/phpBB/install/module_base.php +++ b/phpBB/install/module_base.php @@ -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; } } diff --git a/phpBB/install/module_interface.php b/phpBB/install/module_interface.php index e0ec4e4347..29918f0c34 100644 --- a/phpBB/install/module_interface.php +++ b/phpBB/install/module_interface.php @@ -52,5 +52,5 @@ interface module_interface * * @return int */ - public function get_task_count(); + public function get_step_count(); } diff --git a/phpBB/install/task_interface.php b/phpBB/install/task_interface.php index 6f0a01258f..14cde23a56 100644 --- a/phpBB/install/task_interface.php +++ b/phpBB/install/task_interface.php @@ -15,10 +15,23 @@ 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 * * Note: Please note that all the non-essential modules have to implement check_requirements() |