aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/adm/style/acp_ext_details.html24
-rw-r--r--phpBB/adm/style/acp_help_phpbb.html2
-rw-r--r--phpBB/adm/style/acp_profile.html1
-rw-r--r--phpBB/config/default/container/services_console.yml10
-rw-r--r--phpBB/docs/events.md35
-rw-r--r--phpBB/includes/acp/acp_extensions.php40
-rw-r--r--phpBB/includes/mcp/mcp_main.php14
-rw-r--r--phpBB/includes/ucp/ucp_pm_viewfolder.php67
-rw-r--r--phpBB/includes/ucp/ucp_remind.php30
-rw-r--r--phpBB/language/en/acp/extensions.php2
-rw-r--r--phpBB/language/en/cli.php1
-rw-r--r--phpBB/phpbb/console/command/cache/purge.php8
-rw-r--r--phpBB/phpbb/console/command/config/command.php2
-rw-r--r--phpBB/phpbb/console/command/config/delete.php9
-rw-r--r--phpBB/phpbb/console/command/config/get.php7
-rw-r--r--phpBB/phpbb/console/command/config/increment.php7
-rw-r--r--phpBB/phpbb/console/command/config/set.php7
-rw-r--r--phpBB/phpbb/console/command/config/set_atomic.php7
-rw-r--r--phpBB/phpbb/console/command/cron/cron_list.php41
-rw-r--r--phpBB/phpbb/console/command/db/list_command.php30
-rw-r--r--phpBB/phpbb/console/command/db/migrate.php13
-rw-r--r--phpBB/phpbb/console/command/db/migration_command.php2
-rw-r--r--phpBB/phpbb/console/command/db/revert.php34
-rw-r--r--phpBB/phpbb/console/command/dev/migration_tips.php2
-rw-r--r--phpBB/phpbb/console/command/extension/disable.php7
-rw-r--r--phpBB/phpbb/console/command/extension/enable.php7
-rw-r--r--phpBB/phpbb/console/command/extension/purge.php7
-rw-r--r--phpBB/phpbb/console/command/extension/show.php28
-rw-r--r--phpBB/phpbb/console/command/fixup/recalculate_email_hash.php17
-rw-r--r--phpBB/phpbb/console/command/reparser/list_all.php7
-rw-r--r--phpBB/phpbb/notification/type/report_pm.php2
-rw-r--r--phpBB/phpbb/profilefields/type/type_interface.php8
-rw-r--r--phpBB/styles/prosilver/template/ajax.js5
-rw-r--r--phpBB/styles/prosilver/template/mcp_forum.html1
-rw-r--r--phpBB/styles/prosilver/template/navbar_header.html4
-rw-r--r--phpBB/styles/prosilver/template/ucp_main_front.html2
-rw-r--r--phpBB/styles/prosilver/template/ucp_pm_viewmessage.html1
-rw-r--r--phpBB/styles/prosilver/theme/common.css4
-rw-r--r--phpBB/viewtopic.php1
-rw-r--r--tests/console/cron/cron_list_test.php6
-rw-r--r--tests/files/types_remote_test.php16
-rw-r--r--tests/functional/notification_test.php3
42 files changed, 328 insertions, 193 deletions
diff --git a/phpBB/adm/style/acp_ext_details.html b/phpBB/adm/style/acp_ext_details.html
index 830c2e3cb4..4c1feb59a9 100644
--- a/phpBB/adm/style/acp_ext_details.html
+++ b/phpBB/adm/style/acp_ext_details.html
@@ -7,19 +7,17 @@
<h1>{L_EXTENSIONS_ADMIN}</h1>
<!-- IF S_VERSIONCHECK -->
- <div class="<!-- IF S_UP_TO_DATE -->successbox<!-- ELSE -->errorbox<!-- ENDIF -->">
- <p>{UP_TO_DATE_MSG} - <a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE}</a></p>
- </div>
- <!-- ELSE IF S_VERSIONCHECK_STATUS == 0 -->
- <div class="errorbox notice">
- <p>{L_VERSIONCHECK_FAIL}</p>
- <p>{VERSIONCHECK_FAIL_REASON}</p>
- <p><a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE}</a></p>
- </div>
- <!-- ELSE IF S_VERSIONCHECK_STATUS == 1 -->
- <div class="errorbox notice">
- <p>{VERSIONCHECK_FAIL_REASON}</p>
- </div>
+ <!-- IF S_VERSIONCHECK_FAIL -->
+ <div class="errorbox notice">
+ <p>{L_VERSIONCHECK_FAIL}</p>
+ <p>{VERSIONCHECK_FAIL_REASON}</p>
+ <p><a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE}</a></p>
+ </div>
+ <!-- ELSE -->
+ <div class="<!-- IF S_UP_TO_DATE -->successbox<!-- ELSE -->errorbox<!-- ENDIF -->">
+ <p>{UP_TO_DATE_MSG} - <a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE}</a></p>
+ </div>
+ <!-- ENDIF -->
<!-- ENDIF -->
<fieldset>
diff --git a/phpBB/adm/style/acp_help_phpbb.html b/phpBB/adm/style/acp_help_phpbb.html
index 48a4595913..478ecc162a 100644
--- a/phpBB/adm/style/acp_help_phpbb.html
+++ b/phpBB/adm/style/acp_help_phpbb.html
@@ -8,7 +8,7 @@
<div class="send-stats-row">
<!-- EVENT acp_help_phpbb_stats_before -->
<div class="send-stats-tile">
- <h2><i class="icon fa-bar-chart"></i>Send statistics</h2>
+ <h2><i class="icon fa-bar-chart"></i>{L_SEND_STATISTICS}</h2>
<p>{L_EXPLAIN_SEND_STATISTICS}</p>
<div class="send-stats-row">
<div class="send-stats-data-row send-stats-data-only-row">
diff --git a/phpBB/adm/style/acp_profile.html b/phpBB/adm/style/acp_profile.html
index 07718846cc..cebd2e9632 100644
--- a/phpBB/adm/style/acp_profile.html
+++ b/phpBB/adm/style/acp_profile.html
@@ -127,6 +127,7 @@
<!-- ENDIF -->
</dl>
<!-- ENDIF -->
+ <!-- EVENT acp_profile_step_one_lang_after -->
</fieldset>
<fieldset class="quick">
diff --git a/phpBB/config/default/container/services_console.yml b/phpBB/config/default/container/services_console.yml
index 0c609a8051..e25ab4f03f 100644
--- a/phpBB/config/default/container/services_console.yml
+++ b/phpBB/config/default/container/services_console.yml
@@ -111,15 +111,7 @@ services:
console.command.db.revert:
class: phpbb\console\command\db\revert
- arguments:
- - '@user'
- - '@language'
- - '@migrator'
- - '@ext.manager'
- - '@config'
- - '@cache'
- - '@filesystem'
- - '%core.root_path%'
+ parent: console.command.db.migrate
tags:
- { name: console.command }
diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md
index 619ba06c5f..d33163ad84 100644
--- a/phpBB/docs/events.md
+++ b/phpBB/docs/events.md
@@ -381,6 +381,13 @@ acp_profile_contact_before
* Since: 3.1.6-RC1
* Purpose: Add extra options to custom profile field configuration in the ACP
+acp_profile_step_one_lang_after
+===
+* Locations:
+ + adm/style/acp_profile.html
+* Since: 3.1.11-RC1
+* Purpose: Add extra lang specific options to custom profile field step one configuration in the ACP
+
acp_prune_forums_append
===
* Locations:
@@ -796,6 +803,13 @@ mcp_forum_actions_after
* Since: 3.1.11-RC1
* Purpose: Add some information after actions fieldset
+mcp_forum_actions_append
+===
+* Locations:
+ + styles/prosilver/template/mcp_forum.html
+* Since: 3.1.11-RC1
+* Purpose: Add additional options to actions select
+
mcp_forum_actions_before
===
* Locations:
@@ -1846,6 +1860,13 @@ ucp_main_front_user_activity_after
* Since: 3.1.6-RC1
* Purpose: Add content right after the user activity info viewing UCP front page
+ucp_main_front_user_activity_append
+===
+* Locations:
+ + styles/prosilver/template/ucp_main_front.html
+* Since: 3.1.11-RC1
+* Purpose: Add content after last user activity info viewing UCP front page
+
ucp_main_front_user_activity_before
===
* Locations:
@@ -1853,6 +1874,13 @@ ucp_main_front_user_activity_before
* Since: 3.1.6-RC1
* Purpose: Add content right before the user activity info viewing UCP front page
+ucp_main_front_user_activity_prepend
+===
+* Locations:
+ + styles/prosilver/template/ucp_main_front.html
+* Since: 3.1.11-RC1
+* Purpose: Add content before first user activity info viewing UCP front page
+
ucp_pm_history_post_buttons_after
===
* Locations:
@@ -1945,6 +1973,13 @@ ucp_pm_viewmessage_custom_fields_before
* Purpose: Add data before the custom fields on the user profile when viewing
a private message
+ucp_pm_viewmessage_options_before
+===
+* Locations:
+ + styles/prosilver/template/ucp_pm_viewmessage.html
+* Since: 3.1.11-RC1
+* Purpose: Add content right before display options
+
ucp_pm_viewmessage_post_buttons_after
===
* Locations:
diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php
index e081eae975..e915fa8c75 100644
--- a/phpBB/includes/acp/acp_extensions.php
+++ b/phpBB/includes/acp/acp_extensions.php
@@ -308,29 +308,37 @@ class acp_extensions
// Output it to the template
$md_manager->output_template_data($template);
- try
+ $meta = $md_manager->get_metadata('all');
+ if (isset($meta['extra']['version-check']))
{
- $updates_available = $phpbb_extension_manager->version_check($md_manager, $request->variable('versioncheck_force', false), $this->config['extension_force_unstable'] ? 'unstable' : null);
+ try
+ {
+ $updates_available = $phpbb_extension_manager->version_check($md_manager, $request->variable('versioncheck_force', false), $this->config['extension_force_unstable'] ? 'unstable' : null);
- $template->assign_vars(array(
- 'S_UP_TO_DATE' => empty($updates_available),
- 'S_VERSIONCHECK' => true,
- 'UP_TO_DATE_MSG' => $this->user->lang(empty($updates_available) ? 'UP_TO_DATE' : 'NOT_UP_TO_DATE', $md_manager->get_metadata('display-name')),
- ));
+ $template->assign_vars(array(
+ 'S_UP_TO_DATE' => empty($updates_available),
+ 'UP_TO_DATE_MSG' => $this->user->lang(empty($updates_available) ? 'UP_TO_DATE' : 'NOT_UP_TO_DATE', $md_manager->get_metadata('display-name')),
+ ));
- foreach ($updates_available as $branch => $version_data)
+ foreach ($updates_available as $branch => $version_data)
+ {
+ $template->assign_block_vars('updates_available', $version_data);
+ }
+ }
+ catch (exception_interface $e)
{
- $template->assign_block_vars('updates_available', $version_data);
+ $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters()));
+
+ $template->assign_vars(array(
+ 'S_VERSIONCHECK_FAIL' => true,
+ 'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== 'VERSIONCHECK_FAIL') ? $message : '',
+ ));
}
+ $template->assign_var('S_VERSIONCHECK', true);
}
- catch (exception_interface $e)
+ else
{
- $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters()));
-
- $template->assign_vars(array(
- 'S_VERSIONCHECK_STATUS' => $e->getCode(),
- 'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== 'VERSIONCHECK_FAIL') ? $message : '',
- ));
+ $template->assign_var('S_VERSIONCHECK', false);
}
$template->assign_vars(array(
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php
index 3f83d99a0f..5786aa343a 100644
--- a/phpBB/includes/mcp/mcp_main.php
+++ b/phpBB/includes/mcp/mcp_main.php
@@ -470,7 +470,7 @@ function change_topic_type($action, $topic_ids)
*/
function mcp_move_topic($topic_ids)
{
- global $auth, $user, $db, $template, $phpbb_log, $request;
+ global $auth, $user, $db, $template, $phpbb_log, $request, $phpbb_dispatcher;
global $phpEx, $phpbb_root_path;
// Here we limit the operation to one forum only
@@ -632,6 +632,18 @@ function mcp_move_topic($topic_ids)
'poll_last_vote' => (int) $row['poll_last_vote']
);
+ /**
+ * Perform actions before shadow topic is created.
+ *
+ * @event core.mcp_main_modify_shadow_sql
+ * @var array shadow SQL array to be used by $db->sql_build_array
+ * @since 3.1.11-RC1
+ */
+ $vars = array(
+ 'shadow',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.mcp_main_modify_shadow_sql', compact($vars)));
+
$db->sql_query('INSERT INTO ' . TOPICS_TABLE . $db->sql_build_array('INSERT', $shadow));
// Shadow topics only count on new "topics" and not posts... a shadow topic alone has 0 posts
diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php
index af2126c83d..a06d1bd0a6 100644
--- a/phpBB/includes/ucp/ucp_pm_viewfolder.php
+++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php
@@ -394,7 +394,7 @@ function view_folder($id, $mode, $folder_id, $folder)
*/
function get_pm_from($folder_id, $folder, $user_id)
{
- global $user, $db, $template, $config, $auth, $phpbb_container, $phpbb_root_path, $phpEx, $request;
+ global $user, $db, $template, $config, $auth, $phpbb_container, $phpbb_root_path, $phpEx, $request, $phpbb_dispatcher;
$start = $request->variable('start', 0);
@@ -459,7 +459,7 @@ function get_pm_from($folder_id, $folder, $user_id)
$start = $pagination->validate_start($start, $config['topics_per_page'], $pm_count);
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $pm_count, $config['topics_per_page'], $start);
- $template->assign_vars(array(
+ $template_vars = array(
'TOTAL_MESSAGES' => $user->lang('VIEW_PM_MESSAGES', (int) $pm_count),
'POST_IMG' => (!$auth->acl_get('u_sendpm')) ? $user->img('button_topic_locked', 'POST_PM_LOCKED') : $user->img('button_pm_new', 'POST_NEW_PM'),
@@ -473,7 +473,33 @@ function get_pm_from($folder_id, $folder, $user_id)
'U_POST_NEW_TOPIC' => ($auth->acl_get('u_sendpm')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;mode=compose') : '',
'S_PM_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&amp;mode=view&amp;action=view_folder&amp;f=$folder_id" . (($start !== 0) ? "&amp;start=$start" : '')),
- ));
+ );
+
+ /**
+ * Modify template variables before they are assigned
+ *
+ * @event core.ucp_pm_view_folder_get_pm_from_template
+ * @var int folder_id Folder ID
+ * @var array folder Folder data
+ * @var int user_id User ID
+ * @var string base_url Pagination base URL
+ * @var int start Pagination start
+ * @var int pm_count Count of PMs
+ * @var array template_vars Template variables to be assigned
+ * @since 3.1.11-RC1
+ */
+ $vars = array(
+ 'folder_id',
+ 'folder',
+ 'user_id',
+ 'base_url',
+ 'start',
+ 'pm_count',
+ 'template_vars',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.ucp_pm_view_folder_get_pm_from_template', compact($vars)));
+
+ $template->assign_vars($template_vars);
// Grab all pm data
$rowset = $pm_list = array();
@@ -507,15 +533,38 @@ function get_pm_from($folder_id, $folder, $user_id)
$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction;
}
- $sql = 'SELECT t.*, p.root_level, p.message_time, p.message_subject, p.icon_id, p.to_address, p.message_attachment, p.bcc_address, u.username, u.username_clean, u.user_colour, p.message_reported
- FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . " u
- WHERE t.user_id = $user_id
+ $sql_ary = array(
+ 'SELECT' => 't.*, p.root_level, p.message_time, p.message_subject, p.icon_id, p.to_address, p.message_attachment, p.bcc_address, u.username, u.username_clean, u.user_colour, p.message_reported',
+ 'FROM' => array(
+ PRIVMSGS_TO_TABLE => 't',
+ PRIVMSGS_TABLE => 'p',
+ USERS_TABLE => 'u',
+ ),
+ 'WHERE' => "t.user_id = $user_id
AND p.author_id = u.user_id
AND $folder_sql
AND t.msg_id = p.msg_id
- $sql_limit_time
- ORDER BY $sql_sort_order";
- $result = $db->sql_query_limit($sql, $sql_limit, $sql_start);
+ $sql_limit_time",
+ 'ORDER' => $sql_sort_order,
+ );
+
+ /**
+ * Modify SQL before it is executed
+ *
+ * @event core.ucp_pm_view_folder_get_pm_from_sql
+ * @var array sql_ary SQL array
+ * @var int sql_limit SQL limit
+ * @var int sql_start SQL start
+ * @since 3.1.11-RC1
+ */
+ $vars = array(
+ 'sql_ary',
+ 'sql_limit',
+ 'sql_start',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.ucp_pm_view_folder_get_pm_from_sql', compact($vars)));
+
+ $result = $db->sql_query_limit($db->sql_build_query('SELECT', $sql_ary), $sql_limit, $sql_start);
$pm_reported = array();
while ($row = $db->sql_fetchrow($result))
diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php
index a44f077693..7040370627 100644
--- a/phpBB/includes/ucp/ucp_remind.php
+++ b/phpBB/includes/ucp/ucp_remind.php
@@ -30,7 +30,7 @@ class ucp_remind
function main($id, $mode)
{
global $config, $phpbb_root_path, $phpEx, $request;
- global $db, $user, $template, $phpbb_container;
+ global $db, $user, $template, $phpbb_container, $phpbb_dispatcher;
if (!$config['allow_password_reset'])
{
@@ -43,10 +43,30 @@ class ucp_remind
if ($submit)
{
- $sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason
- FROM ' . USERS_TABLE . "
- WHERE user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "'
- AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
+ $sql_array = array(
+ 'SELECT' => 'user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason',
+ 'FROM' => array(USERS_TABLE => 'u'),
+ 'WHERE' => "user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "'
+ AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"
+ );
+
+ /**
+ * Change SQL query for fetching user data
+ *
+ * @event core.ucp_remind_modify_select_sql
+ * @var string email User's email from the form
+ * @var string username User's username from the form
+ * @var array sql_array Fully assembled SQL query with keys SELECT, FROM, WHERE
+ * @since 3.1.11-RC1
+ */
+ $vars = array(
+ 'email',
+ 'username',
+ 'sql_array',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.ucp_remind_modify_select_sql', compact($vars)));
+
+ $sql = $db->sql_build_query('SELECT', $sql_array);
$result = $db->sql_query($sql);
$user_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
diff --git a/phpBB/language/en/acp/extensions.php b/phpBB/language/en/acp/extensions.php
index 8d6f8ece84..a96a7a2a2b 100644
--- a/phpBB/language/en/acp/extensions.php
+++ b/phpBB/language/en/acp/extensions.php
@@ -43,7 +43,7 @@ $lang = array_merge($lang, array(
'EXTENSION_NOT_AVAILABLE' => 'The selected extension is not available for this board, please verify your phpBB and PHP versions are allowed (see the details page).',
'EXTENSION_DIR_INVALID' => 'The selected extension has an invalid directory structure and cannot be enabled.',
'EXTENSION_NOT_ENABLEABLE' => 'The selected extension cannot be enabled, please verify the extension’s requirements.',
- 'EXTENSION_NOT_INSTALLED' => 'The extension %s is not available. PLease check that you have installed it correctly.',
+ 'EXTENSION_NOT_INSTALLED' => 'The extension %s is not available. Please check that you have installed it correctly.',
'DETAILS' => 'Details',
diff --git a/phpBB/language/en/cli.php b/phpBB/language/en/cli.php
index 6e86c75ec0..9940609364 100644
--- a/phpBB/language/en/cli.php
+++ b/phpBB/language/en/cli.php
@@ -68,6 +68,7 @@ $lang = array_merge($lang, array(
'CLI_DESCRIPTION_PURGE_EXTENSION' => 'Purges the specified extension.',
'CLI_DESCRIPTION_REPARSER_LIST' => 'Lists the types of text that can be reparsed.',
+ 'CLI_DESCRIPTION_REPARSER_AVAILABLE' => 'Available reparsers:',
'CLI_DESCRIPTION_REPARSER_REPARSE' => 'Reparses stored text with the current text_formatter services.',
'CLI_DESCRIPTION_REPARSER_REPARSE_ARG_1' => 'Type of text to reparse. Leave blank to reparse everything.',
'CLI_DESCRIPTION_REPARSER_REPARSE_OPT_DRY_RUN' => 'Do not save any changes; just print what would happen',
diff --git a/phpBB/phpbb/console/command/cache/purge.php b/phpBB/phpbb/console/command/cache/purge.php
index d0c2ef6f72..b7a51b2bb4 100644
--- a/phpBB/phpbb/console/command/cache/purge.php
+++ b/phpBB/phpbb/console/command/cache/purge.php
@@ -14,6 +14,7 @@ namespace phpbb\console\command\cache;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Style\SymfonyStyle;
class purge extends \phpbb\console\command\command
{
@@ -39,7 +40,7 @@ class purge extends \phpbb\console\command\command
* @param \phpbb\cache\driver\driver_interface $cache Cache instance
* @param \phpbb\db\driver\driver_interface $db Database connection
* @param \phpbb\auth\auth $auth Auth instance
- * @param \phpbb\log\log $log Logger instance
+ * @param \phpbb\log\log_interface $log Logger instance
* @param \phpbb\config\config $config Config instance
*/
public function __construct(\phpbb\user $user, \phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\log\log_interface $log, \phpbb\config\config $config)
@@ -71,7 +72,7 @@ class purge extends \phpbb\console\command\command
* @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance
*
- * @return null
+ * @return void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
@@ -84,6 +85,7 @@ class purge extends \phpbb\console\command\command
$this->log->add('admin', ANONYMOUS, '', 'LOG_PURGE_CACHE', time(), array());
- $output->writeln($this->user->lang('PURGE_CACHE_SUCCESS'));
+ $io = new SymfonyStyle($input, $output);
+ $io->success($this->user->lang('PURGE_CACHE_SUCCESS'));
}
}
diff --git a/phpBB/phpbb/console/command/config/command.php b/phpBB/phpbb/console/command/config/command.php
index f0ad5d4d19..19f67d3b6c 100644
--- a/phpBB/phpbb/console/command/config/command.php
+++ b/phpBB/phpbb/console/command/config/command.php
@@ -17,7 +17,7 @@ abstract class command extends \phpbb\console\command\command
/** @var \phpbb\config\config */
protected $config;
- function __construct(\phpbb\user $user, \phpbb\config\config $config)
+ public function __construct(\phpbb\user $user, \phpbb\config\config $config)
{
$this->config = $config;
diff --git a/phpBB/phpbb/console/command/config/delete.php b/phpBB/phpbb/console/command/config/delete.php
index efd276d7e3..2da0801337 100644
--- a/phpBB/phpbb/console/command/config/delete.php
+++ b/phpBB/phpbb/console/command/config/delete.php
@@ -15,6 +15,7 @@ namespace phpbb\console\command\config;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Style\SymfonyStyle;
class delete extends command
{
@@ -42,22 +43,24 @@ class delete extends command
* @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance
*
- * @return null
+ * @return void
* @see \phpbb\config\config::delete()
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
+ $io = new SymfonyStyle($input, $output);
+
$key = $input->getArgument('key');
if (isset($this->config[$key]))
{
$this->config->delete($key);
- $output->writeln('<info>' . $this->user->lang('CLI_CONFIG_DELETE_SUCCESS', $key) . '</info>');
+ $io->success($this->user->lang('CLI_CONFIG_DELETE_SUCCESS', $key));
}
else
{
- $output->writeln('<error>' . $this->user->lang('CLI_CONFIG_NOT_EXISTS', $key) . '</error>');
+ $io->error($this->user->lang('CLI_CONFIG_NOT_EXISTS', $key));
}
}
}
diff --git a/phpBB/phpbb/console/command/config/get.php b/phpBB/phpbb/console/command/config/get.php
index 9c03b49a3d..f065787110 100644
--- a/phpBB/phpbb/console/command/config/get.php
+++ b/phpBB/phpbb/console/command/config/get.php
@@ -16,6 +16,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Style\SymfonyStyle;
class get extends command
{
@@ -49,11 +50,13 @@ class get extends command
* @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance
*
- * @return null
+ * @return void
* @see \phpbb\config\config::offsetGet()
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
+ $io = new SymfonyStyle($input, $output);
+
$key = $input->getArgument('key');
if (isset($this->config[$key]) && $input->getOption('no-newline'))
@@ -66,7 +69,7 @@ class get extends command
}
else
{
- $output->writeln('<error>' . $this->user->lang('CLI_CONFIG_NOT_EXISTS', $key) . '</error>');
+ $io->error($this->user->lang('CLI_CONFIG_NOT_EXISTS', $key));
}
}
}
diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php
index b4d7438b66..647380a0bf 100644
--- a/phpBB/phpbb/console/command/config/increment.php
+++ b/phpBB/phpbb/console/command/config/increment.php
@@ -16,6 +16,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Style\SymfonyStyle;
class increment extends command
{
@@ -54,17 +55,19 @@ class increment extends command
* @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance
*
- * @return null
+ * @return void
* @see \phpbb\config\config::increment()
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
+ $io = new SymfonyStyle($input, $output);
+
$key = $input->getArgument('key');
$increment = $input->getArgument('increment');
$use_cache = !$input->getOption('dynamic');
$this->config->increment($key, $increment, $use_cache);
- $output->writeln('<info>' . $this->user->lang('CLI_CONFIG_INCREMENT_SUCCESS', $key) . '</info>');
+ $io->success($this->user->lang('CLI_CONFIG_INCREMENT_SUCCESS', $key));
}
}
diff --git a/phpBB/phpbb/console/command/config/set.php b/phpBB/phpbb/console/command/config/set.php
index 695de31013..e9f7f8f91e 100644
--- a/phpBB/phpbb/console/command/config/set.php
+++ b/phpBB/phpbb/console/command/config/set.php
@@ -16,6 +16,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Style\SymfonyStyle;
class set extends command
{
@@ -54,17 +55,19 @@ class set extends command
* @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance
*
- * @return null
+ * @return void
* @see \phpbb\config\config::set()
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
+ $io = new SymfonyStyle($input, $output);
+
$key = $input->getArgument('key');
$value = $input->getArgument('value');
$use_cache = !$input->getOption('dynamic');
$this->config->set($key, $value, $use_cache);
- $output->writeln('<info>' . $this->user->lang('CLI_CONFIG_SET_SUCCESS', $key) . '</info>');
+ $io->success($this->user->lang('CLI_CONFIG_SET_SUCCESS', $key));
}
}
diff --git a/phpBB/phpbb/console/command/config/set_atomic.php b/phpBB/phpbb/console/command/config/set_atomic.php
index e8c69a0885..475d8a9271 100644
--- a/phpBB/phpbb/console/command/config/set_atomic.php
+++ b/phpBB/phpbb/console/command/config/set_atomic.php
@@ -16,6 +16,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Style\SymfonyStyle;
class set_atomic extends command
{
@@ -65,6 +66,8 @@ class set_atomic extends command
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
+ $io = new SymfonyStyle($input, $output);
+
$key = $input->getArgument('key');
$old_value = $input->getArgument('old');
$new_value = $input->getArgument('new');
@@ -72,12 +75,12 @@ class set_atomic extends command
if ($this->config->set_atomic($key, $old_value, $new_value, $use_cache))
{
- $output->writeln('<info>' . $this->user->lang('CLI_CONFIG_SET_SUCCESS', $key) . '</info>');
+ $io->success($this->user->lang('CLI_CONFIG_SET_SUCCESS', $key));
return 0;
}
else
{
- $output->writeln('<error>' . $this->user->lang('CLI_CONFIG_SET_FAILURE', $key) . '</error>');
+ $io->error($this->user->lang('CLI_CONFIG_SET_FAILURE', $key));
return 1;
}
}
diff --git a/phpBB/phpbb/console/command/cron/cron_list.php b/phpBB/phpbb/console/command/cron/cron_list.php
index c515fd9e80..ea61e45235 100644
--- a/phpBB/phpbb/console/command/cron/cron_list.php
+++ b/phpBB/phpbb/console/command/cron/cron_list.php
@@ -14,6 +14,7 @@ namespace phpbb\console\command\cron;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Style\SymfonyStyle;
class cron_list extends \phpbb\console\command\command
{
@@ -51,61 +52,43 @@ class cron_list extends \phpbb\console\command\command
* @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance
*
- * @return null
+ * @return void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
+ $io = new SymfonyStyle($input, $output);
+
$tasks = $this->cron_manager->get_tasks();
if (empty($tasks))
{
- $output->writeln($this->user->lang('CRON_NO_TASKS'));
+ $io->error($this->user->lang('CRON_NO_TASKS'));
return;
}
- $ready_tasks = array();
- $not_ready_tasks = array();
+ $ready_tasks = $not_ready_tasks = array();
foreach ($tasks as $task)
{
if ($task->is_ready())
{
- $ready_tasks[] = $task;
+ $ready_tasks[] = $task->get_name();
}
else
{
- $not_ready_tasks[] = $task;
+ $not_ready_tasks[] = $task->get_name();
}
}
if (!empty($ready_tasks))
{
- $output->writeln('<info>' . $this->user->lang('TASKS_READY') . '</info>');
- $this->print_tasks_names($ready_tasks, $output);
- }
-
- if (!empty($ready_tasks) && !empty($not_ready_tasks))
- {
- $output->writeln('');
+ $io->title($this->user->lang('TASKS_READY'));
+ $io->listing($ready_tasks);
}
if (!empty($not_ready_tasks))
{
- $output->writeln('<info>' . $this->user->lang('TASKS_NOT_READY') . '</info>');
- $this->print_tasks_names($not_ready_tasks, $output);
- }
- }
-
- /**
- * Print a list of cron jobs
- *
- * @param array $tasks A list of task to display
- * @param OutputInterface $output An OutputInterface instance
- */
- protected function print_tasks_names(array $tasks, OutputInterface $output)
- {
- foreach ($tasks as $task)
- {
- $output->writeln($task->get_name());
+ $io->title($this->user->lang('TASKS_NOT_READY'));
+ $io->listing($not_ready_tasks);
}
}
}
diff --git a/phpBB/phpbb/console/command/db/list_command.php b/phpBB/phpbb/console/command/db/list_command.php
index 708107b592..77f26dd786 100644
--- a/phpBB/phpbb/console/command/db/list_command.php
+++ b/phpBB/phpbb/console/command/db/list_command.php
@@ -15,6 +15,7 @@ namespace phpbb\console\command\db;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Style\SymfonyStyle;
class list_command extends \phpbb\console\command\db\migration_command
{
@@ -34,6 +35,8 @@ class list_command extends \phpbb\console\command\db\migration_command
protected function execute(InputInterface $input, OutputInterface $output)
{
+ $io = new SymfonyStyle($input, $output);
+
$show_installed = !$input->getOption('available');
$installed = $available = array();
@@ -51,23 +54,28 @@ class list_command extends \phpbb\console\command\db\migration_command
if ($show_installed)
{
- $output->writeln('<info>' . $this->user->lang('CLI_MIGRATIONS_INSTALLED') . $this->user->lang('COLON') . '</info>');
- $output->writeln($installed);
+ $io->section($this->user->lang('CLI_MIGRATIONS_INSTALLED'));
- if (empty($installed))
+ if (!empty($installed))
{
- $output->writeln($this->user->lang('CLI_MIGRATIONS_EMPTY'));
+ $io->listing($installed);
+ }
+ else
+ {
+ $io->text($this->user->lang('CLI_MIGRATIONS_EMPTY'));
+ $io->newLine();
}
-
- $output->writeln('');
}
- $output->writeln('<info>' . $this->user->lang('CLI_MIGRATIONS_AVAILABLE') . $this->user->lang('COLON') . '</info>');
- $output->writeln($available);
-
- if (empty($available))
+ $io->section($this->user->lang('CLI_MIGRATIONS_AVAILABLE'));
+ if (!empty($available))
+ {
+ $io->listing($available);
+ }
+ else
{
- $output->writeln($this->user->lang('CLI_MIGRATIONS_EMPTY'));
+ $io->text($this->user->lang('CLI_MIGRATIONS_EMPTY'));
+ $io->newLine();
}
}
}
diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php
index ae4211f7be..4270e2d703 100644
--- a/phpBB/phpbb/console/command/db/migrate.php
+++ b/phpBB/phpbb/console/command/db/migrate.php
@@ -15,6 +15,7 @@ namespace phpbb\console\command\db;
use phpbb\db\output_handler\log_wrapper_migrator_output_handler;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Style\SymfonyStyle;
class migrate extends \phpbb\console\command\db\migration_command
{
@@ -30,26 +31,28 @@ class migrate extends \phpbb\console\command\db\migration_command
/** @var \phpbb\language\language */
protected $language;
- function __construct(\phpbb\user $user, \phpbb\language\language $language, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\log\log $log, \phpbb\filesystem\filesystem_interface $filesystem, $phpbb_root_path)
+ public function __construct(\phpbb\user $user, \phpbb\language\language $language, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\log\log $log, \phpbb\filesystem\filesystem_interface $filesystem, $phpbb_root_path)
{
$this->language = $language;
$this->log = $log;
$this->filesystem = $filesystem;
$this->phpbb_root_path = $phpbb_root_path;
parent::__construct($user, $migrator, $extension_manager, $config, $cache);
- $this->user->add_lang(array('common', 'install', 'migrator'));
+ $this->language->add_lang(array('common', 'install', 'migrator'));
}
protected function configure()
{
$this
->setName('db:migrate')
- ->setDescription($this->user->lang('CLI_DESCRIPTION_DB_MIGRATE'))
+ ->setDescription($this->language->lang('CLI_DESCRIPTION_DB_MIGRATE'))
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
+ $io = new SymfonyStyle($input, $output);
+
$this->migrator->set_output_handler(new log_wrapper_migrator_output_handler($this->language, new console_migrator_output_handler($this->user, $output), $this->phpbb_root_path . 'store/migrations_' . time() . '.log', $this->filesystem));
$this->migrator->create_migrations_table();
@@ -66,7 +69,7 @@ class migrate extends \phpbb\console\command\db\migration_command
}
catch (\phpbb\db\migration\exception $e)
{
- $output->writeln('<error>' . $e->getLocalisedMessage($this->user) . '</error>');
+ $io->error($e->getLocalisedMessage($this->user));
$this->finalise_update();
return 1;
}
@@ -78,6 +81,6 @@ class migrate extends \phpbb\console\command\db\migration_command
}
$this->finalise_update();
- $output->writeln($this->user->lang['DATABASE_UPDATE_COMPLETE']);
+ $io->success($this->language->lang('INLINE_UPDATE_SUCCESSFUL'));
}
}
diff --git a/phpBB/phpbb/console/command/db/migration_command.php b/phpBB/phpbb/console/command/db/migration_command.php
index b951560588..851f404fab 100644
--- a/phpBB/phpbb/console/command/db/migration_command.php
+++ b/phpBB/phpbb/console/command/db/migration_command.php
@@ -26,7 +26,7 @@ abstract class migration_command extends \phpbb\console\command\command
/** @var \phpbb\cache\service */
protected $cache;
- function __construct(\phpbb\user $user, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache)
+ public function __construct(\phpbb\user $user, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache)
{
$this->migrator = $migrator;
$this->extension_manager = $extension_manager;
diff --git a/phpBB/phpbb/console/command/db/revert.php b/phpBB/phpbb/console/command/db/revert.php
index 3fa2e17515..3c79d8c554 100644
--- a/phpBB/phpbb/console/command/db/revert.php
+++ b/phpBB/phpbb/console/command/db/revert.php
@@ -16,42 +16,27 @@ use phpbb\db\output_handler\log_wrapper_migrator_output_handler;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Style\SymfonyStyle;
-class revert extends \phpbb\console\command\db\migration_command
+class revert extends \phpbb\console\command\db\migrate
{
- /** @var string phpBB root path */
- protected $phpbb_root_path;
-
- /** @var \phpbb\filesystem\filesystem_interface */
- protected $filesystem;
-
- /** @var \phpbb\language\language */
- protected $language;
-
- function __construct(\phpbb\user $user, \phpbb\language\language $language, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\filesystem\filesystem_interface $filesystem, $phpbb_root_path)
- {
- $this->filesystem = $filesystem;
- $this->language = $language;
- $this->phpbb_root_path = $phpbb_root_path;
- parent::__construct($user, $migrator, $extension_manager, $config, $cache);
- $this->user->add_lang(array('common', 'migrator'));
- }
-
protected function configure()
{
$this
->setName('db:revert')
- ->setDescription($this->user->lang('CLI_DESCRIPTION_DB_REVERT'))
+ ->setDescription($this->language->lang('CLI_DESCRIPTION_DB_REVERT'))
->addArgument(
'name',
InputArgument::REQUIRED,
- $this->user->lang('CLI_MIGRATION_NAME')
+ $this->language->lang('CLI_MIGRATION_NAME')
)
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
+ $io = new SymfonyStyle($input, $output);
+
$name = str_replace('/', '\\', $input->getArgument('name'));
$this->migrator->set_output_handler(new log_wrapper_migrator_output_handler($this->language, new console_migrator_output_handler($this->user, $output), $this->phpbb_root_path . 'store/migrations_' . time() . '.log', $this->filesystem));
@@ -60,12 +45,12 @@ class revert extends \phpbb\console\command\db\migration_command
if (!in_array($name, $this->load_migrations()))
{
- $output->writeln('<error>' . $this->user->lang('MIGRATION_NOT_VALID', $name) . '</error>');
+ $io->error($this->language->lang('MIGRATION_NOT_VALID', $name));
return 1;
}
else if ($this->migrator->migration_state($name) === false)
{
- $output->writeln('<error>' . $this->user->lang('MIGRATION_NOT_INSTALLED', $name) . '</error>');
+ $io->error($this->language->lang('MIGRATION_NOT_INSTALLED', $name));
return 1;
}
@@ -78,11 +63,12 @@ class revert extends \phpbb\console\command\db\migration_command
}
catch (\phpbb\db\migration\exception $e)
{
- $output->writeln('<error>' . $e->getLocalisedMessage($this->user) . '</error>');
+ $io->error($e->getLocalisedMessage($this->user));
$this->finalise_update();
return 1;
}
$this->finalise_update();
+ $io->success($this->language->lang('INLINE_UPDATE_SUCCESSFUL'));
}
}
diff --git a/phpBB/phpbb/console/command/dev/migration_tips.php b/phpBB/phpbb/console/command/dev/migration_tips.php
index f9047bdac8..2ca0ddde2f 100644
--- a/phpBB/phpbb/console/command/dev/migration_tips.php
+++ b/phpBB/phpbb/console/command/dev/migration_tips.php
@@ -20,7 +20,7 @@ class migration_tips extends \phpbb\console\command\command
/** @var \phpbb\extension\manager */
protected $extension_manager;
- function __construct(\phpbb\user $user, \phpbb\extension\manager $extension_manager)
+ public function __construct(\phpbb\user $user, \phpbb\extension\manager $extension_manager)
{
$this->extension_manager = $extension_manager;
parent::__construct($user);
diff --git a/phpBB/phpbb/console/command/extension/disable.php b/phpBB/phpbb/console/command/extension/disable.php
index 1eee16cbd9..d022755753 100644
--- a/phpBB/phpbb/console/command/extension/disable.php
+++ b/phpBB/phpbb/console/command/extension/disable.php
@@ -15,6 +15,7 @@ namespace phpbb\console\command\extension;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Style\SymfonyStyle;
class disable extends command
{
@@ -33,19 +34,21 @@ class disable extends command
protected function execute(InputInterface $input, OutputInterface $output)
{
+ $io = new SymfonyStyle($input, $output);
+
$name = $input->getArgument('extension-name');
$this->manager->disable($name);
$this->manager->load_extensions();
if ($this->manager->is_enabled($name))
{
- $output->writeln('<error>' . $this->user->lang('CLI_EXTENSION_DISABLE_FAILURE', $name) . '</error>');
+ $io->error($this->user->lang('CLI_EXTENSION_DISABLE_FAILURE', $name));
return 1;
}
else
{
$this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_DISABLE', time(), array($name));
- $output->writeln('<info>' . $this->user->lang('CLI_EXTENSION_DISABLE_SUCCESS', $name) . '</info>');
+ $io->success($this->user->lang('CLI_EXTENSION_DISABLE_SUCCESS', $name));
return 0;
}
}
diff --git a/phpBB/phpbb/console/command/extension/enable.php b/phpBB/phpbb/console/command/extension/enable.php
index 59ff11e9b7..14077d688b 100644
--- a/phpBB/phpbb/console/command/extension/enable.php
+++ b/phpBB/phpbb/console/command/extension/enable.php
@@ -15,6 +15,7 @@ namespace phpbb\console\command\extension;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Style\SymfonyStyle;
class enable extends command
{
@@ -33,6 +34,8 @@ class enable extends command
protected function execute(InputInterface $input, OutputInterface $output)
{
+ $io = new SymfonyStyle($input, $output);
+
$name = $input->getArgument('extension-name');
$this->manager->enable($name);
$this->manager->load_extensions();
@@ -40,12 +43,12 @@ class enable extends command
if ($this->manager->is_enabled($name))
{
$this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_ENABLE', time(), array($name));
- $output->writeln('<info>' . $this->user->lang('CLI_EXTENSION_ENABLE_SUCCESS', $name) . '</info>');
+ $io->success($this->user->lang('CLI_EXTENSION_ENABLE_SUCCESS', $name));
return 0;
}
else
{
- $output->writeln('<error>' . $this->user->lang('CLI_EXTENSION_ENABLE_FAILURE', $name) . '</error>');
+ $io->error($this->user->lang('CLI_EXTENSION_ENABLE_FAILURE', $name));
return 1;
}
}
diff --git a/phpBB/phpbb/console/command/extension/purge.php b/phpBB/phpbb/console/command/extension/purge.php
index 517e9a74c9..25bde503f7 100644
--- a/phpBB/phpbb/console/command/extension/purge.php
+++ b/phpBB/phpbb/console/command/extension/purge.php
@@ -15,6 +15,7 @@ namespace phpbb\console\command\extension;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Style\SymfonyStyle;
class purge extends command
{
@@ -33,19 +34,21 @@ class purge extends command
protected function execute(InputInterface $input, OutputInterface $output)
{
+ $io = new SymfonyStyle($input, $output);
+
$name = $input->getArgument('extension-name');
$this->manager->purge($name);
$this->manager->load_extensions();
if ($this->manager->is_enabled($name))
{
- $output->writeln('<error>' . $this->user->lang('CLI_EXTENSION_PURGE_FAILURE', $name) . '</error>');
+ $io->error($this->user->lang('CLI_EXTENSION_PURGE_FAILURE', $name));
return 1;
}
else
{
$this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_PURGE', time(), array($name));
- $output->writeln('<info>' . $this->user->lang('CLI_EXTENSION_PURGE_SUCCESS', $name) . '</info>');
+ $io->success($this->user->lang('CLI_EXTENSION_PURGE_SUCCESS', $name));
return 0;
}
}
diff --git a/phpBB/phpbb/console/command/extension/show.php b/phpBB/phpbb/console/command/extension/show.php
index f9322034d7..7bad0c0a5a 100644
--- a/phpBB/phpbb/console/command/extension/show.php
+++ b/phpBB/phpbb/console/command/extension/show.php
@@ -14,6 +14,7 @@ namespace phpbb\console\command\extension;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Style\SymfonyStyle;
class show extends command
{
@@ -27,36 +28,27 @@ class show extends command
protected function execute(InputInterface $input, OutputInterface $output)
{
+ $io = new SymfonyStyle($input, $output);
+
$this->manager->load_extensions();
$all = array_keys($this->manager->all_available());
if (empty($all))
{
- $output->writeln('<comment>' . $this->user->lang('CLI_EXTENSION_NOT_FOUND') . '</comment>');
+ $io->note($this->user->lang('CLI_EXTENSION_NOT_FOUND'));
return 3;
}
$enabled = array_keys($this->manager->all_enabled());
- $this->print_extension_list($output, $this->user->lang('CLI_EXTENSIONS_ENABLED') . $this->user->lang('COLON'), $enabled);
-
- $output->writeln('');
+ $io->section($this->user->lang('CLI_EXTENSIONS_ENABLED'));
+ $io->listing($enabled);
$disabled = array_keys($this->manager->all_disabled());
- $this->print_extension_list($output, $this->user->lang('CLI_EXTENSIONS_DISABLED') . $this->user->lang('COLON'), $disabled);
-
- $output->writeln('');
+ $io->section($this->user->lang('CLI_EXTENSIONS_DISABLED'));
+ $io->listing($disabled);
$purged = array_diff($all, $enabled, $disabled);
- $this->print_extension_list($output, $this->user->lang('CLI_EXTENSIONS_AVAILABLE') . $this->user->lang('COLON'), $purged);
- }
-
- protected function print_extension_list(OutputInterface $output, $type, array $extensions)
- {
- $output->writeln("<info>$type</info>");
-
- foreach ($extensions as $extension)
- {
- $output->writeln(" - $extension");
- }
+ $io->section($this->user->lang('CLI_EXTENSIONS_AVAILABLE'));
+ $io->listing($purged);
}
}
diff --git a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php
index ec4e1b0ee7..6f7096296d 100644
--- a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php
+++ b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php
@@ -14,13 +14,14 @@ namespace phpbb\console\command\fixup;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Style\SymfonyStyle;
class recalculate_email_hash extends \phpbb\console\command\command
{
/** @var \phpbb\db\driver\driver_interface */
protected $db;
- function __construct(\phpbb\user $user, \phpbb\db\driver\driver_interface $db)
+ public function __construct(\phpbb\user $user, \phpbb\db\driver\driver_interface $db)
{
$this->db = $db;
@@ -37,6 +38,8 @@ class recalculate_email_hash extends \phpbb\console\command\command
protected function execute(InputInterface $input, OutputInterface $output)
{
+ $io = new SymfonyStyle($input, $output);
+
$sql = 'SELECT user_id, user_email, user_email_hash
FROM ' . USERS_TABLE . '
WHERE user_type <> ' . USER_IGNORE . "
@@ -59,17 +62,15 @@ class recalculate_email_hash extends \phpbb\console\command\command
if ($output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG)
{
- $output->writeln(sprintf(
- 'user_id %d, email %s => %s',
- $row['user_id'],
- $row['user_email'],
- $user_email_hash
- ));
+ $io->table(
+ array('user_id', 'user_email', 'user_email_hash'),
+ array(array($row['user_id'], $row['user_email'], $user_email_hash))
+ );
}
}
}
$this->db->sql_freeresult($result);
- $output->writeln('<info>' . $this->user->lang('CLI_FIXUP_RECALCULATE_EMAIL_HASH_SUCCESS') . '</info>');
+ $io->success($this->user->lang('CLI_FIXUP_RECALCULATE_EMAIL_HASH_SUCCESS'));
}
}
diff --git a/phpBB/phpbb/console/command/reparser/list_all.php b/phpBB/phpbb/console/command/reparser/list_all.php
index e42c3ac782..028468649d 100644
--- a/phpBB/phpbb/console/command/reparser/list_all.php
+++ b/phpBB/phpbb/console/command/reparser/list_all.php
@@ -15,6 +15,7 @@ namespace phpbb\console\command\reparser;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Style\SymfonyStyle;
class list_all extends \phpbb\console\command\command
{
@@ -54,7 +55,7 @@ class list_all extends \phpbb\console\command\command
}
/**
- * Executes the command reparser:reparse
+ * Executes the command reparser:list
*
* @param InputInterface $input
* @param OutputInterface $output
@@ -62,7 +63,9 @@ class list_all extends \phpbb\console\command\command
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
- $output->writeln('<info>' . implode(', ', $this->reparser_names) . '</info>');
+ $io = new SymfonyStyle($input, $output);
+ $io->section($this->user->lang('CLI_DESCRIPTION_REPARSER_AVAILABLE'));
+ $io->listing($this->reparser_names);
return 0;
}
diff --git a/phpBB/phpbb/notification/type/report_pm.php b/phpBB/phpbb/notification/type/report_pm.php
index 239805204c..7e53ffb3ca 100644
--- a/phpBB/phpbb/notification/type/report_pm.php
+++ b/phpBB/phpbb/notification/type/report_pm.php
@@ -142,7 +142,7 @@ class report_pm extends \phpbb\notification\type\pm
*/
public function get_email_template_variables()
{
- $user_data = $this->user_loader->get_username($this->get_data('reporter_id'), 'no_profile');
+ $user_data = $this->user_loader->get_user($this->get_data('reporter_id'));
return array(
'AUTHOR_NAME' => htmlspecialchars_decode($user_data['username']),
diff --git a/phpBB/phpbb/profilefields/type/type_interface.php b/phpBB/phpbb/profilefields/type/type_interface.php
index ec770f9467..93b9e4b893 100644
--- a/phpBB/phpbb/profilefields/type/type_interface.php
+++ b/phpBB/phpbb/profilefields/type/type_interface.php
@@ -134,6 +134,14 @@ interface type_interface
public function get_field_ident($field_data);
/**
+ * Get the localized name of the field
+ *
+ * @param string $field_name Unlocalized name of this field
+ * @return string Localized name of the field
+ */
+ public function get_field_name($field_name);
+
+ /**
* Get the column type for the database
*
* @return string Returns the database column type
diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js
index 3888d26785..1bb3aabb9b 100644
--- a/phpBB/styles/prosilver/template/ajax.js
+++ b/phpBB/styles/prosilver/template/ajax.js
@@ -132,9 +132,10 @@ phpbb.markNotifications = function($popup, unreadCount) {
// Update the unread count.
$('strong', '#notification_list_button').html(unreadCount);
- // Remove the Mark all read link & notification count if there are no unread notifications.
+ // Remove the Mark all read link and hide notification count if there are no unread notifications.
if (!unreadCount) {
- $('#mark_all_notifications, #notification_list_button > strong').remove();
+ $('#mark_all_notifications').remove();
+ $('#notification_list_button > strong').addClass('hidden');
}
// Update page title
diff --git a/phpBB/styles/prosilver/template/mcp_forum.html b/phpBB/styles/prosilver/template/mcp_forum.html
index b4ef9e66af..f6c518e1df 100644
--- a/phpBB/styles/prosilver/template/mcp_forum.html
+++ b/phpBB/styles/prosilver/template/mcp_forum.html
@@ -140,6 +140,7 @@
<!-- IF S_CAN_MAKE_STICKY --><option value="make_sticky">{L_MAKE_STICKY}</option><!-- ENDIF -->
<!-- IF S_CAN_MAKE_ANNOUNCE --><option value="make_announce">{L_MAKE_ANNOUNCE}</option><!-- ENDIF -->
<!-- IF S_CAN_MAKE_ANNOUNCE_GLOBAL --><option value="make_global">{L_MAKE_GLOBAL}</option><!-- ENDIF -->
+ <!-- EVENT mcp_forum_actions_append -->
</select>
<input class="button2" type="submit" value="{L_SUBMIT}" />
<div><a href="#" onclick="marklist('mcp', 'topic_id_list', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('mcp', 'topic_id_list', false); return false;">{L_UNMARK_ALL}</a></div>
diff --git a/phpBB/styles/prosilver/template/navbar_header.html b/phpBB/styles/prosilver/template/navbar_header.html
index c300b9acda..b8080a6be3 100644
--- a/phpBB/styles/prosilver/template/navbar_header.html
+++ b/phpBB/styles/prosilver/template/navbar_header.html
@@ -145,14 +145,14 @@
<!-- IF S_DISPLAY_PM -->
<li class="rightside" data-skip-responsive="true">
<a href="{U_PRIVATEMSGS}" role="menuitem">
- <i class="icon fa-inbox fa-fw" aria-hidden="true"></i><span>{L_PRIVATE_MESSAGES} <!-- IF PRIVATE_MESSAGE_COUNT --><strong class="badge">{PRIVATE_MESSAGE_COUNT}</strong><!-- ENDIF --></span>
+ <i class="icon fa-inbox fa-fw" aria-hidden="true"></i><span>{L_PRIVATE_MESSAGES} </span><strong class="badge<!-- IF not PRIVATE_MESSAGE_COUNT --> hidden<!-- ENDIF -->">{PRIVATE_MESSAGE_COUNT}</strong>
</a>
</li>
<!-- ENDIF -->
<!-- IF S_NOTIFICATIONS_DISPLAY -->
<li class="dropdown-container dropdown-{S_CONTENT_FLOW_END} rightside" data-skip-responsive="true">
<a href="{U_VIEW_ALL_NOTIFICATIONS}" id="notification_list_button" class="dropdown-trigger">
- <i class="icon fa-bell fa-fw" aria-hidden="true"></i><span>{L_NOTIFICATIONS} <!-- IF NOTIFICATIONS_COUNT --><strong class="badge">{NOTIFICATIONS_COUNT}</strong><!-- ENDIF --></span>
+ <i class="icon fa-bell fa-fw" aria-hidden="true"></i><span>{L_NOTIFICATIONS} </span><strong class="badge<!-- IF not NOTIFICATIONS_COUNT --> hidden<!-- ENDIF -->">{NOTIFICATIONS_COUNT}</strong>
</a>
<!-- INCLUDE notification_dropdown.html -->
</li>
diff --git a/phpBB/styles/prosilver/template/ucp_main_front.html b/phpBB/styles/prosilver/template/ucp_main_front.html
index a3100524ce..04b568f623 100644
--- a/phpBB/styles/prosilver/template/ucp_main_front.html
+++ b/phpBB/styles/prosilver/template/ucp_main_front.html
@@ -65,12 +65,14 @@
<!-- EVENT ucp_main_front_user_activity_before -->
<dl class="details">
+ <!-- EVENT ucp_main_front_user_activity_prepend -->
<dt>{L_JOINED}{L_COLON}</dt> <dd>{JOINED}</dd>
<dt>{L_LAST_ACTIVE}{L_COLON}</dt> <dd>{LAST_VISIT_YOU}</dd>
<dt>{L_TOTAL_POSTS}{L_COLON}</dt> <dd><!-- IF POSTS_PCT -->{POSTS}<!-- IF S_DISPLAY_SEARCH --> | <strong><a href="{U_SEARCH_USER}">{L_SEARCH_YOUR_POSTS}</a></strong><!-- ENDIF --><br />({POSTS_DAY} / {POSTS_PCT})<!-- ELSE -->{POSTS}<!-- ENDIF --></dd>
<!-- IF ACTIVE_FORUM != '' --><dt>{L_ACTIVE_IN_FORUM}{L_COLON}</dt> <dd><strong><a href="{U_ACTIVE_FORUM}">{ACTIVE_FORUM}</a></strong><br />({ACTIVE_FORUM_POSTS} / {ACTIVE_FORUM_PCT})</dd><!-- ENDIF -->
<!-- IF ACTIVE_TOPIC != '' --><dt>{L_ACTIVE_IN_TOPIC}{L_COLON}</dt> <dd><strong><a href="{U_ACTIVE_TOPIC}">{ACTIVE_TOPIC}</a></strong><br />({ACTIVE_TOPIC_POSTS} / {ACTIVE_TOPIC_PCT})</dd><!-- ENDIF -->
<!-- IF WARNINGS --><dt>{L_YOUR_WARNINGS}{L_COLON}</dt> <dd class="error"><i class="icon fa-exclamation-triangle fa-fw icon-red" aria-hidden="true"></i> [{WARNINGS}]</dd><!-- ENDIF -->
+ <!-- EVENT ucp_main_front_user_activity_append -->
</dl>
<!-- EVENT ucp_main_front_user_activity_after -->
diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html
index 59317da8f7..e2a086060c 100644
--- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html
+++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html
@@ -167,6 +167,7 @@
</div>
</div>
+<!-- EVENT ucp_pm_viewmessage_options_before -->
<!-- IF S_VIEW_MESSAGE -->
<fieldset class="display-options">
diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css
index 5cf204a7a6..9da5cfe3be 100644
--- a/phpBB/styles/prosilver/theme/common.css
+++ b/phpBB/styles/prosilver/theme/common.css
@@ -1224,6 +1224,10 @@ ul.linklist:after,
padding: 4px 6px;
}
+.badge.hidden {
+ display: none;
+}
+
/* Navbar specific list items
----------------------------------------*/
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 9199354920..01c5f9ed42 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -1319,7 +1319,6 @@ while ($row = $db->sql_fetchrow($result))
'rank_title' => '',
'rank_image' => '',
'rank_image_src' => '',
- 'sig' => '',
'pm' => '',
'email' => '',
'jabber' => '',
diff --git a/tests/console/cron/cron_list_test.php b/tests/console/cron/cron_list_test.php
index 3bbe2078ba..fdc9a05cb2 100644
--- a/tests/console/cron/cron_list_test.php
+++ b/tests/console/cron/cron_list_test.php
@@ -50,19 +50,19 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case
public function test_only_ready()
{
$this->initiate_test(2, 0);
- $this->assertContains('TASKS_READY command1 command2', preg_replace('/\s+/', ' ', trim($this->command_tester->getDisplay())));
+ $this->assertContains('TASKS_READY command1 command2', preg_replace('/[\s*=]+/', ' ', trim($this->command_tester->getDisplay())));
}
public function test_only_not_ready()
{
$this->initiate_test(0, 2);
- $this->assertContains('TASKS_NOT_READY command1 command2', preg_replace('/\s+/', ' ', trim($this->command_tester->getDisplay())));
+ $this->assertContains('TASKS_NOT_READY command1 command2', preg_replace('/[\s*=]+/', ' ', trim($this->command_tester->getDisplay())));
}
public function test_both_ready()
{
$this->initiate_test(2, 2);
- $this->assertSame('TASKS_READY command1 command2 TASKS_NOT_READY command3 command4', preg_replace('/\s+/', ' ', trim($this->command_tester->getDisplay())));
+ $this->assertSame('TASKS_READY command1 command2 TASKS_NOT_READY command3 command4', preg_replace('/[\s*=]+/', ' ', trim($this->command_tester->getDisplay())));
}
public function get_cron_manager(array $tasks)
diff --git a/tests/files/types_remote_test.php b/tests/files/types_remote_test.php
index d103771c04..1a7d63d790 100644
--- a/tests/files/types_remote_test.php
+++ b/tests/files/types_remote_test.php
@@ -84,16 +84,16 @@ class phpbb_files_types_remote_test extends phpbb_test_case
public function data_get_max_file_size()
{
return array(
- array('', 'http://example.com/foo/bar.png'),
- array('2k', 'http://example.com/foo/bar.png'),
- array('500k', 'http://example.com/foo/bar.png'),
- array('500M', 'http://example.com/foo/bar.png'),
- array('500m', 'http://example.com/foo/bar.png'),
+ array('', 'http://phpbb.com/foo/bar.png'),
+ array('2k', 'http://phpbb.com/foo/bar.png'),
+ array('500k', 'http://phpbb.com/foo/bar.png'),
+ array('500M', 'http://phpbb.com/foo/bar.png'),
+ array('500m', 'http://phpbb.com/foo/bar.png'),
array('500k', 'http://google.com/?.png', array('DISALLOWED_EXTENSION', 'DISALLOWED_CONTENT')),
array('1', 'http://google.com/?.png', array('WRONG_FILESIZE')),
- array('500g', 'http://example.com/foo/bar.png'),
- array('foobar', 'http://example.com/foo/bar.png'),
- array('-5k', 'http://example.com/foo/bar.png'),
+ array('500g', 'http://phpbb.com/foo/bar.png'),
+ array('foobar', 'http://phpbb.com/foo/bar.png'),
+ array('-5k', 'http://phpbb.com/foo/bar.png'),
);
}
diff --git a/tests/functional/notification_test.php b/tests/functional/notification_test.php
index 8751de8016..91fc962846 100644
--- a/tests/functional/notification_test.php
+++ b/tests/functional/notification_test.php
@@ -82,6 +82,7 @@ class phpbb_functional_notification_test extends phpbb_functional_test_case
// Get form token
$link = $crawler->selectLink($this->lang('NOTIFICATIONS_MARK_ALL_READ'))->link()->getUri();
$crawler = self::request('GET', substr($link, strpos($link, 'ucp.')));
- $this->assertCount(0, $crawler->filter('#notification_list_button strong'));
+ $this->assertCount(1, $crawler->filter('#notification_list_button strong.badge.hidden'));
+ $this->assertEquals("0", $crawler->filter('#notification_list_button strong.badge.hidden')->text());
}
}