1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/14972] replace all occurrences of sizeof() with the count()

PHPBB3-14972
This commit is contained in:
rxu
2017-06-28 00:58:03 +07:00
parent 67a65e3788
commit 797234e416
165 changed files with 986 additions and 986 deletions

View File

@@ -537,7 +537,7 @@ class convertor
foreach ($prefixes as $prefix => $count)
{
if ($count >= sizeof($tables))
if ($count >= count($tables))
{
$possible_prefix = $prefix;
break;
@@ -730,7 +730,7 @@ class convertor
include_once($this->phpbb_root_path . 'install/convertors/' . $entry);
if (isset($convertor_data))
{
$sort[strtolower($convertor_data['forum_name'])] = sizeof($convertors);
$sort[strtolower($convertor_data['forum_name'])] = count($convertors);
$convertors[] = array(
'tag' => $m[1],

View File

@@ -312,9 +312,9 @@ class convertor
}
}
if (sizeof($bad_folders))
if (count($bad_folders))
{
$msg = (sizeof($bad_folders) == 1) ? $user->lang['MAKE_FOLDER_WRITABLE'] : $user->lang['MAKE_FOLDERS_WRITABLE'];
$msg = (count($bad_folders) == 1) ? $user->lang['MAKE_FOLDER_WRITABLE'] : $user->lang['MAKE_FOLDERS_WRITABLE'];
sort($bad_folders);
$this->error(sprintf($msg, implode('<br />', $bad_folders)), __LINE__, __FILE__, true);
@@ -371,7 +371,7 @@ class convertor
$val = array($val);
}
for ($j = 0, $size = sizeof($val); $j < $size; ++$j)
for ($j = 0, $size = count($val); $j < $size; ++$j)
{
if (preg_match('/LEFT JOIN ([a-z0-9_]+) AS ([a-z0-9_]+)/i', $val[$j], $m))
{
@@ -412,11 +412,11 @@ class convertor
// Throw an error if some tables are missing
// We used to do some guessing here, but since we have a suggestion of possible values earlier, I don't see it adding anything here to do it again
if (sizeof($missing_tables) == sizeof($tables_list))
if (count($missing_tables) == count($tables_list))
{
$this->error($user->lang['NO_TABLES_FOUND'] . ' ' . $user->lang['CHECK_TABLE_PREFIX'], __LINE__, __FILE__);
}
else if (sizeof($missing_tables))
else if (count($missing_tables))
{
$this->error(sprintf($user->lang['TABLES_MISSING'], implode($user->lang['COMMA_SEPARATOR'], $missing_tables)) . '<br /><br />' . $user->lang['CHECK_TABLE_PREFIX'], __LINE__, __FILE__);
}
@@ -514,7 +514,7 @@ class convertor
));
// This loop takes one target table and processes it
while ($current_table < sizeof($convert->convertor['schema']))
while ($current_table < count($convert->convertor['schema']))
{
$schema = $convert->convertor['schema'][$current_table];
@@ -753,7 +753,7 @@ class convertor
case 'mysqli':
$waiting_rows[] = '(' . implode(', ', $insert_values) . ')';
if (sizeof($waiting_rows) >= $convert->num_wait_rows)
if (count($waiting_rows) >= $convert->num_wait_rows)
{
$errored = false;
@@ -809,7 +809,7 @@ class convertor
$src_db->sql_freeresult($___result);
// We might still have some rows waiting
if (sizeof($waiting_rows))
if (count($waiting_rows))
{
$errored = false;
$db->sql_return_on_error(true);
@@ -888,7 +888,7 @@ class convertor
$current_table++;
// $percentage = ($skip_rows == 0) ? 0 : floor(100 / ($total_rows / $skip_rows));
$msg = sprintf($user->lang['STEP_PERCENT_COMPLETED'], $current_table, sizeof($convert->convertor['schema']));
$msg = sprintf($user->lang['STEP_PERCENT_COMPLETED'], $current_table, count($convert->convertor['schema']));
$this->template->assign_vars(array(
'BODY' => $msg,
@@ -1126,7 +1126,7 @@ class convertor
}
else
{
while ($last_statement < sizeof($convert->convertor['execute_last']))
while ($last_statement < count($convert->convertor['execute_last']))
{
// @codingStandardsIgnoreStart
eval($convert->convertor['execute_last'][$last_statement]);
@@ -1140,8 +1140,8 @@ class convertor
$last_statement++;
$url = $this->save_convert_progress($converter, 'jump=1&amp;last=' . $last_statement);
$percentage = ($last_statement == 0) ? 0 : floor(100 / (sizeof($convert->convertor['execute_last']) / $last_statement));
$msg = sprintf($user->lang['STEP_PERCENT_COMPLETED'], $last_statement, sizeof($convert->convertor['execute_last']), $percentage);
$percentage = ($last_statement == 0) ? 0 : floor(100 / (count($convert->convertor['execute_last']) / $last_statement));
$msg = sprintf($user->lang['STEP_PERCENT_COMPLETED'], $last_statement, count($convert->convertor['execute_last']), $percentage);
$this->template->assign_vars(array(
'L_SUBMIT' => $user->lang['CONTINUE_LAST'],

View File

@@ -1071,7 +1071,7 @@ function phpbb_convert_authentication($mode)
}
}
if (sizeof($forum_ids))
if (count($forum_ids))
{
// Now make sure the user is able to read these forums
$hold_ary = $auth->acl_group_raw_data(false, 'f_list', $forum_ids);
@@ -1267,7 +1267,7 @@ function phpbb_prepare_message($message)
// parse($allow_bbcode, $allow_magic_url, $allow_smilies, $allow_img_bbcode = true, $allow_flash_bbcode = true, $allow_quote_bbcode = true, $allow_url_bbcode = true, $update_this_message = true, $mode = 'post')
$message_parser->parse($enable_bbcode, $enable_magic_url, $enable_smilies);
if (sizeof($message_parser->warn_msg))
if (count($message_parser->warn_msg))
{
$msg_id = isset($convert->row['post_id']) ? $convert->row['post_id'] : $convert->row['privmsgs_id'];
$convert->p_master->error('<span style="color:red">' . $user->lang['POST_ID'] . ': ' . $msg_id . ' ' . $user->lang['CONV_ERROR_MESSAGE_PARSER'] . ': <br /><br />' . implode('<br />', $message_parser->warn_msg), __LINE__, __FILE__, true);
@@ -1495,7 +1495,7 @@ function phpbb_attachment_forum_perms($forum_permissions)
$forum_ids[] = (int) $forum_id;
}
if (sizeof($forum_ids))
if (count($forum_ids))
{
return attachment_forum_perms($forum_ids);
}
@@ -1860,7 +1860,7 @@ function phpbb_check_username_collisions()
$db->sql_freeresult($result);
// there was at least one collision, the admin will have to solve it before conversion can continue
if (sizeof($colliding_names))
if (count($colliding_names))
{
$sql = 'SELECT user_id, username_clean
FROM ' . USERCONV_TABLE . '