diff options
author | CHItA <mate.bartus@gmail.com> | 2015-06-04 00:43:08 +0200 |
---|---|---|
committer | Mate Bartus <mate.bartus@gmail.com> | 2015-07-08 01:28:01 +0200 |
commit | 0dc6029bfed10fac1a09a4fd8de7d1b31407693a (patch) | |
tree | 5a127646e3f48b4328cb9091c207c965b0c01034 /phpBB/install | |
parent | 63c3500dacc8d272e85273a67f56faa51a9d5fba (diff) | |
download | forums-0dc6029bfed10fac1a09a4fd8de7d1b31407693a.tar forums-0dc6029bfed10fac1a09a4fd8de7d1b31407693a.tar.gz forums-0dc6029bfed10fac1a09a4fd8de7d1b31407693a.tar.bz2 forums-0dc6029bfed10fac1a09a4fd8de7d1b31407693a.tar.xz forums-0dc6029bfed10fac1a09a4fd8de7d1b31407693a.zip |
[ticket/13740] Tasks can appear as multiple steps for the progress bar
PHPBB3-13740
Diffstat (limited to 'phpBB/install')
23 files changed, 175 insertions, 6 deletions
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() |