Skip to content

Commit 126bf31

Browse files
authored
Merge pull request #6127 from BOINC/dpa_spam4
delete_spammers.php: fix --forums option
2 parents eb1561b + 054f17b commit 126bf31

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

html/ops/delete_spammers.php

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,12 @@
8888
// --forums
8989
// delete accounts that
9090
// - have no hosts
91-
// - have message-board posts
92-
// - don't belong to a team (to avoid deleting BOINC-wide team owners)
93-
// Use this for spammers who create accounts and post spam
91+
// - have message-board posts containing links or URLs
92+
// - don't belong to a team (avoid deleting BOINC-wide team owners)
93+
// Use this for spammers who create accounts and post spam.
94+
// Don't use this for non-computing projects (like BOINC message boards).
95+
// In fact, don't use this in general:
96+
// it will delete users who join to participate in forums.
9497
//
9598
// --profiles_strict
9699
// delete accounts that have a profile and no message-board posts.
@@ -177,8 +180,17 @@ function has_link($x) {
177180
return false;
178181
}
179182

183+
// delete users with
184+
// - no hosts
185+
// - no team
186+
// - posts contain links and/or URLs
187+
//
180188
function delete_forums() {
181189
global $min_days, $max_days;
190+
191+
// if they've posted, they'll have forum prefs.
192+
// This is faster than enumerating all users
193+
//
182194
$prefs = BoincForumPrefs::enum("posts>0");
183195
$n = 0;
184196
foreach ($prefs as $p) {
@@ -198,6 +210,9 @@ function delete_forums() {
198210
}
199211
$h = BoincHost::count("userid=$p->userid");
200212
if ($h) continue;
213+
214+
$n = BoincPost::count("user=$user->id and (content like '%<a %' or content like '%[url%' or content like '%http://%' or content like '%https://%')");
215+
if (!$n) continue;
201216
do_delete_user($user);
202217
$n++;
203218
}

0 commit comments

Comments
 (0)