aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCHItA <mate.bartus@gmail.com>2015-06-11 19:32:11 +0200
committerMate Bartus <mate.bartus@gmail.com>2015-07-08 01:28:02 +0200
commitdb4cfa7df62d5911bc5a0edcdc59236c39aede08 (patch)
tree35c6a99c900a0b9a3fa5db0e8d60e39045ed6591
parent1b81bf5b2370c045a6369705d2a11a2b35fe2281 (diff)
downloadforums-db4cfa7df62d5911bc5a0edcdc59236c39aede08.tar
forums-db4cfa7df62d5911bc5a0edcdc59236c39aede08.tar.gz
forums-db4cfa7df62d5911bc5a0edcdc59236c39aede08.tar.bz2
forums-db4cfa7df62d5911bc5a0edcdc59236c39aede08.tar.xz
forums-db4cfa7df62d5911bc5a0edcdc59236c39aede08.zip
[ticket/13740] Add navigation bar support for the installer
Also added various UI elements and texts. [ci skip] PHPBB3-13740
-rw-r--r--phpBB/adm/style/install_header.html2
-rw-r--r--phpBB/adm/style/installer_form.html4
-rw-r--r--phpBB/adm/style/installer_install.html6
-rw-r--r--phpBB/assets/javascript/installer.js61
-rw-r--r--phpBB/config/installer/container/services_install_controller.yml3
-rw-r--r--phpBB/config/installer/container/services_install_requirements.yml1
-rw-r--r--phpBB/install/controller/helper.php24
-rw-r--r--phpBB/install/controller/install.php108
-rw-r--r--phpBB/install/controller/installer_index.php (renamed from phpBB/install/controller/install_index.php)2
-rw-r--r--phpBB/install/exception/installer_config_not_writable_exception.php22
-rw-r--r--phpBB/install/exception/user_interaction_required_exception.php3
-rw-r--r--phpBB/install/helper/config.php49
-rw-r--r--phpBB/install/helper/iohandler/ajax_iohandler.php51
-rw-r--r--phpBB/install/helper/iohandler/factory.php4
-rw-r--r--phpBB/install/helper/iohandler/iohandler_interface.php19
-rw-r--r--phpBB/install/helper/navigation/install_navigation.php24
-rw-r--r--phpBB/install/helper/navigation/navigation_provider.php27
-rw-r--r--phpBB/install/installer.php34
-rw-r--r--phpBB/install/module/install_data/module.php8
-rw-r--r--phpBB/install/module/install_database/module.php8
-rw-r--r--phpBB/install/module/install_filesystem/module.php8
-rw-r--r--phpBB/install/module/install_finish/module.php8
-rw-r--r--phpBB/install/module/obtain_data/module.php8
-rw-r--r--phpBB/install/module/requirements/module.php17
-rw-r--r--phpBB/install/module_base.php4
-rw-r--r--phpBB/install/module_interface.php7
-rw-r--r--phpBB/language/en/install.php37
27 files changed, 495 insertions, 54 deletions
diff --git a/phpBB/adm/style/install_header.html b/phpBB/adm/style/install_header.html
index 6f7f129d39..b162fa3e89 100644
--- a/phpBB/adm/style/install_header.html
+++ b/phpBB/adm/style/install_header.html
@@ -43,7 +43,7 @@
<li<!-- IF l_block1.S_SELECTED --> id="activemenu"<!-- ENDIF -->><a href="{l_block1.U_TITLE}"><span>{l_block1.L_TITLE}</span></a></li>
<!-- END l_block1 -->
<!-- BEGIN l_block2 -->
- <li<!-- IF l_block2.S_SELECTED --> id="activemenu"<!-- ENDIF -->><span<!-- IF l_block2.S_COMPLETE --> class="completed"<!-- ENDIF -->>{l_block2.L_TITLE}</span></li>
+ <li<!-- IF l_block2.S_SELECTED --> id="activemenu"<!-- ENDIF -->><span<!-- IF l_block2.S_COMPLETE --> class="completed"<!-- ENDIF --> id="installer-stage-{l_block2.STAGE_NAME}">{l_block2.L_TITLE}</span></li>
<!-- END l_block2 -->
</ul>
</div>
diff --git a/phpBB/adm/style/installer_form.html b/phpBB/adm/style/installer_form.html
index dbcf3c19f8..3cb4185bc6 100644
--- a/phpBB/adm/style/installer_form.html
+++ b/phpBB/adm/style/installer_form.html
@@ -1,6 +1,8 @@
<form id="<!-- IF FORM_ID -->{FORM_ID}<!-- ELSE -->install_install<!-- ENDIF -->" method="POST" action="{U_ACTION}">
<!-- IF .options -->
+<!-- IF S_FORM_ELEM_COUNT > 1 -->
<fieldset>
+<!-- ENDIF -->
<!-- BEGIN options -->
<!-- IF options.S_LEGEND -->
@@ -40,7 +42,9 @@
</dd>
</dl>
<!-- ELSE -->
+<!-- IF S_FORM_ELEM_COUNT > 1 -->
</fieldset>
+<!-- ENDIF -->
<fieldset class="submit-buttons">
<legend>{L_SUBMIT}</legend>
<input class="button1" type="submit" name="{options.KEY}" value="{options.TITLE}" />
diff --git a/phpBB/adm/style/installer_install.html b/phpBB/adm/style/installer_install.html
index 7d62075c62..7700c79036 100644
--- a/phpBB/adm/style/installer_install.html
+++ b/phpBB/adm/style/installer_install.html
@@ -1,11 +1,11 @@
<!-- INCLUDE install_header.html -->
-<h1>{L_INSTALL}</h1>
-{CONTENT}
+<h1>{TITLE}</h1>
+<p>{CONTENT}</p>
<!-- IF SHOW_INSTALL_START_FORM -->
<form id="install_install" method="post" action="{U_ACTION}">
<fieldset class="submit-buttons">
<legend>{L_SUBMIT}</legend>
- <input name="install" type="submit" value="{L_INSTALL}" />
+ <input class="button1" name="install" type="submit" value="{L_INSTALL}" />
</fieldset>
</form>
<!-- ENDIF -->
diff --git a/phpBB/assets/javascript/installer.js b/phpBB/assets/javascript/installer.js
index a9a315c0d5..eafcd78f47 100644
--- a/phpBB/assets/javascript/installer.js
+++ b/phpBB/assets/javascript/installer.js
@@ -96,6 +96,45 @@
}
/**
+ * Handles navigation status updates
+ *
+ * @param navObj
+ */
+ function updateNavbarStatus(navObj) {
+ var navID, $stage, $stageListItem, $active;
+ $active = $('#activemenu');
+
+ if (navObj.hasOwnProperty('finished')) {
+ // This should be an Array
+ var navItems = navObj.finished;
+
+ for (var i = 0; i < navItems.length; i++) {
+ navID = 'installer-stage-' + navItems[i];
+ $stage = $('#' + navID);
+ $stageListItem = $stage.parent();
+
+ if ($active.length && $active.is($stageListItem)) {
+ $active.removeAttr('id');
+ }
+
+ $stage.addClass('completed');
+ }
+ }
+
+ if (navObj.hasOwnProperty('active')) {
+ navID = 'installer-stage-' + navObj.active;
+ $stage = $('#' + navID);
+ $stageListItem = $stage.parent();
+
+ if ($active.length && !$active.is($stageListItem)) {
+ $active.removeAttr('id');
+ }
+
+ $stageListItem.attr('id', 'activemenu');
+ }
+ }
+
+ /**
* Renders progress bar
*
* @param progressObject
@@ -166,6 +205,10 @@
if (responseObject.hasOwnProperty('progress')) {
setProgress(responseObject.progress);
}
+
+ if (responseObject.hasOwnProperty('nav')) {
+ updateNavbarStatus(responseObject.nav);
+ }
}
/**
@@ -232,6 +275,14 @@
}
/**
+ * Resets the polling timer
+ */
+ function resetPolling() {
+ clearInterval(pollTimer);
+ nextReadPosition = 0;
+ }
+
+ /**
* Sets up timer for processing the streamed HTTP response
*
* @param xhReq
@@ -240,15 +291,7 @@
resetPolling();
pollTimer = setInterval(function () {
pollContent(xhReq);
- }, 500);
- }
-
- /**
- * Resets the polling timer
- */
- function resetPolling() {
- clearInterval(pollTimer);
- nextReadPosition = 0;
+ }, 250);
}
/**
diff --git a/phpBB/config/installer/container/services_install_controller.yml b/phpBB/config/installer/container/services_install_controller.yml
index 5eea133590..6e6ef4acea 100644
--- a/phpBB/config/installer/container/services_install_controller.yml
+++ b/phpBB/config/installer/container/services_install_controller.yml
@@ -23,7 +23,10 @@ services:
class: phpbb\install\controller\install
arguments:
- @phpbb.installer.controller.helper
+ - @installer.helper.config
- @installer.helper.iohandler_factory
+ - @installer.navigation.provider
+ - @language
- @template
- @request
- @installer.installer.install
diff --git a/phpBB/config/installer/container/services_install_requirements.yml b/phpBB/config/installer/container/services_install_requirements.yml
index b1f38713e4..c93856837d 100644
--- a/phpBB/config/installer/container/services_install_requirements.yml
+++ b/phpBB/config/installer/container/services_install_requirements.yml
@@ -13,6 +13,7 @@ services:
- @installer.helper.database
- @installer.helper.iohandler
+# Please note, that the name of this module is hard coded in the installer service
installer.module.requirements_install:
class: phpbb\install\module\requirements\module
parent: installer.module_base
diff --git a/phpBB/install/controller/helper.php b/phpBB/install/controller/helper.php
index 7a5e20406d..0df1ae71a4 100644
--- a/phpBB/install/controller/helper.php
+++ b/phpBB/install/controller/helper.php
@@ -157,13 +157,25 @@ class helper
{
// @todo Sort navs by order
- foreach ($entry[0] as $sub_entry)
+ foreach ($entry[0] as $name => $sub_entry)
{
- $this->template->assign_block_vars('l_block1', array(
- 'L_TITLE' => $this->language->lang($sub_entry['label']),
- 'S_SELECTED' => (isset($sub_entry['route']) && $sub_entry['route'] === $this->request->get('_route')),
- 'U_TITLE' => $this->route($sub_entry['route']),
- ));
+ if (isset($sub_entry['stage']) && $sub_entry['stage'] === true)
+ {
+ $this->template->assign_block_vars('l_block2', array(
+ 'L_TITLE' => $this->language->lang($sub_entry['label']),
+ 'S_SELECTED' => (isset($sub_entry['selected']) && $sub_entry['selected'] === true),
+ 'S_COMPLETE' => (isset($sub_entry['completed']) && $sub_entry['completed'] === true),
+ 'STAGE_NAME' => $name,
+ ));
+ }
+ else
+ {
+ $this->template->assign_block_vars('l_block1', array(
+ 'L_TITLE' => $this->language->lang($sub_entry['label']),
+ 'S_SELECTED' => (isset($sub_entry['route']) && $sub_entry['route'] === $this->request->get('_route')),
+ 'U_TITLE' => $this->route($sub_entry['route']),
+ ));
+ }
}
}
}
diff --git a/phpBB/install/controller/install.php b/phpBB/install/controller/install.php
index 4021c5625b..c1329b6456 100644
--- a/phpBB/install/controller/install.php
+++ b/phpBB/install/controller/install.php
@@ -13,7 +13,16 @@
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
@@ -21,51 +30,72 @@ use Symfony\Component\HttpFoundation\StreamedResponse;
class install
{
/**
- * @var \phpbb\install\controller\helper
+ * @var helper
*/
protected $controller_helper;
/**
- * @var \phpbb\install\helper\iohandler\factory
+ * @var config
+ */
+ protected $installer_config;
+
+ /**
+ * @var factory
*/
protected $iohandler_factory;
/**
- * @var \phpbb\template\template
+ * @var navigation_provider
+ */
+ protected $menu_provider;
+
+ /**
+ * @var language
+ */
+ protected $language;
+
+ /**
+ * @var template
*/
protected $template;
/**
- * @var \phpbb\request\request_interface
+ * @var request_interface
*/
protected $request;
/**
- * @var \phpbb\install\installer
+ * @var installer
*/
protected $installer;
/**
* Constructor
*
- * @param helper $helper
- * @param \phpbb\install\helper\iohandler\factory $factory
- * @param \phpbb\request\request_interface $request
- * @param \phpbb\install\installer $installer
+ * @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, \phpbb\install\helper\iohandler\factory $factory, \phpbb\template\template $template, \phpbb\request\request_interface $request, \phpbb\install\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->iohandler_factory = $factory;
- $this->template = $template;
- $this->request = $request;
- $this->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 \Symfony\Component\HttpFoundation\Response|StreamedResponse
+ * @return Response|StreamedResponse
*/
public function handle()
{
@@ -86,13 +116,38 @@ class install
}
// Set the appropriate input-output handler
- //$this->installer->set_iohandler($this->iohandler_factory->get());
+ $this->installer->set_iohandler($this->iohandler_factory->get());
- if ($this->request->is_ajax())
+ // 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']))
{
- // @todo: remove this line, and use the above
- $this->installer->set_iohandler($this->iohandler_factory->get());
+ $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) {
@@ -106,9 +161,20 @@ class install
// 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,
+ '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');
}
diff --git a/phpBB/install/controller/install_index.php b/phpBB/install/controller/installer_index.php
index c61d68f7fb..3d5224f1be 100644
--- a/phpBB/install/controller/install_index.php
+++ b/phpBB/install/controller/installer_index.php
@@ -13,7 +13,7 @@
namespace phpbb\install\controller;
-class install_index
+class installer_index
{
/**
* @var helper
diff --git a/phpBB/install/exception/installer_config_not_writable_exception.php b/phpBB/install/exception/installer_config_not_writable_exception.php
new file mode 100644
index 0000000000..3f3b03f178
--- /dev/null
+++ b/phpBB/install/exception/installer_config_not_writable_exception.php
@@ -0,0 +1,22 @@
+<?php
+/**
+ *
+ * This file is part of the phpBB Forum Software package.
+ *
+ * @copyright (c) phpBB Limited <https://www.phpbb.com>
+ * @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\exception;
+
+/**
+ * Exception for the event when installer config is not writable to disk
+ */
+class installer_config_not_writable_exception extends installer_exception
+{
+
+}
diff --git a/phpBB/install/exception/user_interaction_required_exception.php b/phpBB/install/exception/user_interaction_required_exception.php
index 0aaae648cf..d65a448841 100644
--- a/phpBB/install/exception/user_interaction_required_exception.php
+++ b/phpBB/install/exception/user_interaction_required_exception.php
@@ -15,6 +15,9 @@ namespace phpbb\install\exception;
/**
* This exception should be thrown when user interaction is inevitable
+ *
+ * Note: Please note that the output should already be setup for the user
+ * when you use throw this exception
*/
class user_interaction_required_exception extends installer_exception
{
diff --git a/phpBB/install/helper/config.php b/phpBB/install/helper/config.php
index 0c04b5e950..5c1348c06d 100644
--- a/phpBB/install/helper/config.php
+++ b/phpBB/install/helper/config.php
@@ -13,6 +13,8 @@
namespace phpbb\install\helper;
+use phpbb\install\exception\installer_config_not_writable_exception;
+
/**
* Stores common settings and installation status
*/
@@ -65,6 +67,13 @@ class config
protected $system_data;
/**
+ * Array containing navigation bar information
+ *
+ * @var array
+ */
+ protected $navigation_data;
+
+ /**
* Constructor
*/
public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, \phpbb\php\ini $php_ini, $phpbb_root_path)
@@ -74,6 +83,7 @@ class config
$this->phpbb_root_path = $phpbb_root_path;
// Set up data arrays
+ $this->navigation_data = array();
$this->installer_config = array();
$this->system_data = array();
$this->progress_data = array(
@@ -206,6 +216,7 @@ class config
$this->installer_config = $unserialized_data['installer_config'];
$this->progress_data = $unserialized_data['progress_data'];
+ $this->navigation_data = $unserialized_data['navigation_data'];
}
/**
@@ -217,6 +228,7 @@ class config
$save_array = array(
'installer_config' => $this->installer_config,
'progress_data' => $this->progress_data,
+ 'navigation_data' => $this->navigation_data,
);
// Create file content
@@ -225,7 +237,12 @@ class config
$file_content .= "\n";
// Dump file_content to disk
- $fp = fopen($this->install_config_file, 'w');
+ $fp = @fopen($this->install_config_file, 'w');
+ if (!$fp)
+ {
+ throw new installer_config_not_writable_exception();
+ }
+
fwrite($fp, $file_content);
fclose($fp);
}
@@ -286,6 +303,36 @@ class config
}
/**
+ * Marks stage as completed in the navigation bar
+ *
+ * @param array $nav_path Array to the navigation elem
+ */
+ public function set_finished_navigation_stage($nav_path)
+ {
+ $this->navigation_data['finished'][] = $nav_path;
+ }
+
+ /**
+ * Marks stage as active in the navigation bar
+ *
+ * @param array $nav_path Array to the navigation elem
+ */
+ public function set_active_navigation_stage($nav_path)
+ {
+ $this->navigation_data['active'] = $nav_path;
+ }
+
+ /**
+ * Returns navigation data
+ *
+ * @return array
+ */
+ public function get_navigation_data()
+ {
+ return $this->navigation_data;
+ }
+
+ /**
* Filling up system_data array
*/
protected function setup_system_data()
diff --git a/phpBB/install/helper/iohandler/ajax_iohandler.php b/phpBB/install/helper/iohandler/ajax_iohandler.php
index 960dd615b5..71571fecba 100644
--- a/phpBB/install/helper/iohandler/ajax_iohandler.php
+++ b/phpBB/install/helper/iohandler/ajax_iohandler.php
@@ -34,6 +34,16 @@ class ajax_iohandler extends iohandler_base
protected $form;
/**
+ * @var bool
+ */
+ protected $request_client_refresh;
+
+ /**
+ * @var array
+ */
+ protected $nav_data;
+
+ /**
* Constructor
*
* @param \phpbb\request\request_interface $request HTTP request interface
@@ -44,6 +54,7 @@ class ajax_iohandler extends iohandler_base
$this->request = $request;
$this->template = $template;
$this->form = '';
+ $this->nav_data = array();
parent::__construct();
}
@@ -89,6 +100,8 @@ class ajax_iohandler extends iohandler_base
// This code is pretty ugly... but works
//
+ $this->template->assign_var('S_FORM_ELEM_COUNT', sizeof($form));
+
$this->template->assign_block_vars('options', array(
'LEGEND' => $this->language->lang($title),
'S_LEGEND' => true,
@@ -187,9 +200,21 @@ class ajax_iohandler extends iohandler_base
);
}
+ if (!empty($this->nav_data))
+ {
+ $json_array['nav'] = $this->nav_data;
+ }
+
$this->errors = array();
$this->warnings = array();
$this->logs = array();
+ $this->nav_data = array();
+
+ if ($this->request_client_refresh)
+ {
+ $json_array['refresh'] = true;
+ $this->request_client_refresh = false;
+ }
return $json_array;
}
@@ -204,6 +229,32 @@ class ajax_iohandler extends iohandler_base
}
/**
+ * {@inheritdoc}
+ */
+ public function request_refresh()
+ {
+ $this->request_client_refresh = true;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function set_active_stage_menu($menu_path)
+ {
+ $this->nav_data['active'] = $menu_path[sizeof($menu_path) - 1];
+ $this->send_response();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function set_finished_stage_menu($menu_path)
+ {
+ $this->nav_data['finished'][] = $menu_path[sizeof($menu_path) - 1];
+ $this->send_response();
+ }
+
+ /**
* Callback function for language replacing
*
* @param array $matches
diff --git a/phpBB/install/helper/iohandler/factory.php b/phpBB/install/helper/iohandler/factory.php
index 0b59e5ec63..0af75b78ae 100644
--- a/phpBB/install/helper/iohandler/factory.php
+++ b/phpBB/install/helper/iohandler/factory.php
@@ -64,6 +64,10 @@ class factory
case 'ajax':
return $this->container->get('installer.helper.iohandler_ajax');
break;
+ case 'nojs':
+ // @todo replace this
+ return $this->container->get('installer.helper.iohandler_ajax');
+ break;
default:
throw new iohandler_not_implemented_exception();
break;
diff --git a/phpBB/install/helper/iohandler/iohandler_interface.php b/phpBB/install/helper/iohandler/iohandler_interface.php
index 387a8617b9..c40fea24ce 100644
--- a/phpBB/install/helper/iohandler/iohandler_interface.php
+++ b/phpBB/install/helper/iohandler/iohandler_interface.php
@@ -123,4 +123,23 @@ interface iohandler_interface
* @param int $task_number Position of the current task in the task queue
*/
public function set_progress($task_lang_key, $task_number);
+
+ /**
+ * Sends refresh request to the client
+ */
+ public function request_refresh();
+
+ /**
+ * Marks stage as active in the navigation bar
+ *
+ * @param array $menu_path Array to the navigation elem
+ */
+ public function set_active_stage_menu($menu_path);
+
+ /**
+ * Marks stage as completed in the navigation bar
+ *
+ * @param array $menu_path Array to the navigation elem
+ */
+ public function set_finished_stage_menu($menu_path);
}
diff --git a/phpBB/install/helper/navigation/install_navigation.php b/phpBB/install/helper/navigation/install_navigation.php
index 3e29e55038..1389f11fa0 100644
--- a/phpBB/install/helper/navigation/install_navigation.php
+++ b/phpBB/install/helper/navigation/install_navigation.php
@@ -21,7 +21,29 @@ class install_navigation implements navigation_interface
'install' => array(
'label' => 'INSTALL',
'route' => 'phpbb_installer_install',
- 'order' => 0,
+ 'order' => 1,
+ array(
+ 'introduction' => array(
+ 'label' => 'INTRODUCTION_TITLE',
+ 'stage' => true,
+ 'order' => 0,
+ ),
+ 'requirements' => array(
+ 'label' => 'STAGE_REQUIREMENTS',
+ 'stage' => true,
+ 'order' => 1,
+ ),
+ 'obtain_data' => array(
+ 'label' => 'STAGE_OBTAIN_DATA',
+ 'stage' => true,
+ 'order' => 2,
+ ),
+ 'install' => array(
+ 'label' => 'STAGE_INSTALL',
+ 'stage' => true,
+ 'order' => 3,
+ ),
+ ),
),
);
}
diff --git a/phpBB/install/helper/navigation/navigation_provider.php b/phpBB/install/helper/navigation/navigation_provider.php
index ddb2509348..1f58cbea83 100644
--- a/phpBB/install/helper/navigation/navigation_provider.php
+++ b/phpBB/install/helper/navigation/navigation_provider.php
@@ -13,6 +13,8 @@
namespace phpbb\install\helper\navigation;
+use phpbb\di\service_collection;
+
/**
* Installers navigation provider
*/
@@ -26,9 +28,9 @@ class navigation_provider
/**
* Constructor
*
- * @param \phpbb\di\service_collection $plugins
+ * @param service_collection $plugins
*/
- public function __construct(\phpbb\di\service_collection $plugins)
+ public function __construct(service_collection $plugins)
{
$this->menu_collection = array();
@@ -60,6 +62,27 @@ class navigation_provider
}
/**
+ * Set a property in the navigation array
+ *
+ * @param array $nav_element Array to the navigation elem
+ * @param array $property_array Array with the properties to set
+ */
+ public function set_nav_property($nav_element, $property_array)
+ {
+ $array_pointer = array();
+ $array_root_pointer = &$array_pointer;
+ foreach ($nav_element as $array_path)
+ {
+ $array_pointer[$array_path] = array();
+ $array_pointer = &$array_pointer[$array_path];
+ }
+
+ $array_pointer = $property_array;
+
+ $this->merge($array_root_pointer, $this->menu_collection);
+ }
+
+ /**
* Recursive array merge
*
* This function is necessary to be able to replace the options of
diff --git a/phpBB/install/installer.php b/phpBB/install/installer.php
index 1c7c9c8a92..f5da898a00 100644
--- a/phpBB/install/installer.php
+++ b/phpBB/install/installer.php
@@ -13,6 +13,7 @@
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;
@@ -106,6 +107,10 @@ class installer
// 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)
@@ -168,6 +173,9 @@ class installer
// 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,
@@ -176,8 +184,15 @@ class installer
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);
}
@@ -189,12 +204,12 @@ class installer
}
else
{
- // @todo: Send refresh request
+ $this->iohandler->request_refresh();
}
}
catch (user_interaction_required_exception $e)
{
- // @todo handle exception
+ // Do nothing
}
catch (module_not_found_exception $e)
{
@@ -234,7 +249,20 @@ class installer
}
// Save install progress
- $this->install_config->save_config();
+ 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');
+ }
+ }
}
/**
diff --git a/phpBB/install/module/install_data/module.php b/phpBB/install/module/install_data/module.php
index 231bcb0866..77f1f73f1f 100644
--- a/phpBB/install/module/install_data/module.php
+++ b/phpBB/install/module/install_data/module.php
@@ -18,5 +18,11 @@ namespace phpbb\install\module\install_data;
*/
class module extends \phpbb\install\module_base
{
-
+ /**
+ * {@inheritdoc}
+ */
+ public function get_navigation_stage_path()
+ {
+ return array('install', 0, 'install');
+ }
}
diff --git a/phpBB/install/module/install_database/module.php b/phpBB/install/module/install_database/module.php
index d31c5573ec..0d8b33087f 100644
--- a/phpBB/install/module/install_database/module.php
+++ b/phpBB/install/module/install_database/module.php
@@ -18,5 +18,11 @@ namespace phpbb\install\module\install_database;
*/
class module extends \phpbb\install\module_base
{
-
+ /**
+ * {@inheritdoc}
+ */
+ public function get_navigation_stage_path()
+ {
+ return array('install', 0, 'install');
+ }
}
diff --git a/phpBB/install/module/install_filesystem/module.php b/phpBB/install/module/install_filesystem/module.php
index 9562c957fd..7215449664 100644
--- a/phpBB/install/module/install_filesystem/module.php
+++ b/phpBB/install/module/install_filesystem/module.php
@@ -18,5 +18,11 @@ namespace phpbb\install\module\install_filesystem;
*/
class module extends \phpbb\install\module_base
{
-
+ /**
+ * {@inheritdoc}
+ */
+ public function get_navigation_stage_path()
+ {
+ return array('install', 0, 'install');
+ }
}
diff --git a/phpBB/install/module/install_finish/module.php b/phpBB/install/module/install_finish/module.php
index 98c99d7cff..3a7544b84f 100644
--- a/phpBB/install/module/install_finish/module.php
+++ b/phpBB/install/module/install_finish/module.php
@@ -18,5 +18,11 @@ namespace phpbb\install\module\install_finish;
*/
class module extends \phpbb\install\module_base
{
-
+ /**
+ * {@inheritdoc}
+ */
+ public function get_navigation_stage_path()
+ {
+ return array('install', 0, 'install');
+ }
}
diff --git a/phpBB/install/module/obtain_data/module.php b/phpBB/install/module/obtain_data/module.php
index a181c5231a..0e008796c5 100644
--- a/phpBB/install/module/obtain_data/module.php
+++ b/phpBB/install/module/obtain_data/module.php
@@ -18,6 +18,14 @@ class module extends \phpbb\install\module_base
/**
* {@inheritdoc}
*/
+ public function get_navigation_stage_path()
+ {
+ return array('install', 0, 'obtain_data');
+ }
+
+ /**
+ * {@inheritdoc}
+ */
public function get_step_count()
{
return 0;
diff --git a/phpBB/install/module/requirements/module.php b/phpBB/install/module/requirements/module.php
index 5de6bd70b9..d87ca15128 100644
--- a/phpBB/install/module/requirements/module.php
+++ b/phpBB/install/module/requirements/module.php
@@ -61,6 +61,15 @@ class module extends \phpbb\install\module_base
if (!$tests_passed)
{
// If requirements are not met, exit form installer
+ // Set up UI for retesting
+ $this->iohandler->add_user_form_group('', array(
+ 'install' => array(
+ 'label' => 'RETEST_REQUIREMENTS',
+ 'type' => 'submit',
+ ),
+ ));
+
+ // Send the response and quit
$this->iohandler->send_response();
throw new user_interaction_required_exception();
}
@@ -77,4 +86,12 @@ class module extends \phpbb\install\module_base
{
return 0;
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_navigation_stage_path()
+ {
+ return array('install', 0, 'requirements');
+ }
}
diff --git a/phpBB/install/module_base.php b/phpBB/install/module_base.php
index ac7ce7583a..6c0c0e0c30 100644
--- a/phpBB/install/module_base.php
+++ b/phpBB/install/module_base.php
@@ -75,8 +75,8 @@ abstract class module_base implements module_interface
* Dependency getter
*
* @param ContainerInterface $container
- * @param config $config
- * @param iohandler_interface $iohandler
+ * @param config $config
+ * @param iohandler_interface $iohandler
*/
public function setup(ContainerInterface $container, config $config, iohandler_interface $iohandler)
{
diff --git a/phpBB/install/module_interface.php b/phpBB/install/module_interface.php
index 29918f0c34..a2d61e3958 100644
--- a/phpBB/install/module_interface.php
+++ b/phpBB/install/module_interface.php
@@ -53,4 +53,11 @@ interface module_interface
* @return int
*/
public function get_step_count();
+
+ /**
+ * Returns an array to the correct navigation stage
+ *
+ * @return array
+ */
+ public function get_navigation_stage_path();
}
diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php
index 92251a4992..f050d49ebd 100644
--- a/phpBB/language/en/install.php
+++ b/phpBB/language/en/install.php
@@ -40,6 +40,8 @@ if (empty($lang) || !is_array($lang))
$lang = array_merge($lang, array(
'INSTALL_PANEL' => 'Installation Panel',
+ 'STAGE_INSTALL' => 'Installing phpBB',
+
// Introduction page
'INTRODUCTION_TITLE' => 'Introduction',
'INTRODUCTION_BODY' => 'Welcome to phpBB3!<br /><br />phpBB® is the most widely used open source bulletin board solution in the world. phpBB3 is the latest installment in a package line started in 2000. Like its predecessors, phpBB3 is feature-rich, user-friendly, and fully supported by the phpBB Team. phpBB3 greatly improves on what made phpBB2 popular, and adds commonly requested features that were not present in previous versions. We hope it exceeds your expectations.<br /><br />This installation system will guide you through installing phpBB3, updating to the latest version of phpBB3 from past releases, as well as converting to phpBB3 from a different discussion board system (including phpBB2). For more information, we encourage you to read <a href="../docs/INSTALL.html">the installation guide</a>.<br /><br />To read the phpBB3 license or learn about obtaining support and our stance on it, please select the respective options from the side menu. To continue, please select the appropriate tab above.',
@@ -50,6 +52,33 @@ $lang = array_merge($lang, array(
// License
'LICENSE_TITLE' => 'General Public License',
+
+ // Install page
+ 'INSTALL_INTRO' => 'Welcome to Installation',
+ 'INSTALL_INTRO_BODY' => 'With this option, it is possible to install phpBB3 onto your server.</p><p>In order to proceed, you will need your database settings. If you do not know your database settings, please contact your host and ask for them. You will not be able to continue without them. You need:</p>
+
+ <ul>
+ <li>The Database Type - the database you will be using.</li>
+ <li>The Database server hostname or DSN - the address of the database server.</li>
+ <li>The Database server port - the port of the database server (most of the time this is not needed).</li>
+ <li>The Database name - the name of the database on the server.</li>
+ <li>The Database username and Database password - the login data to access the database.</li>
+ </ul>
+
+ <p><strong>Note:</strong> if you are installing using SQLite, you should enter the full path to your database file in the DSN field and leave the username and password fields blank. For security reasons, you should make sure that the database file is not stored in a location accessible from the web.</p>
+
+ <p>phpBB3 supports the following databases:</p>
+ <ul>
+ <li>MySQL 3.23 or above (MySQLi supported)</li>
+ <li>PostgreSQL 8.3+</li>
+ <li>SQLite 2.8.2+</li>
+ <li>SQLite 3.6.15+</li>
+ <li>MS SQL Server 2000 or above (directly or via ODBC)</li>
+ <li>MS SQL Server 2005 or above (native)</li>
+ <li>Oracle</li>
+ </ul>
+
+ <p>Only those databases supported on your server will be displayed.',
));
// Requirements translation
@@ -76,6 +105,10 @@ $lang = array_merge($lang, array(
'PHP_JSON_SUPPORT_EXPLAIN' => 'In order for phpBB to function correctly, the PHP JSON extension needs to be available.',
'PHP_SUPPORTED_DB' => 'Supported databases',
'PHP_SUPPORTED_DB_EXPLAIN' => 'You must have support for at least one compatible database within PHP. If no database modules are shown as available you should contact your hosting provider or review the relevant PHP installation documentation for advice.',
+
+ 'RETEST_REQUIREMENTS' => 'Retest requirements',
+
+ 'STAGE_REQUIREMENTS' => 'Check requirements'
));
// General error messages
@@ -85,6 +118,8 @@ $lang = array_merge($lang, array(
// Data obtaining translations
$lang = array_merge($lang, array(
+ 'STAGE_OBTAIN_DATA' => 'Set installation data',
+
//
// Admin data
//
@@ -263,4 +298,6 @@ $lang = array_merge($lang, array(
'TASK_SERVICE_INSTALLER_MISSING' => 'All installer task services should start with “installer”',
'TASK_CLASS_NOT_FOUND' => 'Installer task service definition is invalid. Service name “%1$s” given, the expected class namespace is “%2$s” for that. For more information please see the documentation of task_interface.',
+
+ 'INSTALLER_CONFIG_NOT_WRITABLE' => 'The installer config file is not writable.',
));