aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/acp/acp_prune.php
diff options
context:
space:
mode:
authorCesar G <prototech91@gmail.com>2013-11-27 20:59:45 -0800
committerCesar G <prototech91@gmail.com>2013-11-27 21:26:22 -0800
commitef2e5ca9669cabbb0153b4855ed19403a6079536 (patch)
treee6825f5b1743a954bec3765d4627f59de5343907 /phpBB/includes/acp/acp_prune.php
parentc5656747d8e4e6838f9549000642886df6014755 (diff)
downloadforums-ef2e5ca9669cabbb0153b4855ed19403a6079536.tar
forums-ef2e5ca9669cabbb0153b4855ed19403a6079536.tar.gz
forums-ef2e5ca9669cabbb0153b4855ed19403a6079536.tar.bz2
forums-ef2e5ca9669cabbb0153b4855ed19403a6079536.tar.xz
forums-ef2e5ca9669cabbb0153b4855ed19403a6079536.zip
[ticket/11507] Allow group & unapproved post count options to be used alone.
PHPBB3-11507
Diffstat (limited to 'phpBB/includes/acp/acp_prune.php')
-rw-r--r--phpBB/includes/acp/acp_prune.php58
1 files changed, 37 insertions, 21 deletions
diff --git a/phpBB/includes/acp/acp_prune.php b/phpBB/includes/acp/acp_prune.php
index 5d8d0a9dbc..6860fa220d 100644
--- a/phpBB/includes/acp/acp_prune.php
+++ b/phpBB/includes/acp/acp_prune.php
@@ -450,8 +450,8 @@ class acp_prune
}
}
- // Protect the admin, do not prune if no options are given...
- if (!$where_sql)
+ // If no search criteria were provided, go no further.
+ if (!$where_sql && !$group_id && $posts_on_queue === false)
{
return;
}
@@ -468,32 +468,38 @@ class acp_prune
}
$db->sql_freeresult($result);
- // Do not prune founder members
- $sql = 'SELECT user_id, username
- FROM ' . USERS_TABLE . '
- WHERE user_id <> ' . ANONYMOUS . '
- AND user_type <> ' . USER_FOUNDER . "
- $where_sql";
- $result = $db->sql_query($sql);
+ // Protect the admin, do not prune if no options are given...
+ if ($where_sql)
+ {
+ // Do not prune founder members
+ $sql = 'SELECT user_id, username
+ FROM ' . USERS_TABLE . '
+ WHERE user_id <> ' . ANONYMOUS . '
+ AND user_type <> ' . USER_FOUNDER . "
+ $where_sql";
+ $result = $db->sql_query($sql);
- $user_ids = $usernames = array();
+ $user_ids = $usernames = array();
- while ($row = $db->sql_fetchrow($result))
- {
- // Do not prune bots and the user currently pruning.
- if ($row['user_id'] != $user->data['user_id'] && !in_array($row['user_id'], $bot_ids))
+ while ($row = $db->sql_fetchrow($result))
{
- $user_ids[] = $row['user_id'];
- $usernames[$row['user_id']] = $row['username'];
+ // Do not prune bots and the user currently pruning.
+ if ($row['user_id'] != $user->data['user_id'] && !in_array($row['user_id'], $bot_ids))
+ {
+ $user_ids[] = $row['user_id'];
+ $usernames[$row['user_id']] = $row['username'];
+ }
}
+ $db->sql_freeresult($result);
}
- $db->sql_freeresult($result);
if ($group_id)
{
$sql = 'SELECT u.user_id, u.username
FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . ' u
WHERE ug.group_id = ' . (int) $group_id . '
+ AND ug.user_id <> ' . ANONYMOUS . '
+ AND u.user_type <> ' . USER_FOUNDER . '
AND ug.user_pending = 0
AND ' . $db->sql_in_set('ug.user_id', $user_ids, false, true) . '
AND u.user_id = ug.user_id';
@@ -505,8 +511,12 @@ class acp_prune
$user_ids = $usernames = array();
while ($row = $db->sql_fetchrow($result))
{
- $user_ids[] = $row['user_id'];
- $usernames[$row['user_id']] = $row['username'];
+ // Do not prune bots and the user currently pruning.
+ if ($row['user_id'] != $user->data['user_id'] && !in_array($row['user_id'], $bot_ids))
+ {
+ $user_ids[] = $row['user_id'];
+ $usernames[$row['user_id']] = $row['username'];
+ }
}
$db->sql_freeresult($result);
}
@@ -516,6 +526,8 @@ class acp_prune
$sql = 'SELECT u.user_id, u.username, COUNT(p.post_id) AS queue_posts
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
WHERE ' . $db->sql_in_set('p.poster_id', $user_ids, false, true) . '
+ AND u.user_id <> ' . ANONYMOUS . '
+ AND u.user_type <> ' . USER_FOUNDER . '
AND p.post_visibility = ' . ITEM_UNAPPROVED . '
AND u.user_id = p.poster_id
GROUP BY p.poster_id
@@ -526,8 +538,12 @@ class acp_prune
$user_ids = $usernames = array();
while ($row = $db->sql_fetchrow($result))
{
- $user_ids[] = $row['user_id'];
- $usernames[$row['user_id']] = $row['username'];
+ // Do not prune bots and the user currently pruning.
+ if ($row['user_id'] != $user->data['user_id'] && !in_array($row['user_id'], $bot_ids))
+ {
+ $user_ids[] = $row['user_id'];
+ $usernames[$row['user_id']] = $row['username'];
+ }
}
$db->sql_freeresult($result);
}