Permalink
Browse files

istroll_max_halflives: limit how far the impact of down/upmods "decays"

over time.
  • Loading branch information...
jamiemccarthy committed Feb 3, 2004
1 parent e902a07 commit cd27ae839bfd86da0de135dd156f5fa3a9db9610
Showing with 10 additions and 3 deletions.
  1. +7 −3 Slash/DB/MySQL/MySQL.pm
  2. +1 −0 sql/mysql/defaults.sql
  3. +2 −0 sql/mysql/upgrades
View
@@ -5890,17 +5890,21 @@ sub calcModval {
"GROUP BY hoursback",
);
my $max_halflives = $constants->{istroll_max_halflives};
my $modval = 0;
for my $hoursback (keys %$hr) {
my $val = $hr->{$hoursback}{valsum};
next unless $val;
if ($hoursback <= $halflife) {
$modval += $val;
} elsif ($hoursback > $halflife*10) {
# So old it's not worth looking at.
} else {
} elsif ($hoursback <= $halflife*$max_halflives) {
# Logarithmically weighted.
$modval += $val / (2 ** ($hoursback/$halflife));
} elsif ($hoursback > $halflife*12) {
# So old it's not worth looking at.
} else {
# Half-lives, half-lived...
$modval += $val / (2 ** $max_halflives);
}
}
View
@@ -740,6 +740,7 @@ INSERT INTO vars (name, value, description) VALUES ('index_noanon','0','Redirect
INSERT INTO vars (name, value, description) VALUES ('istroll_downmods_ip','4','Downmods at which an IP is considered a troll');
INSERT INTO vars (name, value, description) VALUES ('istroll_downmods_subnet','6','Downmods at which a subnet is considered a troll');
INSERT INTO vars (name, value, description) VALUES ('istroll_downmods_user','4','Downmods at which a user is considered a troll');
INSERT INTO vars (name, value, description) VALUES ('istroll_max_halflives', '3', 'Max number of times to cut the TrollModval impact of a downmod in half');
INSERT INTO vars (name, value, description) VALUES ('istroll_ipid_hours','72','Hours back that getIsTroll checks IPs for comment mods');
INSERT INTO vars (name, value, description) VALUES ('istroll_uid_hours','72','Hours back that getIsTroll checks uids for comment mods');
INSERT INTO vars (name, value, description) VALUES ('karma_adj','-10=Terrible|-1=Bad|0=Neutral|12=Positive|25=Good|99999=Excellent','Adjectives that describe karma, used if karma_obfuscate is set (best to keep aligned with badkarma, m2_maxbonus_karma, and goodkarma)');
View
@@ -2086,3 +2086,5 @@ ALTER TABLE users_info ADD INDEX initdomain (initdomain), ADD INDEX created_ipid
# (replace virtusername with your DBIx::Password user):
# perl -MSlash::Test=virtusername -e 'my $arr = $reader_db->sqlSelectAll("uid, realemail", "users"); for my $ar (@$arr) { next unless $ar->[1]; $d=fullhost_to_domain($ar->[1]); push @{$du{$d}}, $ar->[0] } undef $arr; while (($k, $v) = each %du) { $in = join(",", @$v); $slashdb->sqlUpdate("users_info", { initdomain => $k }, "uid IN ($in)"); sleep(0.1) if scalar(@$v) > 100 }'
INSERT INTO vars (name, value, description) VALUES ('istroll_max_halflives', '3', 'Max number of times to cut the TrollModval impact of a downmod in half');

0 comments on commit cd27ae8

Please sign in to comment.