aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2011-05-08 13:16:15 -0400
committerOleg Pudeyev <oleg@bsdpower.com>2011-05-08 13:16:15 -0400
commitf65556e6defb2750fcf680bd29e56f2416176fe1 (patch)
treed66147a641caeb9b08cfca1c983b6c14f46a717e
parent0f17d5d493738b832f4d9d010e94d4d7fa113c89 (diff)
downloadforums-f65556e6defb2750fcf680bd29e56f2416176fe1.tar
forums-f65556e6defb2750fcf680bd29e56f2416176fe1.tar.gz
forums-f65556e6defb2750fcf680bd29e56f2416176fe1.tar.bz2
forums-f65556e6defb2750fcf680bd29e56f2416176fe1.tar.xz
forums-f65556e6defb2750fcf680bd29e56f2416176fe1.zip
[feature/prune-users] Call sql_is_set once for author ids in user_delete.
PHPBB3-9622
-rw-r--r--phpBB/includes/functions_user.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index b21be08307..3926de2b12 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -537,6 +537,8 @@ function user_delete($mode, $user_ids, $retain_username = true)
$cache->destroy('sql', MODERATOR_CACHE_TABLE);
+ $author_id_sql = $db->sql_in_set('author_id', $user_ids);
+
// Delete user log entries about this user
$sql = 'DELETE FROM ' . LOG_TABLE . '
WHERE ' . $user_id_sql; //reportee_id = ' . $user_id;
@@ -567,7 +569,7 @@ function user_delete($mode, $user_ids, $retain_username = true)
// Remove any undelivered mails...
$sql = 'SELECT msg_id, user_id
FROM ' . PRIVMSGS_TO_TABLE . '
- WHERE ' . $db->sql_in_set('author_id', $user_ids) . '
+ WHERE ' . $author_id_sql . '
AND folder_id = ' . PRIVMSGS_NO_BOX;
$result = $db->sql_query($sql);
@@ -587,7 +589,7 @@ function user_delete($mode, $user_ids, $retain_username = true)
}
$sql = 'DELETE FROM ' . PRIVMSGS_TO_TABLE . '
- WHERE ' . $db->sql_in_set('author_id', $user_ids) . '
+ WHERE ' . $author_id_sql . '
AND folder_id = ' . PRIVMSGS_NO_BOX;
$db->sql_query($sql);
@@ -599,12 +601,12 @@ function user_delete($mode, $user_ids, $retain_username = true)
// Set the remaining author id to anonymous - this way users are still able to read messages from users being removed
$sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . '
SET author_id = ' . ANONYMOUS . '
- WHERE ' . $db->sql_in_set('author_id', $user_ids);
+ WHERE ' . $author_id_sql;
$db->sql_query($sql);
$sql = 'UPDATE ' . PRIVMSGS_TABLE . '
SET author_id = ' . ANONYMOUS . '
- WHERE ' . $db->sql_in_set('author_id', $user_ids);
+ WHERE ' . $author_id_sql;
$db->sql_query($sql);
foreach ($undelivered_user as $_user_id => $ary)