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 --- .../install/helper/iohandler/iohandler_base.php | 158 +++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 phpBB/phpbb/install/helper/iohandler/iohandler_base.php (limited to 'phpBB/phpbb/install/helper/iohandler/iohandler_base.php') diff --git a/phpBB/phpbb/install/helper/iohandler/iohandler_base.php b/phpBB/phpbb/install/helper/iohandler/iohandler_base.php new file mode 100644 index 0000000000..f767ecf4e9 --- /dev/null +++ b/phpBB/phpbb/install/helper/iohandler/iohandler_base.php @@ -0,0 +1,158 @@ + + * @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\helper\iohandler; + +/** + * Base class for installer input-output handlers + */ +abstract class iohandler_base implements iohandler_interface +{ + /** + * Array of errors + * + * Errors should be added, when the installation cannot continue without + * user interaction. If the aim is to notify the user about something, please + * use a warning instead. + * + * @var array + */ + protected $errors; + + /** + * Array of warnings + * + * @var array + */ + protected $warnings; + + /** + * Array of logs + * + * @var array + */ + protected $logs; + + /** + * @var \phpbb\language\language + */ + protected $language; + + /** + * @var int + */ + protected $task_progress_count; + + /** + * @var int + */ + protected $current_task_progress; + + /** + * @var string + */ + protected $current_task_name; + + /** + * Constructor + */ + public function __construct() + { + $this->errors = array(); + $this->warnings = array(); + $this->logs = array(); + + $this->task_progress_count = 0; + $this->current_task_progress = 0; + $this->current_task_name = ''; + } + + /** + * Set language service + * + * @param \phpbb\language\language $language + */ + public function set_language(\phpbb\language\language $language) + { + $this->language = $language; + } + + /** + * {@inheritdoc} + */ + public function add_error_message($error_title, $error_description = false) + { + $this->errors[] = $this->translate_message($error_title, $error_description); + } + + /** + * {@inheritdoc} + */ + public function add_warning_message($warning_title, $warning_description = false) + { + $this->warnings[] = $this->translate_message($warning_title, $warning_description); + } + + /** + * {@inheritdoc} + */ + public function add_log_message($log_title, $log_description = false) + { + $this->logs[] = $this->translate_message($log_title, $log_description); + } + + /** + * {@inheritdoc} + */ + public function set_task_count($task_count) + { + $this->task_progress_count = $task_count; + } + + /** + * {@inheritdoc} + */ + public function set_progress($task_lang_key, $task_number) + { + if (!empty($task_lang_key)) + { + $this->current_task_name = $this->language->lang($task_lang_key); + $this->current_task_progress = $task_number; + } + } + + /** + * Localize message. + * + * Note: When an array is passed into the parameters below, it will be + * resolved as printf($param[0], $param[1], ...). + * + * @param array|string $title Title of the message + * @param array|string|bool $description Description of the message + * + * @return array Localized message in an array + */ + protected function translate_message($title, $description) + { + $message_array = array(); + + $message_array['title'] = call_user_func_array(array($this->language, 'lang'), (array) $title); + + if ($description !== false) + { + $message_array['description'] = call_user_func_array(array($this->language, 'lang'), (array) $description); + } + + return $message_array; + } +} -- cgit v1.2.1 From 06f4ebce1b1cc8ecd5ddd84f7d2705007a685de3 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 31 May 2015 17:19:42 +0200 Subject: [ticket/13740] CLI installer and fixes [ci skip] PHPBB3-13740 --- .../install/helper/iohandler/iohandler_base.php | 34 +++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'phpBB/phpbb/install/helper/iohandler/iohandler_base.php') diff --git a/phpBB/phpbb/install/helper/iohandler/iohandler_base.php b/phpBB/phpbb/install/helper/iohandler/iohandler_base.php index f767ecf4e9..006411f1e3 100644 --- a/phpBB/phpbb/install/helper/iohandler/iohandler_base.php +++ b/phpBB/phpbb/install/helper/iohandler/iohandler_base.php @@ -43,6 +43,13 @@ abstract class iohandler_base implements iohandler_interface */ protected $logs; + /** + * Array of success messages + * + * @var array + */ + protected $success; + /** * @var \phpbb\language\language */ @@ -71,6 +78,7 @@ abstract class iohandler_base implements iohandler_interface $this->errors = array(); $this->warnings = array(); $this->logs = array(); + $this->success = array(); $this->task_progress_count = 0; $this->current_task_progress = 0; @@ -111,6 +119,14 @@ abstract class iohandler_base implements iohandler_interface $this->logs[] = $this->translate_message($log_title, $log_description); } + /** + * {@inheritdoc} + */ + public function add_success_message($success_title, $success_description = false) + { + $this->success[] = $this->translate_message($success_title, $success_description); + } + /** * {@inheritdoc} */ @@ -124,11 +140,27 @@ abstract class iohandler_base implements iohandler_interface */ public function set_progress($task_lang_key, $task_number) { + $this->current_task_name = ''; + if (!empty($task_lang_key)) { $this->current_task_name = $this->language->lang($task_lang_key); - $this->current_task_progress = $task_number; } + + $this->current_task_progress = $task_number; + } + + /** + * {@inheritdoc} + */ + public function finish_progress($message_lang_key) + { + if (!empty($message_lang_key)) + { + $this->current_task_name = $this->language->lang($message_lang_key); + } + + $this->current_task_progress = $this->task_progress_count; } /** -- 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/helper/iohandler/iohandler_base.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'phpBB/phpbb/install/helper/iohandler/iohandler_base.php') diff --git a/phpBB/phpbb/install/helper/iohandler/iohandler_base.php b/phpBB/phpbb/install/helper/iohandler/iohandler_base.php index 006411f1e3..530cb4766b 100644 --- a/phpBB/phpbb/install/helper/iohandler/iohandler_base.php +++ b/phpBB/phpbb/install/helper/iohandler/iohandler_base.php @@ -80,6 +80,7 @@ abstract class iohandler_base implements iohandler_interface $this->logs = array(); $this->success = array(); + $this->restart_progress_bar = false; $this->task_progress_count = 0; $this->current_task_progress = 0; $this->current_task_name = ''; @@ -130,9 +131,10 @@ abstract class iohandler_base implements iohandler_interface /** * {@inheritdoc} */ - public function set_task_count($task_count) + public function set_task_count($task_count, $restart = false) { $this->task_progress_count = $task_count; + $this->restart_progress_bar = $restart; } /** -- cgit v1.2.1 From 6188a8777950ffeaa80593d815600c84911ac932 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 7 Dec 2015 23:36:49 +0100 Subject: [ticket/14344] Improve output of HTML errors trigged during install PHPBB3-14344 --- phpBB/phpbb/install/helper/iohandler/iohandler_base.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'phpBB/phpbb/install/helper/iohandler/iohandler_base.php') diff --git a/phpBB/phpbb/install/helper/iohandler/iohandler_base.php b/phpBB/phpbb/install/helper/iohandler/iohandler_base.php index 530cb4766b..8dee5390a9 100644 --- a/phpBB/phpbb/install/helper/iohandler/iohandler_base.php +++ b/phpBB/phpbb/install/helper/iohandler/iohandler_base.php @@ -101,6 +101,10 @@ abstract class iohandler_base implements iohandler_interface */ public function add_error_message($error_title, $error_description = false) { + if (strpos($error_title, '
') !== false) + { + $error_title = strip_tags(htmlspecialchars_decode($error_title)); + } $this->errors[] = $this->translate_message($error_title, $error_description); } -- cgit v1.2.1 From 2fe81c1ccb20035c9d66503726a7ff8df8b7fd78 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 20 Dec 2015 22:20:56 +0100 Subject: [ticket/14373] Do not pass arrays to strpos() PHPBB3-14373 --- phpBB/phpbb/install/helper/iohandler/iohandler_base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/install/helper/iohandler/iohandler_base.php') diff --git a/phpBB/phpbb/install/helper/iohandler/iohandler_base.php b/phpBB/phpbb/install/helper/iohandler/iohandler_base.php index 8dee5390a9..7271fe9bc0 100644 --- a/phpBB/phpbb/install/helper/iohandler/iohandler_base.php +++ b/phpBB/phpbb/install/helper/iohandler/iohandler_base.php @@ -101,7 +101,7 @@ abstract class iohandler_base implements iohandler_interface */ public function add_error_message($error_title, $error_description = false) { - if (strpos($error_title, '
') !== false) + if (!is_array($error_title) && strpos($error_title, '
') !== false) { $error_title = strip_tags(htmlspecialchars_decode($error_title)); } -- cgit v1.2.1 From a649768e17d25bcf55ae539420abe4eb4b7a1ef1 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Wed, 28 Oct 2015 15:00:11 +0100 Subject: [ticket/14262] Move convertor to controller PHPBB3-14262 --- phpBB/phpbb/install/helper/iohandler/iohandler_base.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'phpBB/phpbb/install/helper/iohandler/iohandler_base.php') diff --git a/phpBB/phpbb/install/helper/iohandler/iohandler_base.php b/phpBB/phpbb/install/helper/iohandler/iohandler_base.php index 7271fe9bc0..fed4bc101f 100644 --- a/phpBB/phpbb/install/helper/iohandler/iohandler_base.php +++ b/phpBB/phpbb/install/helper/iohandler/iohandler_base.php @@ -169,6 +169,14 @@ abstract class iohandler_base implements iohandler_interface $this->current_task_progress = $this->task_progress_count; } + /** + * {@inheritdoc} + */ + public function generate_form_render_data($title, $form) + { + return ''; + } + /** * Localize message. * -- cgit v1.2.1 From f2fde5e7a32943017f7f22b070c974f161d14d64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Bartus?= Date: Wed, 7 Dec 2016 21:01:47 +0100 Subject: [ticket/14897] Add $restart_progress_bar to iohandler base PHPBB3-14897 --- phpBB/phpbb/install/helper/iohandler/iohandler_base.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'phpBB/phpbb/install/helper/iohandler/iohandler_base.php') diff --git a/phpBB/phpbb/install/helper/iohandler/iohandler_base.php b/phpBB/phpbb/install/helper/iohandler/iohandler_base.php index fed4bc101f..1797a6c9ad 100644 --- a/phpBB/phpbb/install/helper/iohandler/iohandler_base.php +++ b/phpBB/phpbb/install/helper/iohandler/iohandler_base.php @@ -70,6 +70,11 @@ abstract class iohandler_base implements iohandler_interface */ protected $current_task_name; + /** + * @var bool + */ + protected $restart_progress_bar; + /** * Constructor */ -- cgit v1.2.1