foreach my $id (keys %affected) {
SendSQL("select sum(count) from votes where bug_id = $id");
my $v = FetchOneColumn();
- SendSQL("update bugs set votes = $v where bug_id = $id");
+ SendSQL("update bugs set votes = $v, delta_ts=delta_ts where bug_id = $id");
}
SendSQL("unlock tables");
close SENDMAIL;
}
SendSQL("delete from votes where bug_id = $id");
- SendSQL("update bugs set votes = 0 where bug_id = $id");
+ SendSQL("update bugs set votes = 0, delta_ts=delta_ts where bug_id = $id");
}
}
if (exists $::FORM{'rebuildvotecache'}) {
Status("OK, now rebuilding vote cache.");
SendSQL("lock tables bugs write, votes read");
- SendSQL("update bugs set votes = 0");
+ SendSQL("update bugs set votes = 0, delta_ts=delta_ts");
SendSQL("select bug_id, sum(count) from votes group by bug_id");
my %votes;
while (@row = FetchSQLData()) {
$votes{$id} = $v;
}
foreach my $id (keys %votes) {
- SendSQL("update bugs set votes = $votes{$id} where bug_id = $id");
+ SendSQL("update bugs set votes = $votes{$id}, delta_ts=delta_ts where bug_id = $id");
}
SendSQL("unlock tables");
- Status("Vote cache has been rebuild.");
+ Status("Vote cache has been rebuilt.");
}
print "OK, now running sanity checks.<P>\n";