aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/install/controller/install.php6
-rw-r--r--phpBB/install/helper/config.php62
-rw-r--r--phpBB/install/helper/iohandler/iohandler_base.php39
-rw-r--r--phpBB/install/installer.php34
-rw-r--r--phpBB/install/module/install_data/task/add_bots.php8
-rw-r--r--phpBB/install/module/install_data/task/add_languages.php8
-rw-r--r--phpBB/install/module/install_data/task/add_modules.php8
-rw-r--r--phpBB/install/module/install_database/task/add_config_settings.php8
-rw-r--r--phpBB/install/module/install_database/task/add_default_data.php8
-rw-r--r--phpBB/install/module/install_database/task/create_schema.php8
-rw-r--r--phpBB/install/module/install_filesystem/task/create_config_file.php8
-rw-r--r--phpBB/install/module/install_finish/task/notify_user.php10
-rw-r--r--phpBB/install/module/install_finish/task/populate_migrations.php8
-rw-r--r--phpBB/install/module/obtain_data/task/obtain_admin_data.php8
-rw-r--r--phpBB/install/module/obtain_data/task/obtain_board_data.php8
-rw-r--r--phpBB/install/module/obtain_data/task/obtain_database_data.php8
-rw-r--r--phpBB/install/module/obtain_data/task/obtain_email_data.php8
-rw-r--r--phpBB/install/module/obtain_data/task/obtain_imagick_path.php8
-rw-r--r--phpBB/install/module/obtain_data/task/obtain_server_data.php8
-rw-r--r--phpBB/install/module/requirements/task/check_filesystem.php8
-rw-r--r--phpBB/install/module/requirements/task/check_server_environment.php8
-rw-r--r--phpBB/install/module_base.php17
-rw-r--r--phpBB/install/task_interface.php9
-rw-r--r--phpBB/language/en/install.php23
24 files changed, 306 insertions, 22 deletions
diff --git a/phpBB/install/controller/install.php b/phpBB/install/controller/install.php
index 12bc575b83..4021c5625b 100644
--- a/phpBB/install/controller/install.php
+++ b/phpBB/install/controller/install.php
@@ -85,8 +85,14 @@ class install
$this->iohandler_factory->set_environment('nojs');
}
+ // Set the appropriate input-output handler
+ //$this->installer->set_iohandler($this->iohandler_factory->get());
+
if ($this->request->is_ajax())
{
+ // @todo: remove this line, and use the above
+ $this->installer->set_iohandler($this->iohandler_factory->get());
+
$installer = $this->installer;
$response = new StreamedResponse();
$response->setCallback(function() use ($installer) {
diff --git a/phpBB/install/helper/config.php b/phpBB/install/helper/config.php
index b759df737e..f39e92b622 100644
--- a/phpBB/install/helper/config.php
+++ b/phpBB/install/helper/config.php
@@ -81,6 +81,8 @@ class config
'last_task_module_name' => '', // Stores the service name of the latest finished module
'last_task_index' => 0,
'last_task_name' => '', // Stores the service name of the latest finished task
+ 'max_task_progress' => 0,
+ 'current_task_progress' => 0,
);
$this->install_config_file = $this->phpbb_root_path . 'store/install_config.php';
@@ -108,8 +110,6 @@ class config
*
* @param string $param_name Name of the parameter
* @param mixed $value Values to set the parameter
- *
- * @return null
*/
public function set($param_name, $value)
{
@@ -161,8 +161,6 @@ class config
*
* @param string $task_service_name Name of the installer task service
* @param int $task_index Index of the task in the task list array
- *
- * @return null
*/
public function set_finished_task($task_service_name, $task_index)
{
@@ -175,8 +173,6 @@ class config
*
* @param string $module_service_name Name of the installer module service
* @param int $module_index Index of the module in the module list array
- *
- * @return null
*/
public function set_active_module($module_service_name, $module_index)
{
@@ -196,8 +192,6 @@ class config
/**
* Recovers install configuration from file
- *
- * @return null
*/
public function load_config()
{
@@ -216,8 +210,6 @@ class config
/**
* Dumps install configuration to disk
- *
- * @return null
*/
public function save_config()
{
@@ -239,9 +231,55 @@ class config
}
/**
- * Filling up system_data array
+ * Increments the task progress
+ */
+ public function increment_current_task_progress()
+ {
+ $this->progress_data['current_task_progress']++;
+ }
+
+ /**
+ * Sets the task progress to a specific number
*
- * @return null
+ * @param int $task_progress The task progress number to be set
+ */
+ public function set_current_task_progress($task_progress)
+ {
+ $this->progress_data['current_task_progress'] = $task_progress;
+ }
+
+ /**
+ * Sets the number of tasks belonging to the installer in the current mode.
+ *
+ * @param int $task_progress_count Number of tasks
+ */
+ public function set_task_progress_count($task_progress_count)
+ {
+ $this->progress_data['max_task_progress'] = $task_progress_count;
+ }
+
+ /**
+ * Returns the number of the current task being executed
+ *
+ * @return int
+ */
+ public function get_current_task_progress()
+ {
+ return $this->progress_data['current_task_progress'];
+ }
+
+ /**
+ * Returns the number of tasks belonging to the installer in the current mode.
+ *
+ * @return int
+ */
+ public function get_task_progress_count()
+ {
+ return $this->progress_data['max_task_progress'];
+ }
+
+ /**
+ * Filling up system_data array
*/
protected function setup_system_data()
{
diff --git a/phpBB/install/helper/iohandler/iohandler_base.php b/phpBB/install/helper/iohandler/iohandler_base.php
index c0e6921fb2..f767ecf4e9 100644
--- a/phpBB/install/helper/iohandler/iohandler_base.php
+++ b/phpBB/install/helper/iohandler/iohandler_base.php
@@ -49,6 +49,21 @@ abstract class iohandler_base implements iohandler_interface
protected $language;
/**
+ * @var int
+ */
+ protected $task_progress_count;
+
+ /**
+ * @var int
+ */
+ protected $current_task_progress;
+
+ /**
+ * @var string
+ */
+ protected $current_task_name;
+
+ /**
* Constructor
*/
public function __construct()
@@ -56,6 +71,10 @@ abstract class iohandler_base implements iohandler_interface
$this->errors = array();
$this->warnings = array();
$this->logs = array();
+
+ $this->task_progress_count = 0;
+ $this->current_task_progress = 0;
+ $this->current_task_name = '';
}
/**
@@ -93,6 +112,26 @@ abstract class iohandler_base implements iohandler_interface
}
/**
+ * {@inheritdoc}
+ */
+ public function set_task_count($task_count)
+ {
+ $this->task_progress_count = $task_count;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function set_progress($task_lang_key, $task_number)
+ {
+ if (!empty($task_lang_key))
+ {
+ $this->current_task_name = $this->language->lang($task_lang_key);
+ $this->current_task_progress = $task_number;
+ }
+ }
+
+ /**
* Localize message.
*
* Note: When an array is passed into the parameters below, it will be
diff --git a/phpBB/install/installer.php b/phpBB/install/installer.php
index 34bc4b23f7..4779bc43c4 100644
--- a/phpBB/install/installer.php
+++ b/phpBB/install/installer.php
@@ -31,6 +31,11 @@ class installer
protected $installer_modules;
/**
+ * @var \phpbb\install\helper\iohandler\iohandler_interface
+ */
+ protected $iohandler;
+
+ /**
* Constructor
*
* @param \phpbb\install\helper\config $config Installer config handler
@@ -59,6 +64,16 @@ class installer
}
/**
+ * 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
*/
public function run()
@@ -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)
diff --git a/phpBB/install/module/install_data/task/add_bots.php b/phpBB/install/module/install_data/task/add_bots.php
index 8ce4ae765d..cba228bdba 100644
--- a/phpBB/install/module/install_data/task/add_bots.php
+++ b/phpBB/install/module/install_data/task/add_bots.php
@@ -221,4 +221,12 @@ class add_bots extends \phpbb\install\task_base
$this->db->sql_query($sql);
}
}
+
+ /**
+ * {@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 9502a736f3..8418829ca6 100644
--- a/phpBB/install/module/install_data/task/add_languages.php
+++ b/phpBB/install/module/install_data/task/add_languages.php
@@ -102,4 +102,12 @@ class add_languages extends \phpbb\install\task_base
$insert_buffer->flush();
}
+
+ /**
+ * {@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 98b52d7494..d47c2cd106 100644
--- a/phpBB/install/module/install_data/task/add_modules.php
+++ b/phpBB/install/module/install_data/task/add_modules.php
@@ -449,4 +449,12 @@ class add_modules extends \phpbb\install\task_base
$this->module_manager->remove_cache_file($module_class);
}
}
+
+ /**
+ * {@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 38dcef1d7a..be008da1d2 100644
--- a/phpBB/install/module/install_database/task/add_config_settings.php
+++ b/phpBB/install/module/install_database/task/add_config_settings.php
@@ -322,4 +322,12 @@ class add_config_settings extends \phpbb\install\task_base
}
}
}
+
+ /**
+ * {@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 a5c2ffecd1..c6ca3b5c87 100644
--- a/phpBB/install/module/install_database/task/add_default_data.php
+++ b/phpBB/install/module/install_database/task/add_default_data.php
@@ -142,4 +142,12 @@ class add_default_data extends \phpbb\install\task_base
return '';
}
+
+ /**
+ * {@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 aac710d337..e17f0d08d9 100644
--- a/phpBB/install/module/install_database/task/create_schema.php
+++ b/phpBB/install/module/install_database/task/create_schema.php
@@ -195,4 +195,12 @@ class create_schema extends \phpbb\install\task_base
);
}
}
+
+ /**
+ * {@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 f1191f53d0..b0afa9a7fc 100644
--- a/phpBB/install/module/install_filesystem/task/create_config_file.php
+++ b/phpBB/install/module/install_filesystem/task/create_config_file.php
@@ -216,4 +216,12 @@ class create_config_file extends \phpbb\install\task_base
return $config_content;
}
+
+ /**
+ * {@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 d95303fcb5..c39e561c56 100644
--- a/phpBB/install/module/install_finish/task/notify_user.php
+++ b/phpBB/install/module/install_finish/task/notify_user.php
@@ -101,7 +101,7 @@ class notify_user extends \phpbb\install\task_base
$messenger->anti_abuse_headers($this->config, $this->user);
$messenger->assign_vars(array(
'USERNAME' => htmlspecialchars_decode($this->install_config->get('admin_name')),
- 'PASSWORD' => htmlspecialchars_decode($this->install_config->get('admin_pass1')))
+ 'PASSWORD' => htmlspecialchars_decode($this->install_config->get('admin_passwd')))
);
$messenger->send(NOTIFY_EMAIL);
}
@@ -110,4 +110,12 @@ class notify_user extends \phpbb\install\task_base
@unlink($this->phpbb_root_path . 'cache/install_lock');
}
+
+ /**
+ * {@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 4f701b84ca..1441351bf8 100644
--- a/phpBB/install/module/install_finish/task/populate_migrations.php
+++ b/phpBB/install/module/install_finish/task/populate_migrations.php
@@ -51,4 +51,12 @@ class populate_migrations extends \phpbb\install\task_base
->get_classes();
$this->migrator->populate_migrations($migrations);
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_task_lang_name()
+ {
+ return 'TASK_POPULATE_MIGRATIONS';
+ }
}
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 6745419eb2..4b070aa19b 100644
--- a/phpBB/install/module/obtain_data/task/obtain_admin_data.php
+++ b/phpBB/install/module/obtain_data/task/obtain_admin_data.php
@@ -200,4 +200,12 @@ class obtain_admin_data extends \phpbb\install\task_base implements \phpbb\insta
return $data_valid;
}
+
+ /**
+ * {@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 5415d152a7..8a2507f073 100644
--- a/phpBB/install/module/obtain_data/task/obtain_board_data.php
+++ b/phpBB/install/module/obtain_data/task/obtain_board_data.php
@@ -167,4 +167,12 @@ class obtain_board_data extends \phpbb\install\task_base implements \phpbb\insta
$this->io_handler->send_response();
throw new user_interaction_required_exception;
}
+
+ /**
+ * {@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 c8bdff4bf8..38a6dac0c2 100644
--- a/phpBB/install/module/obtain_data/task/obtain_database_data.php
+++ b/phpBB/install/module/obtain_data/task/obtain_database_data.php
@@ -252,4 +252,12 @@ class obtain_database_data extends \phpbb\install\task_base implements \phpbb\in
return $data_valid;
}
+
+ /**
+ * {@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 fbcef0a5c6..9a3edefd54 100644
--- a/phpBB/install/module/obtain_data/task/obtain_email_data.php
+++ b/phpBB/install/module/obtain_data/task/obtain_email_data.php
@@ -148,4 +148,12 @@ class obtain_email_data extends \phpbb\install\task_base implements \phpbb\insta
throw new user_interaction_required_exception();
}
}
+
+ /**
+ * {@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 86af586e37..15570eac43 100644
--- a/phpBB/install/module/obtain_data/task/obtain_imagick_path.php
+++ b/phpBB/install/module/obtain_data/task/obtain_imagick_path.php
@@ -70,4 +70,12 @@ class obtain_imagick_path extends \phpbb\install\task_base implements \phpbb\ins
$this->config->set('img_imagick', $img_imagick);
}
+
+ /**
+ * {@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 39606f6281..3f5a1c769f 100644
--- a/phpBB/install/module/obtain_data/task/obtain_server_data.php
+++ b/phpBB/install/module/obtain_data/task/obtain_server_data.php
@@ -184,4 +184,12 @@ class obtain_server_data extends \phpbb\install\task_base implements \phpbb\inst
throw new user_interaction_required_exception();
}
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_task_lang_name()
+ {
+ return '';
+ }
}
diff --git a/phpBB/install/module/requirements/task/check_filesystem.php b/phpBB/install/module/requirements/task/check_filesystem.php
index 1c76ed146e..dea59d618e 100644
--- a/phpBB/install/module/requirements/task/check_filesystem.php
+++ b/phpBB/install/module/requirements/task/check_filesystem.php
@@ -254,4 +254,12 @@ class check_filesystem extends \phpbb\install\task_base
}
}
}
+
+ /**
+ * {@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 4bfea57b0e..f8dde51883 100644
--- a/phpBB/install/module/requirements/task/check_server_environment.php
+++ b/phpBB/install/module/requirements/task/check_server_environment.php
@@ -171,4 +171,12 @@ class check_server_environment extends \phpbb\install\task_base
$this->set_test_passed(false);
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_task_lang_name()
+ {
+ return '';
+ }
}
diff --git a/phpBB/install/module_base.php b/phpBB/install/module_base.php
index a34a103aca..3629903747 100644
--- a/phpBB/install/module_base.php
+++ b/phpBB/install/module_base.php
@@ -110,8 +110,15 @@ abstract class module_base implements module_interface
/** @var \phpbb\install\task_interface $task */
$task = $this->container->get($this->task_collection[$task_index]);
+ // Send progress information
+ $this->iohandler->set_progress(
+ $task->get_task_lang_name(),
+ $this->install_config->get_current_task_progress()
+ );
+
// Iterate to the next task
$task_index++;
+ $this->install_config->increment_current_task_progress();
// Check if we can run the task
if (!$task->is_essential() && !$task->check_requirements())
@@ -121,11 +128,11 @@ abstract class module_base implements module_interface
$task->run();
- // Increment progress
- if ($this->get_task_count() !== 0)
- {
- //$this->iohandler->increment_progress();
- }
+ // Send progress info
+ $this->iohandler->set_progress(
+ $task->get_task_lang_name(),
+ $this->install_config->get_current_task_progress()
+ );
$this->iohandler->send_response();
diff --git a/phpBB/install/task_interface.php b/phpBB/install/task_interface.php
index 9cfc4d19c2..6f0a01258f 100644
--- a/phpBB/install/task_interface.php
+++ b/phpBB/install/task_interface.php
@@ -40,8 +40,13 @@ interface task_interface
/**
* Executes the task
- *
- * @return null
*/
public function run();
+
+ /**
+ * Returns the language key of the name of the task
+ *
+ * @return string
+ */
+ public function get_task_lang_name();
}
diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php
index 59ad1b0d41..e3c4b859f0 100644
--- a/phpBB/language/en/install.php
+++ b/phpBB/language/en/install.php
@@ -226,3 +226,26 @@ $lang = array_merge($lang, array(
'MENU_LICENSE' => 'License',
'MENU_SUPPORT' => 'Support',
));
+
+// Task names
+$lang = array_merge($lang, array(
+ // Install filesystem
+ 'TASK_CREATE_CONFIG_FILE' => 'Creating configuration file',
+
+ // Install database
+ 'TASK_ADD_CONFIG_SETTINGS' => 'Adding configuration settings',
+ 'TASK_ADD_DEFAULT_DATA' => 'Adding default settings to the database',
+ 'TASK_CREATE_DATABASE_SCHEMA' => 'Creating database schema',
+
+ // Install data
+ 'TASK_ADD_BOTS' => 'Registering bots',
+ 'TASK_ADD_LANGUAGES' => 'Installing available languages',
+ 'TASK_ADD_MODULES' => 'Installing modules',
+
+ // Install finish tasks
+ 'TASK_NOTIFY_USER' => 'Sending notification e-mail',
+ 'TASK_POPULATE_MIGRATIONS' => 'Populating migrations',
+
+ // Installer general progress messages
+ 'INSTALLER_FINISHED' => 'The installer has finished successfully',
+));