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/controller/install.php | 185 +++++++++++++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100644 phpBB/phpbb/install/controller/install.php (limited to 'phpBB/phpbb/install/controller/install.php') diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php new file mode 100644 index 0000000000..c1329b6456 --- /dev/null +++ b/phpBB/phpbb/install/controller/install.php @@ -0,0 +1,185 @@ + + * @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\controller; + +use phpbb\install\helper\config; +use phpbb\install\helper\navigation\navigation_provider; +use Symfony\Component\HttpFoundation\StreamedResponse; +use Symfony\Component\HttpFoundation\Response; +use phpbb\install\helper\iohandler\factory; +use phpbb\install\controller\helper; +use phpbb\template\template; +use phpbb\request\request_interface; +use phpbb\install\installer; +use phpbb\language\language; + +/** + * Controller for installing phpBB + */ +class install +{ + /** + * @var helper + */ + protected $controller_helper; + + /** + * @var config + */ + protected $installer_config; + + /** + * @var factory + */ + protected $iohandler_factory; + + /** + * @var navigation_provider + */ + protected $menu_provider; + + /** + * @var language + */ + protected $language; + + /** + * @var template + */ + protected $template; + + /** + * @var request_interface + */ + protected $request; + + /** + * @var installer + */ + protected $installer; + + /** + * Constructor + * + * @param helper $helper + * @param config $install_config + * @param factory $factory + * @param navigation_provider $nav_provider + * @param language $language + * @param request_interface $request + * @param installer $installer + */ + public function __construct(helper $helper, config $install_config, factory $factory, navigation_provider $nav_provider, language $language, template $template, request_interface $request, installer $installer) + { + $this->controller_helper = $helper; + $this->installer_config = $install_config; + $this->iohandler_factory = $factory; + $this->menu_provider = $nav_provider; + $this->language = $language; + $this->template = $template; + $this->request = $request; + $this->installer = $installer; + } + + /** + * Controller logic + * + * @return Response|StreamedResponse + */ + public function handle() + { + // @todo check that phpBB is not already installed + + $this->template->assign_vars(array( + 'U_ACTION' => $this->controller_helper->route('phpbb_installer_install'), + )); + + // Set up input-output handler + if ($this->request->is_ajax()) + { + $this->iohandler_factory->set_environment('ajax'); + } + else + { + $this->iohandler_factory->set_environment('nojs'); + } + + // Set the appropriate input-output handler + $this->installer->set_iohandler($this->iohandler_factory->get()); + + // Set up navigation + $nav_data = $this->installer_config->get_navigation_data(); + /** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */ + $iohandler = $this->iohandler_factory->get(); + + // Set active navigation stage + if (isset($nav_data['active']) && is_array($nav_data['active'])) + { + $iohandler->set_active_stage_menu($nav_data['active']); + $this->menu_provider->set_nav_property($nav_data['active'], array( + 'selected' => true, + 'completed' => false, + )); + } + + // Set finished navigation stages + if (isset($nav_data['finished']) && is_array($nav_data['finished'])) + { + foreach ($nav_data['finished'] as $finished_stage) + { + $iohandler->set_finished_stage_menu($finished_stage); + $this->menu_provider->set_nav_property($finished_stage, array( + 'selected' => false, + 'completed' => true, + )); + } + } + + if ($this->request->is_ajax()) + { + $installer = $this->installer; + $response = new StreamedResponse(); + $response->setCallback(function() use ($installer) { + $installer->run(); + }); + + return $response; + } + else + { + // Determine whether the installation was started or not + if (true) + { + // Set active stage + $this->menu_provider->set_nav_property( + array('install', 0, 'introduction'), + array( + 'selected' => true, + 'completed' => false, + ) + ); + + // If not, let's render the welcome page + $this->template->assign_vars(array( + 'SHOW_INSTALL_START_FORM' => true, + 'TITLE' => $this->language->lang('INSTALL_INTRO'), + 'CONTENT' => $this->language->lang('INSTALL_INTRO_BODY'), + )); + return $this->controller_helper->render('installer_install.html', 'INSTALL'); + } + + // @todo: implement no js controller logic + } + } +} -- cgit v1.2.1 From 6216007caaa884bdbca8bbb5e098ff231b5a36a6 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Mon, 20 Jul 2015 18:47:10 +0200 Subject: [ticket/13740] Fix docblocks and comments PHPBB3-13740 --- phpBB/phpbb/install/controller/install.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/phpbb/install/controller/install.php') diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php index c1329b6456..c742906305 100644 --- a/phpBB/phpbb/install/controller/install.php +++ b/phpBB/phpbb/install/controller/install.php @@ -77,6 +77,7 @@ class install * @param factory $factory * @param navigation_provider $nav_provider * @param language $language + * @param template $template * @param request_interface $request * @param installer $installer */ -- cgit v1.2.1 From 0488c49116f77de55da3ddf36aa2b08f6a5fd085 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Mon, 20 Jul 2015 19:26:07 +0200 Subject: [ticket/13740] Exit from installation if phpBB is already installed PHPBB3-13740 --- phpBB/phpbb/install/controller/install.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb/install/controller/install.php') diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php index c742906305..5cd42fcb84 100644 --- a/phpBB/phpbb/install/controller/install.php +++ b/phpBB/phpbb/install/controller/install.php @@ -13,7 +13,9 @@ namespace phpbb\install\controller; +use phpbb\exception\http_exception; use phpbb\install\helper\config; +use phpbb\install\helper\install_helper; use phpbb\install\helper\navigation\navigation_provider; use Symfony\Component\HttpFoundation\StreamedResponse; use Symfony\Component\HttpFoundation\Response; @@ -69,6 +71,11 @@ class install */ protected $installer; + /** + * @var install_helper + */ + protected $install_helper; + /** * Constructor * @@ -80,8 +87,9 @@ class install * @param template $template * @param request_interface $request * @param installer $installer + * @param install_helper $install_helper */ - public function __construct(helper $helper, config $install_config, factory $factory, navigation_provider $nav_provider, language $language, template $template, request_interface $request, installer $installer) + public function __construct(helper $helper, config $install_config, factory $factory, navigation_provider $nav_provider, language $language, template $template, request_interface $request, installer $installer, install_helper $install_helper) { $this->controller_helper = $helper; $this->installer_config = $install_config; @@ -91,6 +99,7 @@ class install $this->template = $template; $this->request = $request; $this->installer = $installer; + $this->install_helper = $install_helper; } /** @@ -100,8 +109,6 @@ class install */ public function handle() { - // @todo check that phpBB is not already installed - $this->template->assign_vars(array( 'U_ACTION' => $this->controller_helper->route('phpbb_installer_install'), )); @@ -124,6 +131,11 @@ class install /** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */ $iohandler = $this->iohandler_factory->get(); + if ($this->install_helper->is_phpbb_installed()) + { + throw new http_exception(404, 'PAGE_NOT_FOUND'); + } + // Set active navigation stage if (isset($nav_data['active']) && is_array($nav_data['active'])) { -- 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/controller/install.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'phpBB/phpbb/install/controller/install.php') diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php index 5cd42fcb84..b3103c8284 100644 --- a/phpBB/phpbb/install/controller/install.php +++ b/phpBB/phpbb/install/controller/install.php @@ -109,6 +109,11 @@ class install */ public function handle() { + if ($this->install_helper->is_phpbb_installed()) + { + throw new http_exception(404, 'PAGE_NOT_FOUND'); + } + $this->template->assign_vars(array( 'U_ACTION' => $this->controller_helper->route('phpbb_installer_install'), )); @@ -131,11 +136,6 @@ class install /** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */ $iohandler = $this->iohandler_factory->get(); - if ($this->install_helper->is_phpbb_installed()) - { - throw new http_exception(404, 'PAGE_NOT_FOUND'); - } - // Set active navigation stage if (isset($nav_data['active']) && is_array($nav_data['active'])) { -- cgit v1.2.1 From 97d08d6f56cf448fd4def8a4d29c570da91faa89 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Wed, 22 Jul 2015 03:16:16 +0200 Subject: [ticket/13740] Allow language change in the installer PHPBB3-13740 --- phpBB/phpbb/install/controller/install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/install/controller/install.php') diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php index b3103c8284..da806948fb 100644 --- a/phpBB/phpbb/install/controller/install.php +++ b/phpBB/phpbb/install/controller/install.php @@ -189,7 +189,7 @@ class install 'TITLE' => $this->language->lang('INSTALL_INTRO'), 'CONTENT' => $this->language->lang('INSTALL_INTRO_BODY'), )); - return $this->controller_helper->render('installer_install.html', 'INSTALL'); + return $this->controller_helper->render('installer_install.html', 'INSTALL', true); } // @todo: implement no js controller logic -- cgit v1.2.1 From dd31020fb3dd4ab96b48dd1854f73190900319b1 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 23 Jul 2015 16:43:20 +0200 Subject: [ticket/13740] Enhance server output buffer bypass PHPBB3-13740 --- phpBB/phpbb/install/controller/install.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'phpBB/phpbb/install/controller/install.php') diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php index da806948fb..469e2608a4 100644 --- a/phpBB/phpbb/install/controller/install.php +++ b/phpBB/phpbb/install/controller/install.php @@ -167,6 +167,9 @@ class install $installer->run(); }); + // Try to bypass any server output buffers + $response->headers->set('X-Accel-Buffering', 'no'); + return $response; } else -- cgit v1.2.1 From e08f1341127792e378580a10bbb0bdeafe93ff8d Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 23 Jul 2015 22:55:31 +0200 Subject: [ticket/13740] Fix is_phpbb_installed() method PHPBB3-13740 --- phpBB/phpbb/install/controller/install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/install/controller/install.php') diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php index 469e2608a4..904f5920c2 100644 --- a/phpBB/phpbb/install/controller/install.php +++ b/phpBB/phpbb/install/controller/install.php @@ -111,7 +111,7 @@ class install { if ($this->install_helper->is_phpbb_installed()) { - throw new http_exception(404, 'PAGE_NOT_FOUND'); + die ('phpBB is already installed'); } $this->template->assign_vars(array( -- cgit v1.2.1 From 22786a5b6fcdab1610b609ae069065c5d6691496 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Fri, 24 Jul 2015 02:37:00 +0200 Subject: [ticket/13740] Fix CS PHPBB3-13740 --- phpBB/phpbb/install/controller/install.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/phpbb/install/controller/install.php') diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php index 904f5920c2..c21b0d831b 100644 --- a/phpBB/phpbb/install/controller/install.php +++ b/phpBB/phpbb/install/controller/install.php @@ -13,7 +13,6 @@ namespace phpbb\install\controller; -use phpbb\exception\http_exception; use phpbb\install\helper\config; use phpbb\install\helper\install_helper; use phpbb\install\helper\navigation\navigation_provider; -- cgit v1.2.1 From 495c0c6fb32ac0b720fccfeb640a0b3d5a32b98f Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Sun, 26 Jul 2015 22:20:32 +0200 Subject: [ticket/13740] Move handle_language_select calls to the controllers PHPBB3-13740 --- phpBB/phpbb/install/controller/install.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'phpBB/phpbb/install/controller/install.php') diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php index c21b0d831b..80f6651a39 100644 --- a/phpBB/phpbb/install/controller/install.php +++ b/phpBB/phpbb/install/controller/install.php @@ -176,6 +176,8 @@ class install // Determine whether the installation was started or not if (true) { + $this->controller_helper->handle_language_select(); + // Set active stage $this->menu_provider->set_nav_property( array('install', 0, 'introduction'), -- 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/controller/install.php | 43 +++++------------------------- 1 file changed, 6 insertions(+), 37 deletions(-) (limited to 'phpBB/phpbb/install/controller/install.php') diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php index 80f6651a39..8d5ff95958 100644 --- a/phpBB/phpbb/install/controller/install.php +++ b/phpBB/phpbb/install/controller/install.php @@ -13,7 +13,6 @@ namespace phpbb\install\controller; -use phpbb\install\helper\config; use phpbb\install\helper\install_helper; use phpbb\install\helper\navigation\navigation_provider; use Symfony\Component\HttpFoundation\StreamedResponse; @@ -35,11 +34,6 @@ class install */ protected $controller_helper; - /** - * @var config - */ - protected $installer_config; - /** * @var factory */ @@ -79,7 +73,6 @@ class install * Constructor * * @param helper $helper - * @param config $install_config * @param factory $factory * @param navigation_provider $nav_provider * @param language $language @@ -88,10 +81,9 @@ class install * @param installer $installer * @param install_helper $install_helper */ - public function __construct(helper $helper, config $install_config, factory $factory, navigation_provider $nav_provider, language $language, template $template, request_interface $request, installer $installer, install_helper $install_helper) + public function __construct(helper $helper, factory $factory, navigation_provider $nav_provider, language $language, template $template, request_interface $request, installer $installer, install_helper $install_helper) { $this->controller_helper = $helper; - $this->installer_config = $install_config; $this->iohandler_factory = $factory; $this->menu_provider = $nav_provider; $this->language = $language; @@ -130,34 +122,6 @@ class install // Set the appropriate input-output handler $this->installer->set_iohandler($this->iohandler_factory->get()); - // Set up navigation - $nav_data = $this->installer_config->get_navigation_data(); - /** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */ - $iohandler = $this->iohandler_factory->get(); - - // Set active navigation stage - if (isset($nav_data['active']) && is_array($nav_data['active'])) - { - $iohandler->set_active_stage_menu($nav_data['active']); - $this->menu_provider->set_nav_property($nav_data['active'], array( - 'selected' => true, - 'completed' => false, - )); - } - - // Set finished navigation stages - if (isset($nav_data['finished']) && is_array($nav_data['finished'])) - { - foreach ($nav_data['finished'] as $finished_stage) - { - $iohandler->set_finished_stage_menu($finished_stage); - $this->menu_provider->set_nav_property($finished_stage, array( - 'selected' => false, - 'completed' => true, - )); - } - } - if ($this->request->is_ajax()) { $installer = $this->installer; @@ -193,6 +157,11 @@ class install 'TITLE' => $this->language->lang('INSTALL_INTRO'), 'CONTENT' => $this->language->lang('INSTALL_INTRO_BODY'), )); + + /** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */ + $iohandler = $this->iohandler_factory->get(); + $this->controller_helper->handle_navigation($iohandler); + return $this->controller_helper->render('installer_install.html', 'INSTALL', true); } -- cgit v1.2.1 From 93b37b24c2d546a2bc80830508d64338a24f9afa Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Wed, 4 Nov 2015 14:00:59 +0100 Subject: [ticket/14269] Use http_exceptions in the installer instead of die() PHPBB3-14269 --- phpBB/phpbb/install/controller/install.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'phpBB/phpbb/install/controller/install.php') diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php index 8d5ff95958..0fd4e8897c 100644 --- a/phpBB/phpbb/install/controller/install.php +++ b/phpBB/phpbb/install/controller/install.php @@ -13,6 +13,7 @@ namespace phpbb\install\controller; +use phpbb\exception\http_exception; use phpbb\install\helper\install_helper; use phpbb\install\helper\navigation\navigation_provider; use Symfony\Component\HttpFoundation\StreamedResponse; @@ -97,12 +98,14 @@ class install * Controller logic * * @return Response|StreamedResponse + * + * @throws http_exception When phpBB is already installed */ public function handle() { if ($this->install_helper->is_phpbb_installed()) { - die ('phpBB is already installed'); + throw new http_exception(404, 'INSTALL_PHPBB_IS_ALREADY_INSTALLED'); } $this->template->assign_vars(array( -- cgit v1.2.1 From 02a9264780f3896cf88b9d793dbf8831aa54e029 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 3 Dec 2015 20:31:49 +0100 Subject: [ticket/14269] Fix comments and language var names PHPBB3-14269 --- phpBB/phpbb/install/controller/install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/install/controller/install.php') diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php index 0fd4e8897c..baa4e4807a 100644 --- a/phpBB/phpbb/install/controller/install.php +++ b/phpBB/phpbb/install/controller/install.php @@ -105,7 +105,7 @@ class install { if ($this->install_helper->is_phpbb_installed()) { - throw new http_exception(404, 'INSTALL_PHPBB_IS_ALREADY_INSTALLED'); + throw new http_exception(404, 'INSTALL_PHPBB_INSTALLED'); } $this->template->assign_vars(array( -- cgit v1.2.1 From 44a90c9812c4eff73051e75647362859f9407a5f Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Sat, 5 Dec 2015 15:42:22 +0100 Subject: [ticket/14269] Change HTTP status codes to 403 PHPBB3-14269 --- phpBB/phpbb/install/controller/install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/install/controller/install.php') diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php index baa4e4807a..8bf9062b08 100644 --- a/phpBB/phpbb/install/controller/install.php +++ b/phpBB/phpbb/install/controller/install.php @@ -105,7 +105,7 @@ class install { if ($this->install_helper->is_phpbb_installed()) { - throw new http_exception(404, 'INSTALL_PHPBB_INSTALLED'); + throw new http_exception(403, 'INSTALL_PHPBB_INSTALLED'); } $this->template->assign_vars(array( -- cgit v1.2.1 From 73e6e5b77faadbb7676961bf38122d669de111db Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 3 Dec 2015 17:50:29 +0100 Subject: [ticket/13454] Remove unused variables This is the first part of the changes. More to come. PHPBB3-13454 --- phpBB/phpbb/install/controller/install.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/phpbb/install/controller/install.php') diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php index 8bf9062b08..b987d91c6a 100644 --- a/phpBB/phpbb/install/controller/install.php +++ b/phpBB/phpbb/install/controller/install.php @@ -19,7 +19,6 @@ use phpbb\install\helper\navigation\navigation_provider; use Symfony\Component\HttpFoundation\StreamedResponse; use Symfony\Component\HttpFoundation\Response; use phpbb\install\helper\iohandler\factory; -use phpbb\install\controller\helper; use phpbb\template\template; use phpbb\request\request_interface; use phpbb\install\installer; -- cgit v1.2.1 From 37705353c53a391aa44da7a30f10ed824a442cfc Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Sat, 6 Feb 2016 14:10:48 +0100 Subject: [ticket/14460] Use the selected language with AJAX requests as well PHPBB3-14460 --- phpBB/phpbb/install/controller/install.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'phpBB/phpbb/install/controller/install.php') diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php index b987d91c6a..92506872a3 100644 --- a/phpBB/phpbb/install/controller/install.php +++ b/phpBB/phpbb/install/controller/install.php @@ -123,6 +123,7 @@ class install // Set the appropriate input-output handler $this->installer->set_iohandler($this->iohandler_factory->get()); + $this->controller_helper->handle_language_select(); if ($this->request->is_ajax()) { @@ -142,8 +143,6 @@ class install // Determine whether the installation was started or not if (true) { - $this->controller_helper->handle_language_select(); - // Set active stage $this->menu_provider->set_nav_property( array('install', 0, 'introduction'), -- cgit v1.2.1