From 3dcaa48850bf823b238391fbf9c3f085092010bc Mon Sep 17 00:00:00 2001 From: CHItA Date: Sat, 13 Jun 2015 15:35:19 +0200 Subject: [ticket/13740] Move installer files to phpbb/install directory PHPBB3-13740 --- phpBB/phpbb/install/installer.php | 286 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 286 insertions(+) create mode 100644 phpBB/phpbb/install/installer.php (limited to 'phpBB/phpbb/install/installer.php') diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php new file mode 100644 index 0000000000..f5da898a00 --- /dev/null +++ b/phpBB/phpbb/install/installer.php @@ -0,0 +1,286 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install; + +use phpbb\install\exception\installer_config_not_writable_exception; +use phpbb\install\exception\invalid_service_name_exception; +use phpbb\install\exception\module_not_found_exception; +use phpbb\install\exception\task_not_found_exception; +use phpbb\install\exception\user_interaction_required_exception; +use phpbb\install\helper\config; +use phpbb\install\helper\iohandler\iohandler_interface; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; + +class installer +{ + /** + * @var ContainerInterface + */ + protected $container; + + /** + * @var config + */ + protected $install_config; + + /** + * @var array + */ + protected $installer_modules; + + /** + * @var iohandler_interface + */ + protected $iohandler; + + /** + * Stores the number of steps that a given module has + * + * @var array + */ + protected $module_step_count; + + /** + * Constructor + * + * @param config $config Installer config handler + * @param ContainerInterface $container Dependency injection container + */ + public function __construct(config $config, ContainerInterface $container) + { + $this->install_config = $config; + $this->container = $container; + $this->installer_modules = array(); + } + + /** + * Sets modules to execute + * + * Note: The installer will run modules in the order they are set in + * the array. + * + * @param array $modules Array of module service names + */ + public function set_modules($modules) + { + $modules = (array) $modules; + + $this->installer_modules = $modules; + } + + /** + * Sets input-output handler objects + * + * @param iohandler_interface $iohandler + */ + public function set_iohandler(iohandler_interface $iohandler) + { + $this->iohandler = $iohandler; + } + + /** + * Run phpBB installer + */ + public function run() + { + // Load install progress + $this->install_config->load_config(); + + // Recover install progress + $module_index = $this->recover_progress(); + + // Variable used to check if the install process have been finished + $install_finished = false; + + // Flag used by exception handling, whether or not we need to flush output buffer once again + $flush_messages = false; + + // We are installing something, so the introduction stage can go now... + $this->install_config->set_finished_navigation_stage(array('install', 0, 'introduction')); + $this->iohandler->set_finished_stage_menu(array('install', 0, 'introduction')); + + try + { + if ($this->install_config->get_task_progress_count() === 0) + { + // Count all tasks in the current installer modules + $step_count = 0; + foreach ($this->installer_modules as $index => $name) + { + try + { + /** @var \phpbb\install\module_interface $module */ + $module = $this->container->get($name); + } + catch (InvalidArgumentException $e) + { + throw new module_not_found_exception($name); + } + + $module_step_count = $module->get_step_count(); + $step_count += $module_step_count; + $this->module_step_count[$index] = $module_step_count; + } + + // Set task count + $this->install_config->set_task_progress_count($step_count); + } + + // Set up progress information + $this->iohandler->set_task_count( + $this->install_config->get_task_progress_count() + ); + + // Run until there are available resources + while ($this->install_config->get_time_remaining() > 0 && $this->install_config->get_memory_remaining() > 0) + { + // Check if module exists, if not the install is completed + if (!isset($this->installer_modules[$module_index])) + { + $install_finished = true; + break; + } + + // Log progress + $module_service_name = $this->installer_modules[$module_index]; + $this->install_config->set_active_module($module_service_name, $module_index); + + // Get module from container + try + { + /** @var \phpbb\install\module_interface $module */ + $module = $this->container->get($module_service_name); + } + catch (InvalidArgumentException $e) + { + throw new module_not_found_exception($module_service_name); + } + + $module_index++; + + // Check if module should be executed + if (!$module->is_essential() && !$module->check_requirements()) + { + $this->install_config->set_finished_navigation_stage($module->get_navigation_stage_path()); + $this->iohandler->set_finished_stage_menu($module->get_navigation_stage_path()); + + $this->iohandler->add_log_message(array( + 'SKIP_MODULE', + $module_service_name, + )); + $this->install_config->increment_current_task_progress($this->module_step_count[$module_index - 1]); + continue; + } + + // Set the correct stage in the navigation bar + $this->install_config->set_active_navigation_stage($module->get_navigation_stage_path()); + $this->iohandler->set_active_stage_menu($module->get_navigation_stage_path()); + + $module->run(); + + $this->install_config->set_finished_navigation_stage($module->get_navigation_stage_path()); + $this->iohandler->set_finished_stage_menu($module->get_navigation_stage_path()); + + // Clear task progress + $this->install_config->set_finished_task('', 0); + } + + if ($install_finished) + { + // Send install finished message + $this->iohandler->set_progress('INSTALLER_FINISHED', $this->install_config->get_task_progress_count()); + } + else + { + $this->iohandler->request_refresh(); + } + } + catch (user_interaction_required_exception $e) + { + // Do nothing + } + catch (module_not_found_exception $e) + { + $this->iohandler->add_error_message('MODULE_NOT_FOUND', array( + 'MODULE_NOT_FOUND_DESCRIPTION', + $e->get_module_service_name(), + )); + $flush_messages = true; + } + catch (task_not_found_exception $e) + { + $this->iohandler->add_error_message('TASK_NOT_FOUND', array( + 'TASK_NOT_FOUND_DESCRIPTION', + $e->get_task_service_name(), + )); + $flush_messages = true; + } + catch (invalid_service_name_exception $e) + { + if ($e->has_params()) + { + $msg = $e->get_params(); + array_unshift($msg, $e->get_error()); + } + else + { + $msg = $e->get_error(); + } + + $this->iohandler->add_error_message($msg); + $flush_messages = true; + } + + if ($flush_messages) + { + $this->iohandler->send_response(); + } + + // Save install progress + try + { + $this->install_config->save_config(); + } + catch (installer_config_not_writable_exception $e) + { + // It is allowed to fail this test during requirements testing + $progress_data = $this->install_config->get_progress_data(); + + if ($progress_data['last_task_module_name'] !== 'installer.module.requirements_install') + { + $this->iohandler->add_error_message('INSTALLER_CONFIG_NOT_WRITABLE'); + } + } + } + + /** + * Recover install progress + * + * @return int Index of the next installer module to execute + */ + protected function recover_progress() + { + $progress_array = $this->install_config->get_progress_data(); + $module_service = $progress_array['last_task_module_name']; + $module_index = $progress_array['last_task_module_index']; + + if ($this->installer_modules[$module_index] === $module_service) + { + return $module_index; + } + + return 0; + } +} -- cgit v1.2.1 From c53ce3d5fbfcdc9924426aee74fb1097138a8a42 Mon Sep 17 00:00:00 2001 From: CHItA Date: Wed, 17 Jun 2015 11:00:07 +0200 Subject: [ticket/13740] Fix CS and extend phpbb extensions [ci skip] PHPBB3-13740 --- phpBB/phpbb/install/installer.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'phpBB/phpbb/install/installer.php') diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index f5da898a00..d64713e6a3 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -229,17 +229,18 @@ class installer } catch (invalid_service_name_exception $e) { - if ($e->has_params()) + $params = $e->get_parameters(); + + if (!empty($params)) { - $msg = $e->get_params(); - array_unshift($msg, $e->get_error()); + array_unshift($params, $e->getMessage()); } else { - $msg = $e->get_error(); + $params = $e->getMessage(); } - $this->iohandler->add_error_message($msg); + $this->iohandler->add_error_message($params); $flush_messages = true; } -- cgit v1.2.1 From 62103cec300ddadb904862ee2a74d68f71eb32ca Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 9 Jul 2015 15:26:48 +0200 Subject: [ticket/13740] Use service collection instead of array of task names PHPBB3-13740 --- phpBB/phpbb/install/installer.php | 146 +++++++++++++++----------------------- 1 file changed, 57 insertions(+), 89 deletions(-) (limited to 'phpBB/phpbb/install/installer.php') diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index d64713e6a3..3e73d90453 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -13,10 +13,10 @@ namespace phpbb\install; +use phpbb\di\ordered_service_collection; use phpbb\install\exception\installer_config_not_writable_exception; use phpbb\install\exception\invalid_service_name_exception; -use phpbb\install\exception\module_not_found_exception; -use phpbb\install\exception\task_not_found_exception; +use phpbb\install\exception\resource_limit_reached_exception; use phpbb\install\exception\user_interaction_required_exception; use phpbb\install\helper\config; use phpbb\install\helper\iohandler\iohandler_interface; @@ -62,7 +62,7 @@ class installer { $this->install_config = $config; $this->container = $container; - $this->installer_modules = array(); + $this->installer_modules = null; } /** @@ -71,12 +71,10 @@ class installer * Note: The installer will run modules in the order they are set in * the array. * - * @param array $modules Array of module service names + * @param ordered_service_collection $modules Service collection of module service names */ - public function set_modules($modules) + public function set_modules(ordered_service_collection $modules) { - $modules = (array) $modules; - $this->installer_modules = $modules; } @@ -99,7 +97,8 @@ class installer $this->install_config->load_config(); // Recover install progress - $module_index = $this->recover_progress(); + $module_name = $this->recover_progress(); + $module_found = false; // Variable used to check if the install process have been finished $install_finished = false; @@ -111,64 +110,53 @@ class installer $this->install_config->set_finished_navigation_stage(array('install', 0, 'introduction')); $this->iohandler->set_finished_stage_menu(array('install', 0, 'introduction')); + if ($this->install_config->get_task_progress_count() === 0) + { + // Count all tasks in the current installer modules + $step_count = 0; + + /** @var \phpbb\install\module_interface $module */ + foreach ($this->installer_modules as $name => $module) + { + $module_step_count = $module->get_step_count(); + $step_count += $module_step_count; + $this->module_step_count[$name] = $module_step_count; + } + + // Set task count + $this->install_config->set_task_progress_count($step_count); + } + + // Set up progress information + $this->iohandler->set_task_count( + $this->install_config->get_task_progress_count() + ); + try { - if ($this->install_config->get_task_progress_count() === 0) + foreach ($this->installer_modules as $name => $module) { - // Count all tasks in the current installer modules - $step_count = 0; - foreach ($this->installer_modules as $index => $name) + // Skip forward until the current task is reached + if (!empty($task_name) && !$module_found) { - try + if ($module_name === $name) { - /** @var \phpbb\install\module_interface $module */ - $module = $this->container->get($name); + $module_found = true; } - catch (InvalidArgumentException $e) + else { - throw new module_not_found_exception($name); + continue; } - - $module_step_count = $module->get_step_count(); - $step_count += $module_step_count; - $this->module_step_count[$index] = $module_step_count; - } - - // Set task count - $this->install_config->set_task_progress_count($step_count); - } - - // Set up progress information - $this->iohandler->set_task_count( - $this->install_config->get_task_progress_count() - ); - - // Run until there are available resources - while ($this->install_config->get_time_remaining() > 0 && $this->install_config->get_memory_remaining() > 0) - { - // Check if module exists, if not the install is completed - if (!isset($this->installer_modules[$module_index])) - { - $install_finished = true; - break; } // Log progress - $module_service_name = $this->installer_modules[$module_index]; - $this->install_config->set_active_module($module_service_name, $module_index); + $this->install_config->set_active_module($name); - // Get module from container - try + // Run until there are available resources + if ($this->install_config->get_time_remaining() <= 0 && $this->install_config->get_memory_remaining() <= 0) { - /** @var \phpbb\install\module_interface $module */ - $module = $this->container->get($module_service_name); + throw new resource_limit_reached_exception(); } - catch (InvalidArgumentException $e) - { - throw new module_not_found_exception($module_service_name); - } - - $module_index++; // Check if module should be executed if (!$module->is_essential() && !$module->check_requirements()) @@ -178,9 +166,9 @@ class installer $this->iohandler->add_log_message(array( 'SKIP_MODULE', - $module_service_name, + $name, )); - $this->install_config->increment_current_task_progress($this->module_step_count[$module_index - 1]); + $this->install_config->increment_current_task_progress($this->module_step_count[$name]); continue; } @@ -192,40 +180,18 @@ class installer $this->install_config->set_finished_navigation_stage($module->get_navigation_stage_path()); $this->iohandler->set_finished_stage_menu($module->get_navigation_stage_path()); - - // Clear task progress - $this->install_config->set_finished_task('', 0); } - if ($install_finished) - { - // Send install finished message - $this->iohandler->set_progress('INSTALLER_FINISHED', $this->install_config->get_task_progress_count()); - } - else - { - $this->iohandler->request_refresh(); - } + // Installation finished + $install_finished = true; } catch (user_interaction_required_exception $e) { // Do nothing } - catch (module_not_found_exception $e) + catch (resource_limit_reached_exception $e) { - $this->iohandler->add_error_message('MODULE_NOT_FOUND', array( - 'MODULE_NOT_FOUND_DESCRIPTION', - $e->get_module_service_name(), - )); - $flush_messages = true; - } - catch (task_not_found_exception $e) - { - $this->iohandler->add_error_message('TASK_NOT_FOUND', array( - 'TASK_NOT_FOUND_DESCRIPTION', - $e->get_task_service_name(), - )); - $flush_messages = true; + // Do nothing } catch (invalid_service_name_exception $e) { @@ -244,6 +210,16 @@ class installer $flush_messages = true; } + if ($install_finished) + { + // Send install finished message + $this->iohandler->set_progress('INSTALLER_FINISHED', $this->install_config->get_task_progress_count()); + } + else + { + $this->iohandler->request_refresh(); + } + if ($flush_messages) { $this->iohandler->send_response(); @@ -274,14 +250,6 @@ class installer protected function recover_progress() { $progress_array = $this->install_config->get_progress_data(); - $module_service = $progress_array['last_task_module_name']; - $module_index = $progress_array['last_task_module_index']; - - if ($this->installer_modules[$module_index] === $module_service) - { - return $module_index; - } - - return 0; + return $progress_array['last_task_module_name']; } } -- cgit v1.2.1 From e967f3c1a81eab0f14daf314b7fb1b2001e4d220 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 9 Jul 2015 19:08:28 +0200 Subject: [ticket/13740] Fix itteration problems, implement class name aware collections PHPBB3-13740 --- phpBB/phpbb/install/installer.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb/install/installer.php') diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index 3e73d90453..c1ac2de7f9 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -137,9 +137,9 @@ class installer foreach ($this->installer_modules as $name => $module) { // Skip forward until the current task is reached - if (!empty($task_name) && !$module_found) + if (!$module_found) { - if ($module_name === $name) + if ($module_name === $name || empty($module_name)) { $module_found = true; } @@ -245,7 +245,7 @@ class installer /** * Recover install progress * - * @return int Index of the next installer module to execute + * @return string Index of the next installer module to execute */ protected function recover_progress() { -- cgit v1.2.1 From 3309c89b05a46a03d09ffef693ed309699a3f59b Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 9 Jul 2015 19:32:30 +0200 Subject: [ticket/13740] Fix CS PHPBB3-13740 --- phpBB/phpbb/install/installer.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/phpbb/install/installer.php') diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index c1ac2de7f9..33b9214cfa 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -21,7 +21,6 @@ use phpbb\install\exception\user_interaction_required_exception; use phpbb\install\helper\config; use phpbb\install\helper\iohandler\iohandler_interface; use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; class installer { -- cgit v1.2.1 From e46689a0cdbb418673741234f55e843f1bdd8016 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 9 Jul 2015 23:23:40 +0200 Subject: [ticket/13740] Remove service container from modules PHPBB3-13740 --- phpBB/phpbb/install/installer.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'phpBB/phpbb/install/installer.php') diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index 33b9214cfa..f69b48ce3b 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -55,12 +55,10 @@ class installer * Constructor * * @param config $config Installer config handler - * @param ContainerInterface $container Dependency injection container */ - public function __construct(config $config, ContainerInterface $container) + public function __construct(config $config) { $this->install_config = $config; - $this->container = $container; $this->installer_modules = null; } -- cgit v1.2.1 From 59d22eff497ea1107851067aa99eed4c979c0766 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Fri, 10 Jul 2015 00:47:28 +0200 Subject: [ticket/13740] Fix CS PHPBB3-13740 --- phpBB/phpbb/install/installer.php | 6 ------ 1 file changed, 6 deletions(-) (limited to 'phpBB/phpbb/install/installer.php') diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index f69b48ce3b..548615cb1d 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -20,15 +20,9 @@ use phpbb\install\exception\resource_limit_reached_exception; use phpbb\install\exception\user_interaction_required_exception; use phpbb\install\helper\config; use phpbb\install\helper\iohandler\iohandler_interface; -use Symfony\Component\DependencyInjection\ContainerInterface; class installer { - /** - * @var ContainerInterface - */ - protected $container; - /** * @var config */ -- cgit v1.2.1 From 88bf1d7f5802fc37bf77277a8ee65c6fb1f34c87 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Mon, 20 Jul 2015 18:22:53 +0200 Subject: [ticket/13740] Clean up install config file when installation has finished PHPBB3-13740 --- phpBB/phpbb/install/installer.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'phpBB/phpbb/install/installer.php') diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index 548615cb1d..695632472a 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -219,7 +219,14 @@ class installer // Save install progress try { - $this->install_config->save_config(); + if ($install_finished) + { + $this->install_config->clean_up_config_file(); + } + else + { + $this->install_config->save_config(); + } } catch (installer_config_not_writable_exception $e) { -- cgit v1.2.1 From b2b9fb1df2e6d37c8a327b7b6c380f19e1ff6496 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Tue, 21 Jul 2015 14:42:15 +0200 Subject: [ticket/13740] Fix CS and docblocks PHPBB3-13740 --- phpBB/phpbb/install/installer.php | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'phpBB/phpbb/install/installer.php') diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index 695632472a..0e19129247 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -15,7 +15,6 @@ namespace phpbb\install; use phpbb\di\ordered_service_collection; use phpbb\install\exception\installer_config_not_writable_exception; -use phpbb\install\exception\invalid_service_name_exception; use phpbb\install\exception\resource_limit_reached_exception; use phpbb\install\exception\user_interaction_required_exception; use phpbb\install\helper\config; @@ -94,9 +93,6 @@ class installer // Variable used to check if the install process have been finished $install_finished = false; - // Flag used by exception handling, whether or not we need to flush output buffer once again - $flush_messages = false; - // We are installing something, so the introduction stage can go now... $this->install_config->set_finished_navigation_stage(array('install', 0, 'introduction')); $this->iohandler->set_finished_stage_menu(array('install', 0, 'introduction')); @@ -184,22 +180,6 @@ class installer { // Do nothing } - catch (invalid_service_name_exception $e) - { - $params = $e->get_parameters(); - - if (!empty($params)) - { - array_unshift($params, $e->getMessage()); - } - else - { - $params = $e->getMessage(); - } - - $this->iohandler->add_error_message($params); - $flush_messages = true; - } if ($install_finished) { @@ -211,11 +191,6 @@ class installer $this->iohandler->request_refresh(); } - if ($flush_messages) - { - $this->iohandler->send_response(); - } - // Save install progress try { -- cgit v1.2.1 From 3840882b93e96f8f510d4086d650bb9df55873ca Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 23 Jul 2015 23:35:20 +0200 Subject: [ticket/13740] Add success message when install finished PHPBB3-13740 --- phpBB/phpbb/install/installer.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'phpBB/phpbb/install/installer.php') diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index 0e19129247..cb4ddb8783 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -18,6 +18,7 @@ use phpbb\install\exception\installer_config_not_writable_exception; use phpbb\install\exception\resource_limit_reached_exception; use phpbb\install\exception\user_interaction_required_exception; use phpbb\install\helper\config; +use phpbb\install\helper\iohandler\cli_iohandler; use phpbb\install\helper\iohandler\iohandler_interface; class installer @@ -171,6 +172,34 @@ class installer // Installation finished $install_finished = true; + + if ($this->iohandler instanceof cli_iohandler) + { + $this->iohandler->add_success_message('INSTALLER_FINISHED'); + } + else + { + global $SID; + + // Construct ACP url + $acp_url = $protocol = $this->install_config->get('server_protocol'); + $acp_url .= $this->install_config->get('server_name'); + $port = $this->install_config->get('server_port'); + + if (!((strpos($protocol, 'https:') === 0 && $port === 443) + || (strpos($protocol, 'http:') === 0 && $port === 80))) + { + $acp_url .= ':' . $port; + } + + $acp_url .= $this->install_config->get('script_path'); + $acp_url .= '/adm/index.php' . $SID; + + $this->iohandler->add_success_message('INSTALLER_FINISHED', array( + 'ACP_LINK', + $acp_url, + )); + } } catch (user_interaction_required_exception $e) { -- cgit v1.2.1 From f4f0ff0eec78c85b4ec2962a0de06d9aa2bd37a5 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Mon, 17 Aug 2015 18:38:07 +0200 Subject: [ticket/14097] Improve error and failure handling in the installer PHPBB3-14097 --- phpBB/phpbb/install/installer.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/install/installer.php') diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index cb4ddb8783..78a0de0241 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -92,7 +92,8 @@ class installer $module_found = false; // Variable used to check if the install process have been finished - $install_finished = false; + $install_finished = false; + $fail_cleanup = false; // We are installing something, so the introduction stage can go now... $this->install_config->set_finished_navigation_stage(array('install', 0, 'introduction')); @@ -209,6 +210,13 @@ class installer { // Do nothing } + catch (\Exception $e) + { + // Most likely there were a PHP failure, so let's die like a gentleman + $this->iohandler->add_error_message($e->getMessage()); + $this->iohandler->send_response(); + $fail_cleanup = true; + } if ($install_finished) { @@ -223,7 +231,7 @@ class installer // Save install progress try { - if ($install_finished) + if ($install_finished || $fail_cleanup) { $this->install_config->clean_up_config_file(); } -- cgit v1.2.1 From dd1b777ca779b60b3624e90a9c7a6831fbddf7c4 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Mon, 17 Aug 2015 20:24:01 +0200 Subject: [ticket/14097] Remove auto refresh on install failure PHPBB3-14097 --- phpBB/phpbb/install/installer.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'phpBB/phpbb/install/installer.php') diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index 78a0de0241..755edb5297 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -212,7 +212,6 @@ class installer } catch (\Exception $e) { - // Most likely there were a PHP failure, so let's die like a gentleman $this->iohandler->add_error_message($e->getMessage()); $this->iohandler->send_response(); $fail_cleanup = true; @@ -223,7 +222,7 @@ class installer // Send install finished message $this->iohandler->set_progress('INSTALLER_FINISHED', $this->install_config->get_task_progress_count()); } - else + else if (!$fail_cleanup) { $this->iohandler->request_refresh(); } -- cgit v1.2.1 From 8f5a0ad6f73e7b7757b02c827436384c96069b5a Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Fri, 24 Jul 2015 09:20:50 +0200 Subject: [ticket/14039] Revamp updater PHPBB3-14039 --- phpBB/phpbb/install/installer.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb/install/installer.php') diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index 755edb5297..8a0374b1f0 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -15,6 +15,7 @@ namespace phpbb\install; use phpbb\di\ordered_service_collection; use phpbb\install\exception\installer_config_not_writable_exception; +use phpbb\install\exception\jump_to_restart_point_exception; use phpbb\install\exception\resource_limit_reached_exception; use phpbb\install\exception\user_interaction_required_exception; use phpbb\install\helper\config; @@ -94,6 +95,7 @@ class installer // Variable used to check if the install process have been finished $install_finished = false; $fail_cleanup = false; + $send_refresh = false; // We are installing something, so the introduction stage can go now... $this->install_config->set_finished_navigation_stage(array('install', 0, 'introduction')); @@ -142,7 +144,7 @@ class installer $this->install_config->set_active_module($name); // Run until there are available resources - if ($this->install_config->get_time_remaining() <= 0 && $this->install_config->get_memory_remaining() <= 0) + if ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0) { throw new resource_limit_reached_exception(); } @@ -208,7 +210,12 @@ class installer } catch (resource_limit_reached_exception $e) { - // Do nothing + $send_refresh = true; + } + catch (jump_to_restart_point_exception $e) + { + $this->install_config->jump_to_restart_point($e->get_restart_point_name()); + $send_refresh = true; } catch (\Exception $e) { @@ -222,9 +229,10 @@ class installer // Send install finished message $this->iohandler->set_progress('INSTALLER_FINISHED', $this->install_config->get_task_progress_count()); } - else if (!$fail_cleanup) + else if ($send_refresh) { $this->iohandler->request_refresh(); + $this->iohandler->send_response(); } // Save install progress -- cgit v1.2.1 From ed442198d1fff379b65b8d4a1c3bfb15890cfed1 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Sun, 18 Oct 2015 19:27:50 +0200 Subject: [ticket/14039] Fix ACP link generation PHPBB3-14039 --- phpBB/phpbb/install/installer.php | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'phpBB/phpbb/install/installer.php') diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index 8a0374b1f0..bdff62e0b1 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -21,6 +21,7 @@ use phpbb\install\exception\user_interaction_required_exception; use phpbb\install\helper\config; use phpbb\install\helper\iohandler\cli_iohandler; use phpbb\install\helper\iohandler\iohandler_interface; +use phpbb\path_helper; class installer { @@ -39,6 +40,11 @@ class installer */ protected $iohandler; + /** + * @var string + */ + protected $web_root; + /** * Stores the number of steps that a given module has * @@ -49,12 +55,14 @@ class installer /** * Constructor * - * @param config $config Installer config handler + * @param config $config Installer config handler + * @param path_helper $path_helper Path helper */ - public function __construct(config $config) + public function __construct(config $config, path_helper $path_helper) { $this->install_config = $config; $this->installer_modules = null; + $this->web_root = $path_helper->get_web_root_path(); } /** @@ -183,21 +191,7 @@ class installer else { global $SID; - - // Construct ACP url - $acp_url = $protocol = $this->install_config->get('server_protocol'); - $acp_url .= $this->install_config->get('server_name'); - $port = $this->install_config->get('server_port'); - - if (!((strpos($protocol, 'https:') === 0 && $port === 443) - || (strpos($protocol, 'http:') === 0 && $port === 80))) - { - $acp_url .= ':' . $port; - } - - $acp_url .= $this->install_config->get('script_path'); - $acp_url .= '/adm/index.php' . $SID; - + $acp_url = $this->web_root . '/adm/index.php' . $SID; $this->iohandler->add_success_message('INSTALLER_FINISHED', array( 'ACP_LINK', $acp_url, -- cgit v1.2.1 From 0ce72f94a21d7407b08c8d2cb233d445434743b4 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Sun, 18 Oct 2015 22:33:31 +0200 Subject: [ticket/14039] Fix acp link PHPBB3-14039 --- phpBB/phpbb/install/installer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/install/installer.php') diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index bdff62e0b1..77e0a896bc 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -191,7 +191,7 @@ class installer else { global $SID; - $acp_url = $this->web_root . '/adm/index.php' . $SID; + $acp_url = $this->web_root . 'adm/index.php' . $SID; $this->iohandler->add_success_message('INSTALLER_FINISHED', array( 'ACP_LINK', $acp_url, -- cgit v1.2.1 From 8d178f15f06e0f6b5e64447dc07157a796645572 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Wed, 4 Nov 2015 17:25:38 +0100 Subject: [ticket/14270] Purge cache when the installer is finished PHPBB3-14270 --- phpBB/phpbb/install/installer.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb/install/installer.php') diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index 77e0a896bc..a41b4cd6a6 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -13,6 +13,7 @@ namespace phpbb\install; +use phpbb\cache\driver\driver_interface; use phpbb\di\ordered_service_collection; use phpbb\install\exception\installer_config_not_writable_exception; use phpbb\install\exception\jump_to_restart_point_exception; @@ -25,6 +26,11 @@ use phpbb\path_helper; class installer { + /** + * @var driver_interface + */ + protected $cache; + /** * @var config */ @@ -55,11 +61,13 @@ class installer /** * Constructor * - * @param config $config Installer config handler - * @param path_helper $path_helper Path helper + * @param driver_interface $cache Cache service + * @param config $config Installer config handler + * @param path_helper $path_helper Path helper */ - public function __construct(config $config, path_helper $path_helper) + public function __construct(driver_interface $cache, config $config, path_helper $path_helper) { + $this->cache = $cache; $this->install_config = $config; $this->installer_modules = null; $this->web_root = $path_helper->get_web_root_path(); @@ -235,6 +243,7 @@ class installer if ($install_finished || $fail_cleanup) { $this->install_config->clean_up_config_file(); + $this->cache->purge(); } else { -- cgit v1.2.1 From 955b9ede33c5696173a760ea271ec32d79e843b9 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 11 Feb 2016 13:18:30 +0100 Subject: [ticket/14462] Further speed improvements - Cache the secondary container - Only initialize tasks/modules that are being used - Add timeout error message in the AJAX UI PHPBB3-14462 --- phpBB/phpbb/install/installer.php | 116 ++++++++++++++++++++++++++------------ 1 file changed, 79 insertions(+), 37 deletions(-) (limited to 'phpBB/phpbb/install/installer.php') diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index a41b4cd6a6..adf0ec8ac2 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -15,11 +15,13 @@ namespace phpbb\install; use phpbb\cache\driver\driver_interface; use phpbb\di\ordered_service_collection; +use phpbb\install\exception\cannot_build_container_exception; use phpbb\install\exception\installer_config_not_writable_exception; use phpbb\install\exception\jump_to_restart_point_exception; use phpbb\install\exception\resource_limit_reached_exception; use phpbb\install\exception\user_interaction_required_exception; use phpbb\install\helper\config; +use phpbb\install\helper\container_factory; use phpbb\install\helper\iohandler\cli_iohandler; use phpbb\install\helper\iohandler\iohandler_interface; use phpbb\path_helper; @@ -31,13 +33,18 @@ class installer */ protected $cache; + /** + * @var container_factory + */ + protected $container_factory; + /** * @var config */ protected $install_config; /** - * @var array + * @var ordered_service_collection */ protected $installer_modules; @@ -58,19 +65,27 @@ class installer */ protected $module_step_count; + /** + * @var bool + */ + protected $purge_cache_before; + /** * Constructor * * @param driver_interface $cache Cache service * @param config $config Installer config handler * @param path_helper $path_helper Path helper + * @param container_factory $container Container */ - public function __construct(driver_interface $cache, config $config, path_helper $path_helper) + public function __construct(driver_interface $cache, config $config, path_helper $path_helper, container_factory $container) { $this->cache = $cache; $this->install_config = $config; + $this->container_factory = $container; $this->installer_modules = null; $this->web_root = $path_helper->get_web_root_path(); + $this->purge_cache_before = false; } /** @@ -96,6 +111,16 @@ class installer $this->iohandler = $iohandler; } + /** + * Sets whether to purge cache before the installation process + * + * @param bool $purge_cache_before + */ + public function set_purge_cache_before($purge_cache_before) + { + $this->purge_cache_before = $purge_cache_before; + } + /** * Run phpBB installer */ @@ -104,9 +129,16 @@ class installer // Load install progress $this->install_config->load_config(); + if (!$this->install_config->get('cache_purged_before', false) && $this->purge_cache_before) + { + /** @var \phpbb\cache\driver\driver_interface $cache */ + $cache = $this->container_factory->get('cache.driver'); + $cache->purge(); + $this->install_config->set('cache_purged_before', true); + } + // Recover install progress - $module_name = $this->recover_progress(); - $module_found = false; + $module_index = $this->recover_progress(); // Variable used to check if the install process have been finished $install_finished = false; @@ -141,29 +173,13 @@ class installer try { - foreach ($this->installer_modules as $name => $module) - { - // Skip forward until the current task is reached - if (!$module_found) - { - if ($module_name === $name || empty($module_name)) - { - $module_found = true; - } - else - { - continue; - } - } + $iterator = $this->installer_modules->getIterator(); + $iterator->seek($module_index); - // Log progress - $this->install_config->set_active_module($name); - - // Run until there are available resources - if ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0) - { - throw new resource_limit_reached_exception(); - } + while ($iterator->valid()) + { + $module = $iterator->current(); + $name = $iterator->key(); // Check if module should be executed if (!$module->is_essential() && !$module->check_requirements()) @@ -176,17 +192,31 @@ class installer $name, )); $this->install_config->increment_current_task_progress($this->module_step_count[$name]); - continue; + } + else + { + // Set the correct stage in the navigation bar + $this->install_config->set_active_navigation_stage($module->get_navigation_stage_path()); + $this->iohandler->set_active_stage_menu($module->get_navigation_stage_path()); + + $this->iohandler->send_response(); + + $module->run(); + + $this->install_config->set_finished_navigation_stage($module->get_navigation_stage_path()); + $this->iohandler->set_finished_stage_menu($module->get_navigation_stage_path()); } - // Set the correct stage in the navigation bar - $this->install_config->set_active_navigation_stage($module->get_navigation_stage_path()); - $this->iohandler->set_active_stage_menu($module->get_navigation_stage_path()); + $module_index++; + $iterator->next(); - $module->run(); + // Save progress + $this->install_config->set_active_module($name, $module_index); - $this->install_config->set_finished_navigation_stage($module->get_navigation_stage_path()); - $this->iohandler->set_finished_stage_menu($module->get_navigation_stage_path()); + if ($iterator->valid() && ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0)) + { + throw new resource_limit_reached_exception(); + } } // Installation finished @@ -208,7 +238,7 @@ class installer } catch (user_interaction_required_exception $e) { - // Do nothing + $this->iohandler->send_response(true); } catch (resource_limit_reached_exception $e) { @@ -222,7 +252,7 @@ class installer catch (\Exception $e) { $this->iohandler->add_error_message($e->getMessage()); - $this->iohandler->send_response(); + $this->iohandler->send_response(true); $fail_cleanup = true; } @@ -230,11 +260,12 @@ class installer { // Send install finished message $this->iohandler->set_progress('INSTALLER_FINISHED', $this->install_config->get_task_progress_count()); + $this->iohandler->send_response(true); } else if ($send_refresh) { $this->iohandler->request_refresh(); - $this->iohandler->send_response(); + $this->iohandler->send_response(true); } // Save install progress @@ -244,6 +275,17 @@ class installer { $this->install_config->clean_up_config_file(); $this->cache->purge(); + + try + { + /** @var \phpbb\cache\driver\driver_interface $cache */ + $cache = $this->container_factory->get('cache.driver'); + $cache->purge(); + } + catch (cannot_build_container_exception $e) + { + // Do not do anything, this is just means there is no config.php yet + } } else { @@ -270,6 +312,6 @@ class installer protected function recover_progress() { $progress_array = $this->install_config->get_progress_data(); - return $progress_array['last_task_module_name']; + return $progress_array['last_task_module_index']; } } -- cgit v1.2.1 From 2efceffaebd96fd6d092c4be8c854a7bcf032592 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Fri, 12 Feb 2016 23:30:32 +0100 Subject: [ticket/14462] Fix comments PHPBB3-14462 --- phpBB/phpbb/install/installer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/install/installer.php') diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index adf0ec8ac2..b5709e96c7 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -284,7 +284,7 @@ class installer } catch (cannot_build_container_exception $e) { - // Do not do anything, this is just means there is no config.php yet + // Do not do anything, this just means there is no config.php yet } } else -- cgit v1.2.1 From 062358f8b1d9a7fa3d9be97f6b58e06fea7ca844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Bartus?= Date: Sun, 28 Feb 2016 00:19:24 +0100 Subject: [ticket/14487] Try to handle connection timeouts PHPBB3-14487 --- phpBB/phpbb/install/installer.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'phpBB/phpbb/install/installer.php') diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index b5709e96c7..240423ae78 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -22,6 +22,7 @@ use phpbb\install\exception\resource_limit_reached_exception; use phpbb\install\exception\user_interaction_required_exception; use phpbb\install\helper\config; use phpbb\install\helper\container_factory; +use phpbb\install\helper\iohandler\ajax_iohandler; use phpbb\install\helper\iohandler\cli_iohandler; use phpbb\install\helper\iohandler\iohandler_interface; use phpbb\path_helper; @@ -126,6 +127,11 @@ class installer */ public function run() { + if ($this->iohandler instanceof ajax_iohandler) + { + $this->iohandler->acquire_lock(); + } + // Load install progress $this->install_config->load_config(); @@ -174,7 +180,16 @@ class installer try { $iterator = $this->installer_modules->getIterator(); - $iterator->seek($module_index); + + if ($module_index < $iterator->count()) + { + $iterator->seek($module_index); + } + else + { + $iterator->seek($module_index - 1); + $iterator->next(); + } while ($iterator->valid()) { @@ -256,6 +271,11 @@ class installer $fail_cleanup = true; } + if ($this->iohandler instanceof ajax_iohandler) + { + $this->iohandler->release_lock(); + } + if ($install_finished) { // Send install finished message -- cgit v1.2.1 From d62d35ad46baf9a7563a9f58038b16272cdf7c2d Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 2 Mar 2016 21:56:22 +0100 Subject: [ticket/14492] Redirect to help phpBB page after installation PHPBB3-14492 --- phpBB/phpbb/install/installer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/install/installer.php') diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index 240423ae78..b8eef34a1d 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -244,7 +244,7 @@ class installer else { global $SID; - $acp_url = $this->web_root . 'adm/index.php' . $SID; + $acp_url = $this->web_root . 'adm/index.php' . $SID . '&i=acp_help_phpbb&mode=help_phpbb'; $this->iohandler->add_success_message('INSTALLER_FINISHED', array( 'ACP_LINK', $acp_url, -- cgit v1.2.1 From 8ded30bbbe1e12ed301c2deb43d52da5a22d5b05 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 22 Nov 2016 18:39:01 +0100 Subject: [ticket/14492] Fix redirection to help phpBB page PHPBB3-14492 --- phpBB/phpbb/install/installer.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/install/installer.php') diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index b8eef34a1d..abdb172cf3 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -59,6 +59,11 @@ class installer */ protected $web_root; + /** + * @var \phpbb\user + */ + protected $user; + /** * Stores the number of steps that a given module has * @@ -87,6 +92,7 @@ class installer $this->installer_modules = null; $this->web_root = $path_helper->get_web_root_path(); $this->purge_cache_before = false; + $this->user = $container->get('user'); } /** @@ -243,8 +249,14 @@ class installer } else { - global $SID; - $acp_url = $this->web_root . 'adm/index.php' . $SID . '&i=acp_help_phpbb&mode=help_phpbb'; + // Start session and try to apply session id + $auth = $this->container_factory->get('auth'); + $this->user->session_begin(); + $auth->acl($this->user->data); + $this->user->setup(); + $phpbb_root_path = $this->container_factory->get_parameter('core.root_path'); + + $acp_url = append_sid($phpbb_root_path . 'adm/index.php', 'i=acp_help_phpbb&mode=help_phpbb', true, $this->user->session_id); $this->iohandler->add_success_message('INSTALLER_FINISHED', array( 'ACP_LINK', $acp_url, -- cgit v1.2.1 From 5895f56de05b637765a6583b8c51c1db3daabe91 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 24 Nov 2016 20:38:29 +0100 Subject: [ticket/14492] Add user service to installer & only instantiate if needed PHPBB3-14492 --- phpBB/phpbb/install/installer.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'phpBB/phpbb/install/installer.php') diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index abdb172cf3..a7d3b99dcb 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -59,11 +59,6 @@ class installer */ protected $web_root; - /** - * @var \phpbb\user - */ - protected $user; - /** * Stores the number of steps that a given module has * @@ -92,7 +87,6 @@ class installer $this->installer_modules = null; $this->web_root = $path_helper->get_web_root_path(); $this->purge_cache_before = false; - $this->user = $container->get('user'); } /** @@ -251,12 +245,13 @@ class installer { // Start session and try to apply session id $auth = $this->container_factory->get('auth'); - $this->user->session_begin(); - $auth->acl($this->user->data); - $this->user->setup(); + $user = $this->container_factory->get('user'); + $user->session_begin(); + $auth->acl($user->data); + $user->setup(); $phpbb_root_path = $this->container_factory->get_parameter('core.root_path'); - $acp_url = append_sid($phpbb_root_path . 'adm/index.php', 'i=acp_help_phpbb&mode=help_phpbb', true, $this->user->session_id); + $acp_url = append_sid($phpbb_root_path . 'adm/index.php', 'i=acp_help_phpbb&mode=help_phpbb', true, $user->session_id); $this->iohandler->add_success_message('INSTALLER_FINISHED', array( 'ACP_LINK', $acp_url, -- cgit v1.2.1 From 829e1475044f1a72f68958923a0900ed4e62f78e Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 7 Dec 2016 17:55:57 +0100 Subject: [ticket/14896] Do not overwrite login when finishing install Otherwise the user will be "logged in" again as guest user which will prevent any redirectiong to the ACP after the installation. PHPBB3-14896 --- phpBB/phpbb/install/installer.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'phpBB/phpbb/install/installer.php') diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index a7d3b99dcb..e04e233a76 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -243,12 +243,18 @@ class installer } else { - // Start session and try to apply session id - $auth = $this->container_factory->get('auth'); + // Start session if not installing and get user object + // to allow redirecting to ACP $user = $this->container_factory->get('user'); - $user->session_begin(); - $auth->acl($user->data); - $user->setup(); + if (!isset($module) || !($module instanceof \phpbb\install\module\install_finish\module)) + { + $auth = $this->container_factory->get('auth'); + + $user->session_begin(); + $auth->acl($user->data); + $user->setup(); + } + $phpbb_root_path = $this->container_factory->get_parameter('core.root_path'); $acp_url = append_sid($phpbb_root_path . 'adm/index.php', 'i=acp_help_phpbb&mode=help_phpbb', true, $user->session_id); -- cgit v1.2.1