}
# update stats.
- if (0) { # old.
- my $count = &getFactInfo($q, "requested_count") || 0;
- $count++;
- &setFactInfo($q, "requested_by", $nuh);
- &setFactInfo($q, "requested_time", time());
- &setFactInfo($q, "requested_count", $count);
- } else {
- &sqlUpdate("factoids", { factoid_key => $q }, {
- requested_by => $nuh,
- requested_time => time(),
- -requested_count => "requested_count+1",
- } );
- }
+ &sqlUpdate("factoids", { factoid_key => $q }, {
+ requested_by => $nuh,
+ requested_time => time(),
+ -requested_count => "requested_count+1",
+ } );
# end of update stats.
next unless (defined $t);
next unless ($time - $t > 10);
- my %hash = (
- nick => $who,
- type => $x,
+ &sqlReplace("stats", {
+ nick => $who,
+ type => $x,
channel => $c,
-
time => $time,
counter => $v,
- );
-
- if (0) {
- &sqlReplace("stats", \%hash);
- } else {
- &sqlReplace("stats", {
- nick => $who,
- type => $x,
- -counter => "counter+1",
- } );
- }
+ } );
}
}
$i += $cmdstats{$type};
- my %hash = (
- nick => $type,
- type => "cmdstats",
- counter => $i
- );
- $hash{time} = time() if ($z);
-
- if (0) {
- &sqlReplace("stats", %hash);
- } else {
- &sqlReplace("stats", {
- nick => $type,
- type => "cmdstats",
- -counter => "counter+1",
- } );
- }
+
+ &sqlReplace("stats", {
+ nick => $type,
+ type => "cmdstats",
+ 'time' => time(),
+ counter => $i,
+ } );
}
}
$karma--;
}
- &sqlSet("stats",
- { nick => $term, type => "karma" }, # WHERE
-# { counter => $karma } # WHAT
- { -counter => "counter+1" }
- );
+ &sqlReplace("stats", {
+ nick => $term,
+ type => "karma",
+ 'time' => time(),
+ counter => $karma,
+ } );
return;
}