Skip to content

Commit

Permalink
[feature/prune-users] Use a map instead of performing array scans.
Browse files Browse the repository at this point in the history
PHPBB3-9622
  • Loading branch information
p committed Apr 20, 2012
1 parent 138d2e2 commit 7c752aa
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions phpBB/includes/functions_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -614,9 +614,11 @@ function user_delete($mode, $user_ids, $retain_username = true)
WHERE ' . $author_id_sql;
$db->sql_query($sql);

$user_ids_map = array_flip($user_ids);

foreach ($undelivered_user as $_user_id => $ary)
{
if (in_array($_user_id, $user_ids))
if (isset($user_ids_map[$_user_id]))
{
continue;
}
Expand All @@ -631,7 +633,7 @@ function user_delete($mode, $user_ids, $retain_username = true)
$db->sql_transaction('commit');

// Reset newest user info if appropriate
if (in_array($config['newest_user_id'], $user_ids))
if (isset($user_ids_map[$config['newest_user_id']]))
{
update_last_username();
}
Expand Down

0 comments on commit 7c752aa

Please sign in to comment.