Updates to silencespammer from production

This commit is contained in:
Evan Prodromou 2013-02-13 10:00:47 -05:00
parent 0362ba7e32
commit bcba3e68a3

View File

@ -66,11 +66,17 @@ function silencespammer($filter, $user, $minimum, $percent) {
$profile = Profile::staticGet('id', $user->id); $profile = Profile::staticGet('id', $user->id);
if ($profile->isSilenced()) {
printfnq("Already silenced %s\n", $user->nickname);
return;
}
$cnt = $profile->noticeCount(); $cnt = $profile->noticeCount();
if ($cnt < $minimum) { if ($cnt < $minimum) {
printfnq("Only %d notices posted (minimum %d); skipping\n", $cnt, $minimum); printfnq("Only %d notices posted (minimum %d); skipping\n", $cnt, $minimum);
} return;
}
$ss = new Spam_score(); $ss = new Spam_score();
@ -85,7 +91,7 @@ function silencespammer($filter, $user, $minimum, $percent) {
$spam_percent = ($spam_count * 100 / $cnt); $spam_percent = ($spam_count * 100 / $cnt);
if ($spam_percent > $percent) { if ($spam_percent > $percent) {
printfnq("Silencing user %d (%0.2f%% spam)\n", $user->nickname, $spam_percent); printfnq("Silencing user %s (%0.2f%% spam)\n", $user->nickname, $spam_percent);
try { try {
$profile->silence(); $profile->silence();
} catch(Exception $e) { } catch(Exception $e) {