Merge pull request #6225 from rubencm/ticket/16790

[ticket/16790] Remove unused code
This commit is contained in:
Marc Alexander 2022-12-09 21:17:23 +01:00 committed by GitHub
commit 8841d88845
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 93 additions and 278 deletions

View file

@ -273,15 +273,13 @@ class acp_attachments
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$defined_ips = ''; $defined_ips = '';
$ips = array();
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
$value = ($row['site_ip']) ? $row['site_ip'] : $row['site_hostname']; $value = $row['site_ip'] ?: $row['site_hostname'];
if ($value) if ($value)
{ {
$defined_ips .= '<option' . (($row['ip_exclude']) ? ' class="sep"' : '') . ' value="' . $row['site_id'] . '">' . $value . '</option>'; $defined_ips .= '<option' . (($row['ip_exclude']) ? ' class="sep"' : '') . ' value="' . $row['site_id'] . '">' . $value . '</option>';
$ips[$row['site_id']] = $value;
} }
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
@ -354,7 +352,6 @@ class acp_attachments
break; break;
case 'extensions': case 'extensions':
if ($submit || isset($_POST['add_extension_check'])) if ($submit || isset($_POST['add_extension_check']))
{ {
if ($submit) if ($submit)
@ -422,8 +419,6 @@ class acp_attachments
$add = (isset($_POST['add_extension_check'])) ? true : false; $add = (isset($_POST['add_extension_check'])) ? true : false;
if ($add_extension && $add) if ($add_extension && $add)
{
if (!count($error))
{ {
$sql = 'SELECT extension_id $sql = 'SELECT extension_id
FROM ' . EXTENSIONS_TABLE . " FROM ' . EXTENSIONS_TABLE . "
@ -448,7 +443,6 @@ class acp_attachments
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_EXT_ADD', false, array($add_extension)); $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_EXT_ADD', false, array($add_extension));
} }
} }
}
if (!count($error)) if (!count($error))
{ {
@ -750,7 +744,7 @@ class acp_attachments
$imglist = array_values($imglist); $imglist = array_values($imglist);
$imglist = $imglist[0]; $imglist = $imglist[0];
foreach ($imglist as $key => $img) foreach ($imglist as $img)
{ {
if (!$ext_group_row['upload_icon']) if (!$ext_group_row['upload_icon'])
{ {
@ -773,7 +767,7 @@ class acp_attachments
$i = 0; $i = 0;
$assigned_extensions = ''; $assigned_extensions = '';
foreach ($extensions as $num => $row) foreach ($extensions as $row)
{ {
if ($row['group_id'] == $group_id && $group_id) if ($row['group_id'] == $group_id && $group_id)
{ {
@ -822,8 +816,8 @@ class acp_attachments
ORDER BY left_id ASC'; ORDER BY left_id ASC';
$result = $db->sql_query($sql, 600); $result = $db->sql_query($sql, 600);
$right = $cat_right = $padding_inc = 0; $right = $cat_right = 0;
$padding = $forum_list = $holding = ''; $padding = $holding = '';
$padding_store = array('0' => ''); $padding_store = array('0' => '');
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
@ -1150,6 +1144,8 @@ class acp_attachments
WHERE ' . $db->sql_in_set('attach_id', $delete_files) . ' WHERE ' . $db->sql_in_set('attach_id', $delete_files) . '
AND is_orphan = 0'; AND is_orphan = 0';
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$deleted_filenames = [];
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
$deleted_filenames[] = $row['real_filename']; $deleted_filenames[] = $row['real_filename'];

View file

@ -216,15 +216,6 @@ class acp_bbcodes
} }
} }
if (substr($data['bbcode_tag'], -1) === '=')
{
$test = substr($data['bbcode_tag'], 0, -1);
}
else
{
$test = $data['bbcode_tag'];
}
if (strlen($data['bbcode_tag']) > 16) if (strlen($data['bbcode_tag']) > 16)
{ {
trigger_error($user->lang['BBCODE_TAG_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); trigger_error($user->lang['BBCODE_TAG_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING);

View file

@ -1224,7 +1224,7 @@ class acp_forums
if ($action_subforums == 'delete') if ($action_subforums == 'delete')
{ {
$rows = get_forum_branch($row['forum_id'], 'children', 'descending', false); $rows = get_forum_branch($row['forum_id'], 'children', 'descending', false);
$forum_ids = [];
foreach ($rows as $_row) foreach ($rows as $_row)
{ {
// Do not remove the forum id we are about to change. ;) // Do not remove the forum id we are about to change. ;)
@ -2183,29 +2183,4 @@ class acp_forums
adm_page_footer(); adm_page_footer();
} }
/**
* Display copy permission page
* Not used at the moment - we will have a look at it for 3.0.7
*/
function copy_permission_page($forum_data)
{
global $phpEx, $phpbb_admin_path, $template, $user;
$acl_url = '&amp;mode=setting_forum_local&amp;forum_id[]=' . $forum_data['forum_id'];
$action = append_sid($this->u_action . "&amp;parent_id={$this->parent_id}&amp;f={$forum_data['forum_id']}&amp;action=copy_perm");
$l_acl = sprintf($user->lang['COPY_TO_ACL'], '<a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url) . '">', '</a>');
$this->tpl_name = 'acp_forums_copy_perm';
$template->assign_vars(array(
'U_ACL' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url),
'L_ACL_LINK' => $l_acl,
'L_BACK_LINK' => adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id),
'S_COPY_ACTION' => $action,
'S_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $forum_data['forum_id'], false, false, false),
));
}
} }

View file

@ -40,7 +40,6 @@ class acp_icons
$action = (isset($_POST['edit'])) ? 'edit' : $action; $action = (isset($_POST['edit'])) ? 'edit' : $action;
$action = (isset($_POST['import'])) ? 'import' : $action; $action = (isset($_POST['import'])) ? 'import' : $action;
$icon_id = $request->variable('id', 0); $icon_id = $request->variable('id', 0);
$submit = $request->is_set_post('submit', false);
$form_key = 'acp_icons'; $form_key = 'acp_icons';
add_form_key($form_key); add_form_key($form_key);
@ -162,7 +161,7 @@ class acp_icons
case 'add': case 'add':
$smilies = $default_row = array(); $smilies = $default_row = array();
$smiley_options = $order_list = $add_order_list = ''; $smiley_options = '';
if ($action == 'add' && $mode == 'smilies') if ($action == 'add' && $mode == 'smilies')
{ {

View file

@ -21,7 +21,7 @@ if (!defined('IN_PHPBB'))
class acp_logs class acp_logs
{ {
var $u_action; public $u_action;
function main($id, $mode) function main($id, $mode)
{ {
@ -45,7 +45,6 @@ class acp_logs
$sort_dir = $request->variable('sd', 'd'); $sort_dir = $request->variable('sd', 'd');
$this->tpl_name = 'acp_logs'; $this->tpl_name = 'acp_logs';
$this->log_type = constant('LOG_' . strtoupper($mode));
/* @var $pagination \phpbb\pagination */ /* @var $pagination \phpbb\pagination */
$pagination = $phpbb_container->get('pagination'); $pagination = $phpbb_container->get('pagination');

View file

@ -204,7 +204,6 @@ class acp_main
} }
// Resync post counts // Resync post counts
$start = $max_post_id = 0;
// Find the maximum post ID, we can only stop the cycle when we've reached it // Find the maximum post ID, we can only stop the cycle when we've reached it
$sql = 'SELECT MAX(forum_last_post_id) as max_post_id $sql = 'SELECT MAX(forum_last_post_id) as max_post_id
@ -233,6 +232,7 @@ class acp_main
$step = ($config['num_posts']) ? (max((int) ($config['num_posts'] / 5), 20000)) : 20000; $step = ($config['num_posts']) ? (max((int) ($config['num_posts'] / 5), 20000)) : 20000;
$db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_posts = 0'); $db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_posts = 0');
$start = 0;
while ($start < $max_post_id) while ($start < $max_post_id)
{ {
$sql = 'SELECT COUNT(post_id) AS num_posts, poster_id $sql = 'SELECT COUNT(post_id) AS num_posts, poster_id

View file

@ -75,7 +75,6 @@ class acp_modules
$this->parent_id = $request->variable('parent_id', 0); $this->parent_id = $request->variable('parent_id', 0);
$module_id = $request->variable('m', 0); $module_id = $request->variable('m', 0);
$action = $request->variable('action', ''); $action = $request->variable('action', '');
$errors = array();
switch ($action) switch ($action)
{ {
@ -249,14 +248,10 @@ class acp_modules
trigger_error($msg . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING); trigger_error($msg . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
} }
if (!count($errors))
{
$module_manager->remove_cache_file($this->module_class); $module_manager->remove_cache_file($this->module_class);
trigger_error($user->lang['MODULE_ADDED'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id)); trigger_error($user->lang['MODULE_ADDED'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id));
} }
} }
}
else else
{ {
confirm_box(false, 'ADD_MODULE', build_hidden_fields(array( confirm_box(false, 'ADD_MODULE', build_hidden_fields(array(
@ -364,13 +359,9 @@ class acp_modules
trigger_error($msg . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING); trigger_error($msg . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
} }
if (!count($errors))
{
$module_manager->remove_cache_file($this->module_class); $module_manager->remove_cache_file($this->module_class);
trigger_error((($action == 'add') ? $user->lang['MODULE_ADDED'] : $user->lang['MODULE_EDITED']) . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id)); trigger_error((($action == 'add') ? $user->lang['MODULE_ADDED'] : $user->lang['MODULE_EDITED']) . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id));
} }
}
// Category/not category? // Category/not category?
$is_cat = (!$module_data['module_basename']) ? true : false; $is_cat = (!$module_data['module_basename']) ? true : false;
@ -430,38 +421,11 @@ class acp_modules
array_change_key_case($module_data, CASE_UPPER)) array_change_key_case($module_data, CASE_UPPER))
); );
if (count($errors))
{
$template->assign_vars(array(
'S_ERROR' => true,
'ERROR_MSG' => implode('<br />', $errors))
);
}
return; return;
break; break;
} }
// Default management page
if (count($errors))
{
if ($request->is_ajax())
{
$json_response = new \phpbb\json_response;
$json_response->send(array(
'MESSAGE_TITLE' => $user->lang('ERROR'),
'MESSAGE_TEXT' => implode('<br />', $errors),
'SUCCESS' => false,
));
}
$template->assign_vars(array(
'S_ERROR' => true,
'ERROR_MSG' => implode('<br />', $errors))
);
}
if (!$this->parent_id) if (!$this->parent_id)
{ {
$navigation = strtoupper($this->module_class); $navigation = strtoupper($this->module_class);
@ -605,7 +569,7 @@ class acp_modules
ORDER BY left_id ASC"; ORDER BY left_id ASC";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$right = $iteration = 0; $right = 0;
$padding_store = array('0' => ''); $padding_store = array('0' => '');
$module_list = $padding = ''; $module_list = $padding = '';

View file

@ -1060,11 +1060,11 @@ class acp_permissions
foreach ($hold_ary as $group_id => $forum_ary) foreach ($hold_ary as $group_id => $forum_ary)
{ {
$groups[$group_id]['auth_setting'] = $hold_ary[$group_id][$forum_id][$permission]; $groups[$group_id]['auth_setting'] = $forum_ary[$forum_id][$permission];
} }
unset($hold_ary); unset($hold_ary);
foreach ($groups as $id => $row) foreach ($groups as $row)
{ {
switch ($row['auth_setting']) switch ($row['auth_setting'])
{ {

View file

@ -344,10 +344,10 @@ class acp_profile
$s_hidden_fields = '<input type="hidden" name="field_id" value="' . $field_id . '" />'; $s_hidden_fields = '<input type="hidden" name="field_id" value="' . $field_id . '" />';
} }
else else // action = create
{ {
// We are adding a new field, define basic params // We are adding a new field, define basic params
$lang_options = $field_row = array(); $lang_options = array();
$field_type = $request->variable('field_type', ''); $field_type = $request->variable('field_type', '');
@ -475,41 +475,6 @@ class acp_profile
$cp->vars[$key] = $var; $cp->vars[$key] = $var;
} }
// step 3 - all arrays
if ($action == 'edit')
{
// Get language entries
$sql = 'SELECT *
FROM ' . PROFILE_FIELDS_LANG_TABLE . '
WHERE lang_id <> ' . $this->edit_lang_id . "
AND field_id = $field_id
ORDER BY option_id ASC";
$result = $db->sql_query($sql);
$l_lang_options = array();
while ($row = $db->sql_fetchrow($result))
{
$l_lang_options[$row['lang_id']][$row['option_id']] = $row['lang_value'];
}
$db->sql_freeresult($result);
$sql = 'SELECT lang_id, lang_name, lang_explain, lang_default_value
FROM ' . PROFILE_LANG_TABLE . '
WHERE lang_id <> ' . $this->edit_lang_id . "
AND field_id = $field_id
ORDER BY lang_id ASC";
$result = $db->sql_query($sql);
$l_lang_name = $l_lang_explain = $l_lang_default_value = array();
while ($row = $db->sql_fetchrow($result))
{
$l_lang_name[$row['lang_id']] = $row['lang_name'];
$l_lang_explain[$row['lang_id']] = $row['lang_explain'];
$l_lang_default_value[$row['lang_id']] = $row['lang_default_value'];
}
$db->sql_freeresult($result);
}
foreach ($exclude[3] as $key) foreach ($exclude[3] as $key)
{ {
$cp->vars[$key] = $request->variable($key, array(0 => ''), true); $cp->vars[$key] = $request->variable($key, array(0 => ''), true);
@ -670,7 +635,7 @@ class acp_profile
// Build options based on profile type // Build options based on profile type
$options = $profile_field->get_options($this->lang_defs['iso'][$config['default_lang']], $cp->vars); $options = $profile_field->get_options($this->lang_defs['iso'][$config['default_lang']], $cp->vars);
foreach ($options as $num => $option_ary) foreach ($options as $option_ary)
{ {
$template->assign_block_vars('option', $option_ary); $template->assign_block_vars('option', $option_ary);
} }

View file

@ -110,6 +110,7 @@ class acp_prune
if ($row = $db->sql_fetchrow($result)) if ($row = $db->sql_fetchrow($result))
{ {
$prune_ids = array(); $prune_ids = array();
$p_result = [];
$p_result['topics'] = 0; $p_result['topics'] = 0;
$p_result['posts'] = 0; $p_result['posts'] = 0;
$log_data = ''; $log_data = '';

View file

@ -21,7 +21,7 @@ if (!defined('IN_PHPBB'))
class acp_storage class acp_storage
{ {
/** @var \phpbb\config $config */ /** @var \phpbb\config\config $config */
protected $config; protected $config;
/** @var \phpbb\language\language $lang */ /** @var \phpbb\language\language $lang */
@ -33,9 +33,6 @@ class acp_storage
/** @var \phpbb\template\template */ /** @var \phpbb\template\template */
protected $template; protected $template;
/** @var \phpbb\user */
protected $user;
/** @var \phpbb\di\service_collection */ /** @var \phpbb\di\service_collection */
protected $provider_collection; protected $provider_collection;
@ -70,7 +67,6 @@ class acp_storage
$this->lang = $phpbb_container->get('language'); $this->lang = $phpbb_container->get('language');
$this->request = $phpbb_container->get('request'); $this->request = $phpbb_container->get('request');
$this->template = $phpbb_container->get('template'); $this->template = $phpbb_container->get('template');
$this->user = $phpbb_container->get('user');
$this->provider_collection = $phpbb_container->get('storage.provider_collection'); $this->provider_collection = $phpbb_container->get('storage.provider_collection');
$this->storage_collection = $phpbb_container->get('storage.storage_collection'); $this->storage_collection = $phpbb_container->get('storage.storage_collection');
$this->phpbb_root_path = $phpbb_root_path; $this->phpbb_root_path = $phpbb_root_path;

View file

@ -594,11 +594,6 @@ function mcp_move_topic($topic_ids)
$topic_data = phpbb_get_topic_data($topic_ids); $topic_data = phpbb_get_topic_data($topic_ids);
$leave_shadow = (isset($_POST['move_leave_shadow'])) ? true : false; $leave_shadow = (isset($_POST['move_leave_shadow'])) ? true : false;
$forum_sync_data = array();
$forum_sync_data[$forum_id] = current($topic_data);
$forum_sync_data[$to_forum_id] = $forum_data;
$topics_moved = $topics_moved_unapproved = $topics_moved_softdeleted = 0; $topics_moved = $topics_moved_unapproved = $topics_moved_softdeleted = 0;
$posts_moved = $posts_moved_unapproved = $posts_moved_softdeleted = 0; $posts_moved = $posts_moved_unapproved = $posts_moved_softdeleted = 0;
@ -636,12 +631,8 @@ function mcp_move_topic($topic_ids)
} }
$shadow_topics = 0; $shadow_topics = 0;
$forum_ids = array($to_forum_id);
foreach ($topic_data as $topic_id => $row) foreach ($topic_data as $topic_id => $row)
{ {
// Get the list of forums to resync
$forum_ids[] = $row['forum_id'];
// We add the $to_forum_id twice, because 'forum_id' is updated // We add the $to_forum_id twice, because 'forum_id' is updated
// when the topic is moved again later. // when the topic is moved again later.
$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_MOVE', false, array( $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_MOVE', false, array(
@ -1202,7 +1193,7 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '',
$post_data = phpbb_get_post_data($post_ids); $post_data = phpbb_get_post_data($post_ids);
foreach ($post_data as $id => $row) foreach ($post_data as $row)
{ {
$post_username = ($row['poster_id'] == ANONYMOUS && !empty($row['post_username'])) ? $row['post_username'] : $row['username']; $post_username = ($row['poster_id'] == ANONYMOUS && !empty($row['post_username'])) ? $row['post_username'] : $row['username'];
$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_DELETE_POST', false, array( $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_DELETE_POST', false, array(
@ -1741,7 +1732,7 @@ function mcp_fork_topic($topic_ids)
$config->increment('num_topics', count($new_topic_id_list), false); $config->increment('num_topics', count($new_topic_id_list), false);
$config->increment('num_posts', $total_posts, false); $config->increment('num_posts', $total_posts, false);
foreach ($new_topic_id_list as $topic_id => $new_topic_id) foreach ($new_topic_id_list as $new_topic_id)
{ {
$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_FORK', false, array( $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_FORK', false, array(
'forum_id' => $to_forum_id, 'forum_id' => $to_forum_id,

View file

@ -135,6 +135,7 @@ class mcp_pm_reports
ORDER BY filetime DESC'; ORDER BY filetime DESC';
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$attachments = [];
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
$attachments[] = $row; $attachments[] = $row;
@ -242,12 +243,10 @@ class mcp_pm_reports
ORDER BY $sort_order_sql"; ORDER BY $sort_order_sql";
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
$i = 0;
$report_ids = array(); $report_ids = array();
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
$report_ids[] = $row['report_id']; $report_ids[] = $row['report_id'];
$row_num[$row['report_id']] = $i++;
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);

View file

@ -129,7 +129,7 @@ function mcp_post_details($id, $mode, $action)
// Set some vars // Set some vars
$users_ary = $usernames_ary = array(); $users_ary = $usernames_ary = array();
$attachments = $extensions = array(); $attachments = array();
$post_id = $post_info['post_id']; $post_id = $post_info['post_id'];
// Get topic tracking info // Get topic tracking info

View file

@ -369,7 +369,6 @@ class mcp_queue
$user->add_lang(array('viewtopic', 'viewforum')); $user->add_lang(array('viewtopic', 'viewforum'));
$topic_id = $request->variable('t', 0); $topic_id = $request->variable('t', 0);
$forum_info = array();
// If 'sort' is set, "Go" was pressed which is located behind the forums <select> box // If 'sort' is set, "Go" was pressed which is located behind the forums <select> box
// Then, unset the topic id so it does not override the forum id // Then, unset the topic id so it does not override the forum id
@ -413,13 +412,6 @@ class mcp_queue
{ {
trigger_error('NOT_MODERATOR'); trigger_error('NOT_MODERATOR');
} }
$sql = 'SELECT SUM(forum_topics_approved) as sum_forum_topics
FROM ' . FORUMS_TABLE . '
WHERE ' . $db->sql_in_set('forum_id', $forum_list);
$result = $db->sql_query($sql);
$forum_info['forum_topics_approved'] = (int) $db->sql_fetchfield('sum_forum_topics');
$db->sql_freeresult($result);
} }
else else
{ {
@ -486,12 +478,10 @@ class mcp_queue
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
$i = 0;
$post_ids = array(); $post_ids = array();
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
$post_ids[] = $row['post_id']; $post_ids[] = $row['post_id'];
$row_num[$row['post_id']] = $i++;
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);

View file

@ -342,7 +342,6 @@ class mcp_reports
$topic_id = $request->variable('t', 0, false, \phpbb\request\request_interface::POST); $topic_id = $request->variable('t', 0, false, \phpbb\request\request_interface::POST);
} }
$forum_info = array();
$forum_list_reports = get_forum_list('m_report', false, true); $forum_list_reports = get_forum_list('m_report', false, true);
$forum_list_read = array_flip(get_forum_list('f_read', true, true)); // Flipped so we can isset() the forum IDs $forum_list_read = array_flip(get_forum_list('f_read', true, true)); // Flipped so we can isset() the forum IDs
@ -389,13 +388,6 @@ class mcp_reports
{ {
trigger_error('NOT_MODERATOR'); trigger_error('NOT_MODERATOR');
} }
$sql = 'SELECT SUM(forum_topics_approved) as sum_forum_topics
FROM ' . FORUMS_TABLE . '
WHERE ' . $db->sql_in_set('forum_id', $forum_list);
$result = $db->sql_query($sql);
$forum_info['forum_topics_approved'] = (int) $db->sql_fetchfield('sum_forum_topics');
$db->sql_freeresult($result);
} }
else else
{ {

View file

@ -199,7 +199,7 @@ class ucp_login_link
*/ */
protected function process_login_result($result) protected function process_login_result($result)
{ {
global $config, $template, $user, $phpbb_container; global $config, $template, $user, $phpbb_container, $phpbb_root_path, $phpEx;
$login_error = null; $login_error = null;

View file

@ -666,6 +666,7 @@ class ucp_main
WHERE ' . $db->sql_in_set('topic_id', array_unique($topic_ids)); WHERE ' . $db->sql_in_set('topic_id', array_unique($topic_ids));
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$topic_rows = [];
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
$topic_rows[$row['topic_id']] = $row; $topic_rows[$row['topic_id']] = $row;
@ -890,7 +891,7 @@ class ucp_main
$sql = $db->sql_build_query('SELECT', $sql_array); $sql = $db->sql_build_query('SELECT', $sql_array);
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
$topic_list = $topic_forum_list = $global_announce_list = $rowset = array(); $topic_list = $topic_forum_list = $rowset = array();
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
$topic_id = (isset($row['b_topic_id'])) ? $row['b_topic_id'] : $row['topic_id']; $topic_id = (isset($row['b_topic_id'])) ? $row['b_topic_id'] : $row['topic_id'];
@ -900,11 +901,6 @@ class ucp_main
$topic_forum_list[$row['forum_id']]['forum_mark_time'] = ($config['load_db_lastread']) ? $row['forum_mark_time'] : 0; $topic_forum_list[$row['forum_id']]['forum_mark_time'] = ($config['load_db_lastread']) ? $row['forum_mark_time'] : 0;
$topic_forum_list[$row['forum_id']]['topics'][] = $topic_id; $topic_forum_list[$row['forum_id']]['topics'][] = $topic_id;
if ($row['topic_type'] == POST_GLOBAL)
{
$global_announce_list[] = $topic_id;
}
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);

View file

@ -45,7 +45,7 @@ class ucp_pm
function main($id, $mode) function main($id, $mode)
{ {
global $user, $template, $phpbb_root_path, $auth, $phpEx, $db, $config, $request; global $user, $template, $phpbb_root_path, $auth, $phpEx, $db, $config, $request, $global_privmsgs_rules, $global_rule_conditions;
if (!$user->data['is_registered']) if (!$user->data['is_registered'])
{ {

View file

@ -1028,7 +1028,7 @@ function compose_pm($id, $mode, $action, $user_folders = array())
parse_attachments(false, $preview_message, $attachment_data, $update_count, true); parse_attachments(false, $preview_message, $attachment_data, $update_count, true);
foreach ($attachment_data as $i => $attachment) foreach ($attachment_data as $attachment)
{ {
$template->assign_block_vars('attachment', array( $template->assign_block_vars('attachment', array(
'DISPLAY_ATTACHMENT' => $attachment) 'DISPLAY_ATTACHMENT' => $attachment)

View file

@ -37,7 +37,7 @@ class ucp_profile
$user->add_lang('posting'); $user->add_lang('posting');
$submit = $request->variable('submit', false, false, \phpbb\request\request_interface::POST); $submit = $request->variable('submit', false, false, \phpbb\request\request_interface::POST);
$error = $data = array(); $error = array();
$s_hidden_fields = ''; $s_hidden_fields = '';
switch ($mode) switch ($mode)

View file

@ -106,7 +106,7 @@ class ucp_register
/* @var $cp \phpbb\profilefields\manager */ /* @var $cp \phpbb\profilefields\manager */
$cp = $phpbb_container->get('profilefields.manager'); $cp = $phpbb_container->get('profilefields.manager');
$error = $cp_data = $cp_error = array(); $error = $cp_data = array();
$s_hidden_fields = array(); $s_hidden_fields = array();
// Handle login_link data added to $_hidden_fields // Handle login_link data added to $_hidden_fields

View file

@ -44,9 +44,9 @@ class recreate extends \phpbb\console\command\command
*/ */
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
$parameters = array( $command = $this->getApplication()->find('thumbnail:delete');
'command' => 'thumbnail:delete'
); $parameters = [];
if ($input->getOption('verbose')) if ($input->getOption('verbose'))
{ {
@ -56,14 +56,14 @@ class recreate extends \phpbb\console\command\command
$this->getApplication()->setAutoExit(false); $this->getApplication()->setAutoExit(false);
$input_delete = new ArrayInput($parameters); $input_delete = new ArrayInput($parameters);
$return = $this->getApplication()->run($input_delete, $output); $return = $command->run($input_delete, $output);
if ($return === symfony_command::SUCCESS) if ($return === symfony_command::SUCCESS)
{ {
$parameters['command'] = 'thumbnail:generate'; $command = $this->getApplication()->find('thumbnail:generate');
$input_create = new ArrayInput($parameters); $input_create = new ArrayInput([]);
$return = $this->getApplication()->run($input_create, $output); $return = $command->run($input_create, $output);
} }
$this->getApplication()->setAutoExit(true); $this->getApplication()->setAutoExit(true);

View file

@ -21,7 +21,6 @@ class phpbb_console_command_cache_purge_test extends phpbb_test_case
{ {
protected $cache_dir; protected $cache_dir;
protected $cache; protected $cache;
protected $command_name;
protected $db; protected $db;
protected $config; protected $config;
protected $user; protected $user;
@ -60,7 +59,7 @@ class phpbb_console_command_cache_purge_test extends phpbb_test_case
); );
$command_tester = $this->get_command_tester(); $command_tester = $this->get_command_tester();
$exit_status = $command_tester->execute(array('command' => $this->command_name)); $exit_status = $command_tester->execute([]);
$this->assertSame(false, $this->cache->get('test_key')); $this->assertSame(false, $this->cache->get('test_key'));
$this->assertSame(2, $this->config['assets_version']); $this->assertSame(2, $this->config['assets_version']);
@ -90,7 +89,6 @@ class phpbb_console_command_cache_purge_test extends phpbb_test_case
$application->add(new purge($this->user, $this->cache, $this->db, $this->createMock('\phpbb\auth\auth'), new \phpbb\log\dummy(), $this->config)); $application->add(new purge($this->user, $this->cache, $this->db, $this->createMock('\phpbb\auth\auth'), new \phpbb\log\dummy(), $this->config));
$command = $application->find('cache:purge'); $command = $application->find('cache:purge');
$this->command_name = $command->getName();
return new CommandTester($command); return new CommandTester($command);
} }
} }

View file

@ -22,8 +22,6 @@ class phpbb_console_command_config_test extends phpbb_test_case
protected function setUp(): void protected function setUp(): void
{ {
global $phpbb_root_path, $phpEx;
$this->config = new \phpbb\config\config(array()); $this->config = new \phpbb\config\config(array());
$this->user = $this->createMock('\phpbb\user'); $this->user = $this->createMock('\phpbb\user');
@ -34,9 +32,8 @@ class phpbb_console_command_config_test extends phpbb_test_case
{ {
$this->assertEmpty($this->config); $this->assertEmpty($this->config);
$command_tester = $this->get_command_tester('set'); $command_tester = $this->get_command_tester('set', 'set');
$command_tester->execute(array( $command_tester->execute(array(
'command' => $this->command_name,
'key' => 'test_key', 'key' => 'test_key',
'value' => 'test_value', 'value' => 'test_value',
'--dynamic' => true, '--dynamic' => true,
@ -49,9 +46,8 @@ class phpbb_console_command_config_test extends phpbb_test_case
{ {
$this->assertEmpty($this->config); $this->assertEmpty($this->config);
$command_tester = $this->get_command_tester('set'); $command_tester = $this->get_command_tester('set', 'set');
$command_tester->execute(array( $command_tester->execute(array(
'command' => $this->command_name,
'key' => 'test_key', 'key' => 'test_key',
'value' => 'test_value', 'value' => 'test_value',
'--dynamic' => false, '--dynamic' => false,
@ -67,9 +63,8 @@ class phpbb_console_command_config_test extends phpbb_test_case
$this->config->set('test_key', 'old_value', true); $this->config->set('test_key', 'old_value', true);
$this->assertSame($this->config['test_key'], 'old_value'); $this->assertSame($this->config['test_key'], 'old_value');
$command_tester = $this->get_command_tester('set_atomic'); $command_tester = $this->get_command_tester('set_atomic', 'set-atomic');
$command_tester->execute(array( $command_tester->execute(array(
'command' => $this->command_name,
'key' => 'test_key', 'key' => 'test_key',
'old' => 'old_value', 'old' => 'old_value',
'new' => 'new_value', 'new' => 'new_value',
@ -86,9 +81,8 @@ class phpbb_console_command_config_test extends phpbb_test_case
$this->config->set('test_key', 'old_value', false); $this->config->set('test_key', 'old_value', false);
$this->assertSame($this->config['test_key'], 'old_value'); $this->assertSame($this->config['test_key'], 'old_value');
$command_tester = $this->get_command_tester('set_atomic'); $command_tester = $this->get_command_tester('set_atomic', 'set-atomic');
$command_tester->execute(array( $command_tester->execute(array(
'command' => $this->command_name,
'key' => 'test_key', 'key' => 'test_key',
'old' => 'old_value', 'old' => 'old_value',
'new' => 'new_value', 'new' => 'new_value',
@ -105,9 +99,8 @@ class phpbb_console_command_config_test extends phpbb_test_case
$this->config->set('test_key', 'wrong_value', true); $this->config->set('test_key', 'wrong_value', true);
$this->assertSame($this->config['test_key'], 'wrong_value'); $this->assertSame($this->config['test_key'], 'wrong_value');
$command_tester = $this->get_command_tester('set_atomic'); $command_tester = $this->get_command_tester('set_atomic', 'set-atomic');
$command_tester->execute(array( $command_tester->execute(array(
'command' => $this->command_name,
'key' => 'test_key', 'key' => 'test_key',
'old' => 'old_value', 'old' => 'old_value',
'new' => 'new_value', 'new' => 'new_value',
@ -122,9 +115,8 @@ class phpbb_console_command_config_test extends phpbb_test_case
$this->config->set('test_key', 'test_value', false); $this->config->set('test_key', 'test_value', false);
$this->assertSame($this->config['test_key'], 'test_value'); $this->assertSame($this->config['test_key'], 'test_value');
$command_tester = $this->get_command_tester('get'); $command_tester = $this->get_command_tester('get', 'get');
$command_tester->execute(array( $command_tester->execute(array(
'command' => $this->command_name,
'key' => 'test_key', 'key' => 'test_key',
'--no-newline' => true, '--no-newline' => true,
)); ));
@ -137,9 +129,8 @@ class phpbb_console_command_config_test extends phpbb_test_case
$this->config->set('test_key', 'test_value', false); $this->config->set('test_key', 'test_value', false);
$this->assertSame($this->config['test_key'], 'test_value'); $this->assertSame($this->config['test_key'], 'test_value');
$command_tester = $this->get_command_tester('get'); $command_tester = $this->get_command_tester('get', 'get');
$command_tester->execute(array( $command_tester->execute(array(
'command' => $this->command_name,
'key' => 'test_key', 'key' => 'test_key',
'--no-newline' => false, '--no-newline' => false,
)); ));
@ -152,9 +143,8 @@ class phpbb_console_command_config_test extends phpbb_test_case
$this->config->set('test_key', 'test_value', false); $this->config->set('test_key', 'test_value', false);
$this->assertSame($this->config['test_key'], 'test_value'); $this->assertSame($this->config['test_key'], 'test_value');
$command_tester = $this->get_command_tester('get'); $command_tester = $this->get_command_tester('get', 'get');
$command_tester->execute(array( $command_tester->execute(array(
'command' => $this->command_name,
'key' => 'wrong_key', 'key' => 'wrong_key',
'--no-newline' => false, '--no-newline' => false,
)); ));
@ -167,9 +157,8 @@ class phpbb_console_command_config_test extends phpbb_test_case
$this->config->set('test_key', 0, false); $this->config->set('test_key', 0, false);
$this->assertSame($this->config['test_key'], 0); $this->assertSame($this->config['test_key'], 0);
$command_tester = $this->get_command_tester('increment'); $command_tester = $this->get_command_tester('increment', 'increment');
$command_tester->execute(array( $command_tester->execute(array(
'command' => $this->command_name,
'key' => 'test_key', 'key' => 'test_key',
'increment' => 2, 'increment' => 2,
'--dynamic' => true, '--dynamic' => true,
@ -184,9 +173,8 @@ class phpbb_console_command_config_test extends phpbb_test_case
$this->config->set('test_key', 0, false); $this->config->set('test_key', 0, false);
$this->assertSame($this->config['test_key'], 0); $this->assertSame($this->config['test_key'], 0);
$command_tester = $this->get_command_tester('increment'); $command_tester = $this->get_command_tester('increment', 'increment');
$command_tester->execute(array( $command_tester->execute(array(
'command' => $this->command_name,
'key' => 'test_key', 'key' => 'test_key',
'increment' => 2, 'increment' => 2,
'--dynamic' => false, '--dynamic' => false,
@ -200,9 +188,8 @@ class phpbb_console_command_config_test extends phpbb_test_case
{ {
$this->assertEmpty($this->config); $this->assertEmpty($this->config);
$command_tester = $this->get_command_tester('increment'); $command_tester = $this->get_command_tester('increment', 'increment');
$command_tester->execute(array( $command_tester->execute(array(
'command' => $this->command_name,
'key' => 'test_key', 'key' => 'test_key',
'increment' => 2, 'increment' => 2,
'--dynamic' => true, '--dynamic' => true,
@ -217,9 +204,8 @@ class phpbb_console_command_config_test extends phpbb_test_case
$this->config->set('test_key', 'test_value', false); $this->config->set('test_key', 'test_value', false);
$this->assertSame($this->config['test_key'], 'test_value'); $this->assertSame($this->config['test_key'], 'test_value');
$command_tester = $this->get_command_tester('delete'); $command_tester = $this->get_command_tester('delete', 'delete');
$command_tester->execute(array( $command_tester->execute(array(
'command' => $this->command_name,
'key' => 'test_key', 'key' => 'test_key',
)); ));
@ -231,9 +217,8 @@ class phpbb_console_command_config_test extends phpbb_test_case
{ {
$this->assertEmpty($this->config); $this->assertEmpty($this->config);
$command_tester = $this->get_command_tester('delete'); $command_tester = $this->get_command_tester('delete', 'delete');
$command_tester->execute(array( $command_tester->execute(array(
'command' => $this->command_name,
'key' => 'wrong_key', 'key' => 'wrong_key',
)); ));
@ -241,13 +226,12 @@ class phpbb_console_command_config_test extends phpbb_test_case
$this->assertEmpty($this->config); $this->assertEmpty($this->config);
} }
public function get_command_tester($class_name) public function get_command_tester($class_name, $command_name)
{ {
$command_complete_name = '\phpbb\console\command\config' . '\\' . $class_name; $command_complete_name = '\phpbb\console\command\config' . '\\' . $class_name;
$application = new Application(); $application = new Application();
$application->add(new $command_complete_name($this->user, $this->config)); $application->add(new $command_complete_name($this->user, $this->config));
$command = $application->find('config:' . $this->command_name); $command = $application->find('config:' . $command_name);
$this->command_name = $command->getName();
return new CommandTester($command); return new CommandTester($command);
} }
} }

View file

@ -26,8 +26,6 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case
/** @var \phpbb\user */ /** @var \phpbb\user */
protected $user; protected $user;
protected $command_name;
protected $command_tester; protected $command_tester;
protected function setUp(): void protected function setUp(): void
@ -111,7 +109,6 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case
$application->add(new cron_list($this->user, $this->cron_manager)); $application->add(new cron_list($this->user, $this->cron_manager));
$command = $application->find('cron:list'); $command = $application->find('cron:list');
$this->command_name = $command->getName();
return new CommandTester($command); return new CommandTester($command);
} }
@ -131,6 +128,6 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case
$this->get_cron_manager($tasks); $this->get_cron_manager($tasks);
$this->command_tester = $this->get_command_tester(); $this->command_tester = $this->get_command_tester();
$this->command_tester->execute(array('command' => $this->command_name), array('decorated' => false)); $this->command_tester->execute([], array('decorated' => false));
} }
} }

View file

@ -24,7 +24,6 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
protected $lock; protected $lock;
protected $user; protected $user;
protected $cron_manager; protected $cron_manager;
protected $command_name;
protected $task; protected $task;
public function getDataSet() public function getDataSet()
@ -86,7 +85,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
public function test_normal_use() public function test_normal_use()
{ {
$command_tester = $this->get_command_tester(); $command_tester = $this->get_command_tester();
$exit_status = $command_tester->execute(array('command' => $this->command_name)); $exit_status = $command_tester->execute([]);
$this->assertSame('', $command_tester->getDisplay()); $this->assertSame('', $command_tester->getDisplay());
$this->assertSame(true, $this->task->executed); $this->assertSame(true, $this->task->executed);
@ -97,7 +96,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
public function test_verbose_mode() public function test_verbose_mode()
{ {
$command_tester = $this->get_command_tester(); $command_tester = $this->get_command_tester();
$exit_status = $command_tester->execute(array('command' => $this->command_name, '--verbose' => true)); $exit_status = $command_tester->execute(array('--verbose' => true));
$this->assertStringContainsString('RUNNING_TASK', $command_tester->getDisplay()); $this->assertStringContainsString('RUNNING_TASK', $command_tester->getDisplay());
$this->assertSame(true, $this->task->executed); $this->assertSame(true, $this->task->executed);
@ -112,7 +111,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
$this->lock->acquire(); $this->lock->acquire();
$command_tester = $this->get_command_tester(); $command_tester = $this->get_command_tester();
$exit_status = $command_tester->execute(array('command' => $this->command_name)); $exit_status = $command_tester->execute([]);
$this->assertStringContainsString('CRON_LOCK_ERROR', $command_tester->getDisplay()); $this->assertStringContainsString('CRON_LOCK_ERROR', $command_tester->getDisplay());
$this->assertSame(false, $this->task->executed); $this->assertSame(false, $this->task->executed);
@ -159,7 +158,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
$this->cron_manager->load_tasks($tasks); $this->cron_manager->load_tasks($tasks);
$command_tester = $this->get_command_tester(); $command_tester = $this->get_command_tester();
$exit_status = $command_tester->execute(array('command' => $this->command_name)); $exit_status = $command_tester->execute([]);
$this->assertSame('', $command_tester->getDisplay()); $this->assertSame('', $command_tester->getDisplay());
$this->assertSame(0, $exit_status); $this->assertSame(0, $exit_status);
@ -206,7 +205,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
$this->cron_manager->load_tasks($tasks); $this->cron_manager->load_tasks($tasks);
$command_tester = $this->get_command_tester(); $command_tester = $this->get_command_tester();
$exit_status = $command_tester->execute(array('command' => $this->command_name, '--verbose' => true)); $exit_status = $command_tester->execute(array('--verbose' => true));
$this->assertStringContainsString('CRON_NO_TASK', $command_tester->getDisplay()); $this->assertStringContainsString('CRON_NO_TASK', $command_tester->getDisplay());
$this->assertSame(0, $exit_status); $this->assertSame(0, $exit_status);
@ -216,7 +215,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
public function test_arg_valid() public function test_arg_valid()
{ {
$command_tester = $this->get_command_tester(); $command_tester = $this->get_command_tester();
$exit_status = $command_tester->execute(array('command' => $this->command_name, 'name' => 'phpbb_cron_task_simple')); $exit_status = $command_tester->execute(array('name' => 'phpbb_cron_task_simple'));
$this->assertSame('', $command_tester->getDisplay()); $this->assertSame('', $command_tester->getDisplay());
$this->assertSame(true, $this->task->executed); $this->assertSame(true, $this->task->executed);
@ -230,7 +229,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
$this->expectExceptionMessage('CRON_NO_SUCH_TASK'); $this->expectExceptionMessage('CRON_NO_SUCH_TASK');
$command_tester = $this->get_command_tester(); $command_tester = $this->get_command_tester();
$exit_status = $command_tester->execute(array('command' => $this->command_name, 'name' => 'foo')); $exit_status = $command_tester->execute(array('name' => 'foo'));
$this->assertStringContainsString('CRON_NO_SUCH_TASK', $command_tester->getDisplay()); $this->assertStringContainsString('CRON_NO_SUCH_TASK', $command_tester->getDisplay());
$this->assertSame(false, $this->task->executed); $this->assertSame(false, $this->task->executed);
@ -241,7 +240,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
public function test_arg_valid_verbose() public function test_arg_valid_verbose()
{ {
$command_tester = $this->get_command_tester(); $command_tester = $this->get_command_tester();
$exit_status = $command_tester->execute(array('command' => $this->command_name, 'name' => 'phpbb_cron_task_simple', '--verbose' => true)); $exit_status = $command_tester->execute(array('name' => 'phpbb_cron_task_simple', '--verbose' => true));
$this->assertStringContainsString('RUNNING_TASK', $command_tester->getDisplay()); $this->assertStringContainsString('RUNNING_TASK', $command_tester->getDisplay());
$this->assertSame(true, $this->task->executed); $this->assertSame(true, $this->task->executed);
@ -255,7 +254,6 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
$application->add(new run($this->user, $this->cron_manager, $this->lock)); $application->add(new run($this->user, $this->cron_manager, $this->lock));
$command = $application->find('cron:run'); $command = $application->find('cron:run');
$this->command_name = $command->getName();
return new CommandTester($command); return new CommandTester($command);
} }
} }

View file

@ -89,7 +89,7 @@ class phpbb_console_command_thumbnail_test extends phpbb_database_test_case
public function test_thumbnails() public function test_thumbnails()
{ {
$command_tester = $this->get_command_tester('thumbnail:generate'); $command_tester = $this->get_command_tester('thumbnail:generate');
$exit_status = $command_tester->execute(array('command' => 'thumbnail:generate')); $exit_status = $command_tester->execute([]);
self::assertSame(true, file_exists($this->phpbb_root_path . 'files/thumb_test_png_1')); self::assertSame(true, file_exists($this->phpbb_root_path . 'files/thumb_test_png_1'));
self::assertSame(true, file_exists($this->phpbb_root_path . 'files/thumb_test_png_2')); self::assertSame(true, file_exists($this->phpbb_root_path . 'files/thumb_test_png_2'));
@ -97,7 +97,7 @@ class phpbb_console_command_thumbnail_test extends phpbb_database_test_case
self::assertSame(0, $exit_status); self::assertSame(0, $exit_status);
$command_tester = $this->get_command_tester('thumbnail:delete'); $command_tester = $this->get_command_tester('thumbnail:delete');
$exit_status = $command_tester->execute(array('command' => 'thumbnail:delete')); $exit_status = $command_tester->execute([]);
self::assertSame(false, file_exists($this->phpbb_root_path . 'files/thumb_test_png_1')); self::assertSame(false, file_exists($this->phpbb_root_path . 'files/thumb_test_png_1'));
self::assertSame(false, file_exists($this->phpbb_root_path . 'files/thumb_test_png_2')); self::assertSame(false, file_exists($this->phpbb_root_path . 'files/thumb_test_png_2'));
@ -105,7 +105,7 @@ class phpbb_console_command_thumbnail_test extends phpbb_database_test_case
self::assertSame(0, $exit_status); self::assertSame(0, $exit_status);
$command_tester = $this->get_command_tester('thumbnail:recreate'); $command_tester = $this->get_command_tester('thumbnail:recreate');
$exit_status = $command_tester->execute(array('command' => 'thumbnail:recreate')); $exit_status = $command_tester->execute([]);
self::assertSame(true, file_exists($this->phpbb_root_path . 'files/thumb_test_png_1')); self::assertSame(true, file_exists($this->phpbb_root_path . 'files/thumb_test_png_1'));
self::assertSame(true, file_exists($this->phpbb_root_path . 'files/thumb_test_png_2')); self::assertSame(true, file_exists($this->phpbb_root_path . 'files/thumb_test_png_2'));

View file

@ -24,8 +24,6 @@ require_once __DIR__ . '/../../../phpBB/includes/utf/utf_tools.php';
*/ */
class phpbb_console_command_check_test extends phpbb_test_case class phpbb_console_command_check_test extends phpbb_test_case
{ {
protected $command_name;
protected $version_helper; protected $version_helper;
/** @var \phpbb\language\language */ /** @var \phpbb\language\language */
@ -34,7 +32,7 @@ class phpbb_console_command_check_test extends phpbb_test_case
public function test_up_to_date() public function test_up_to_date()
{ {
$command_tester = $this->get_command_tester('100000'); $command_tester = $this->get_command_tester('100000');
$status = $command_tester->execute(array('command' => $this->command_name, '--no-ansi' => true)); $status = $command_tester->execute(array('--no-ansi' => true));
$this->assertSame('', $command_tester->getDisplay()); $this->assertSame('', $command_tester->getDisplay());
$this->assertSame($status, 0); $this->assertSame($status, 0);
} }
@ -42,7 +40,7 @@ class phpbb_console_command_check_test extends phpbb_test_case
public function test_up_to_date_verbose() public function test_up_to_date_verbose()
{ {
$command_tester = $this->get_command_tester('100000'); $command_tester = $this->get_command_tester('100000');
$status = $command_tester->execute(array('command' => $this->command_name, '--no-ansi' => true, '--verbose' => true)); $status = $command_tester->execute(array('--no-ansi' => true, '--verbose' => true));
$this->assertStringContainsString($this->language->lang('UPDATE_NOT_NEEDED'), $command_tester->getDisplay()); $this->assertStringContainsString($this->language->lang('UPDATE_NOT_NEEDED'), $command_tester->getDisplay());
$this->assertSame($status, 0); $this->assertSame($status, 0);
} }
@ -51,7 +49,7 @@ class phpbb_console_command_check_test extends phpbb_test_case
public function test_not_up_to_date() public function test_not_up_to_date()
{ {
$command_tester = $this->get_command_tester('0'); $command_tester = $this->get_command_tester('0');
$status = $command_tester->execute(array('command' => $this->command_name, '--no-ansi' => true)); $status = $command_tester->execute(array('--no-ansi' => true));
$this->assertStringContainsString($this->language->lang('UPDATE_NEEDED'), $command_tester->getDisplay()); $this->assertStringContainsString($this->language->lang('UPDATE_NEEDED'), $command_tester->getDisplay());
$this->assertSame($status, 1); $this->assertSame($status, 1);
} }
@ -59,7 +57,7 @@ class phpbb_console_command_check_test extends phpbb_test_case
public function test_not_up_to_date_verbose() public function test_not_up_to_date_verbose()
{ {
$command_tester = $this->get_command_tester('0'); $command_tester = $this->get_command_tester('0');
$status = $command_tester->execute(array('command' => $this->command_name, '--no-ansi' => true, '--verbose' => true)); $status = $command_tester->execute(array('--no-ansi' => true, '--verbose' => true));
$this->assertStringContainsString($this->language->lang('UPDATE_NEEDED'), $command_tester->getDisplay()); $this->assertStringContainsString($this->language->lang('UPDATE_NEEDED'), $command_tester->getDisplay());
$this->assertStringContainsString($this->language->lang('UPDATES_AVAILABLE'), $command_tester->getDisplay()); $this->assertStringContainsString($this->language->lang('UPDATES_AVAILABLE'), $command_tester->getDisplay());
$this->assertSame($status, 1); $this->assertSame($status, 1);
@ -72,7 +70,7 @@ class phpbb_console_command_check_test extends phpbb_test_case
$command_tester = $this->get_command_tester('1'); $command_tester = $this->get_command_tester('1');
$this->version_helper->set_file_location('acme.corp','foo', 'bar.json'); $this->version_helper->set_file_location('acme.corp','foo', 'bar.json');
$status = $command_tester->execute(array('command' => $this->command_name, '--no-ansi' => true)); $status = $command_tester->execute(array('--no-ansi' => true));
$this->assertStringContainsString('VERSIONCHECK_FAIL', $command_tester->getDisplay()); $this->assertStringContainsString('VERSIONCHECK_FAIL', $command_tester->getDisplay());
$this->assertSame($status, 2); $this->assertSame($status, 2);
} }
@ -100,7 +98,6 @@ class phpbb_console_command_check_test extends phpbb_test_case
$application->add(new check($user, $config, $container, $this->language)); $application->add(new check($user, $config, $container, $this->language));
$command = $application->find('update:check'); $command = $application->find('update:check');
$this->command_name = $command->getName();
return new CommandTester($command); return new CommandTester($command);
} }
} }

View file

@ -45,7 +45,6 @@ class phpbb_console_user_activate_test extends phpbb_console_user_base
)); ));
$command = $application->find('user:activate'); $command = $application->find('user:activate');
$this->command_name = $command->getName();
return new CommandTester($command); return new CommandTester($command);
} }
@ -75,7 +74,6 @@ class phpbb_console_user_activate_test extends phpbb_console_user_base
$command_tester = $this->get_command_tester(); $command_tester = $this->get_command_tester();
$command_tester->execute(array( $command_tester->execute(array(
'command' => $this->command_name,
'username' => $username, 'username' => $username,
'--deactivate' => $deactivate, '--deactivate' => $deactivate,
)); ));

View file

@ -36,7 +36,6 @@ class phpbb_console_user_add_test extends phpbb_console_user_base
)); ));
$command = $application->find('user:add'); $command = $application->find('user:add');
$this->command_name = $command->getName();
if (!empty($question_answers)) if (!empty($question_answers))
{ {
@ -86,7 +85,6 @@ class phpbb_console_user_add_test extends phpbb_console_user_base
$this->assertEquals(2, $this->get_user_id('Admin')); $this->assertEquals(2, $this->get_user_id('Admin'));
$command_tester->execute(array( $command_tester->execute(array(
'command' => $this->command_name,
'--username' => 'foo', '--username' => 'foo',
'--password' => 'bar', '--password' => 'bar',
'--email' => 'foo@test.com' '--email' => 'foo@test.com'
@ -108,9 +106,7 @@ class phpbb_console_user_add_test extends phpbb_console_user_base
$command_tester->setInputs(['bar', 'password', 'password', 'bar@test.com']); $command_tester->setInputs(['bar', 'password', 'password', 'bar@test.com']);
$command_tester->execute(array( $command_tester->execute([]);
'command' => $this->command_name,
));
$this->assertNotEquals(null, $this->get_user_id('bar')); $this->assertNotEquals(null, $this->get_user_id('bar'));
$this->assertStringContainsString('CLI_USER_ADD_SUCCESS', $command_tester->getDisplay()); $this->assertStringContainsString('CLI_USER_ADD_SUCCESS', $command_tester->getDisplay());
@ -124,7 +120,6 @@ class phpbb_console_user_add_test extends phpbb_console_user_base
$this->assertEquals(3, $this->get_user_id('Test')); $this->assertEquals(3, $this->get_user_id('Test'));
$command_tester->execute(array( $command_tester->execute(array(
'command' => $this->command_name,
'--username' => 'Test', '--username' => 'Test',
'--password' => '1', '--password' => '1',
'--email' => 'foo' '--email' => 'foo'

View file

@ -19,7 +19,6 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case
protected $language; protected $language;
protected $log; protected $log;
protected $passwords_manager; protected $passwords_manager;
protected $command_name;
/** @var Symfony\Component\Console\Helper\QuestionHelper */ /** @var Symfony\Component\Console\Helper\QuestionHelper */
protected $question; protected $question;
protected $user_loader; protected $user_loader;

View file

@ -32,7 +32,6 @@ class phpbb_console_user_delete_test extends phpbb_console_user_base
)); ));
$command = $application->find('user:delete'); $command = $application->find('user:delete');
$this->command_name = $command->getName();
$this->question = $command->getHelper('question'); $this->question = $command->getHelper('question');
return new CommandTester($command); return new CommandTester($command);
@ -47,7 +46,6 @@ class phpbb_console_user_delete_test extends phpbb_console_user_base
$command_tester->setInputs(['yes', '']); $command_tester->setInputs(['yes', '']);
$command_tester->execute(array( $command_tester->execute(array(
'command' => $this->command_name,
'username' => 'Test', 'username' => 'Test',
'--delete-posts' => false, '--delete-posts' => false,
)); ));
@ -65,7 +63,6 @@ class phpbb_console_user_delete_test extends phpbb_console_user_base
$command_tester->setInputs(['yes', '']); $command_tester->setInputs(['yes', '']);
$command_tester->execute(array( $command_tester->execute(array(
'command' => $this->command_name,
'username' => 'Foo', 'username' => 'Foo',
'--delete-posts' => false, '--delete-posts' => false,
)); ));
@ -82,7 +79,6 @@ class phpbb_console_user_delete_test extends phpbb_console_user_base
$command_tester->setInputs(['no', '']); $command_tester->setInputs(['no', '']);
$command_tester->execute(array( $command_tester->execute(array(
'command' => $this->command_name,
'username' => 'Test', 'username' => 'Test',
'--delete-posts' => false, '--delete-posts' => false,
)); ));

View file

@ -29,7 +29,6 @@ class phpbb_console_user_reclean_test extends phpbb_console_user_base
)); ));
$command = $application->find('user:reclean'); $command = $application->find('user:reclean');
$this->command_name = $command->getName();
return new CommandTester($command); return new CommandTester($command);
} }
@ -38,7 +37,7 @@ class phpbb_console_user_reclean_test extends phpbb_console_user_base
{ {
$command_tester = $this->get_command_tester(); $command_tester = $this->get_command_tester();
$exit_status = $command_tester->execute(array('command' => $this->command_name)); $exit_status = $command_tester->execute([]);
$this->assertSame(0, $exit_status); $this->assertSame(0, $exit_status);
$result = $this->db->sql_query('SELECT user_id FROM ' . USERS_TABLE . " WHERE username_clean = 'test unclean'"); $result = $this->db->sql_query('SELECT user_id FROM ' . USERS_TABLE . " WHERE username_clean = 'test unclean'");