]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Misc.pl
- irctextcounters: add percentage to top3
[infobot.git] / src / Misc.pl
index 6264b00b872453ce9995d17fa4e38c1694f4b716..ffc6fb6467a5f19784abed4c9969873d57b82998 100644 (file)
@@ -453,7 +453,7 @@ sub isStale {
     return 1 unless ( -f $file);
     if ($file =~ /idx/) {
        my $age2 = time() - (stat($file))[9];
-       &DEBUG("stale: $age2. (". &Time2String($age2) .")");
+       &VERB("stale: $age2. (". &Time2String($age2) .")",2);
     }
     $age *= 60*60*24 if ($age >= 0 and $age < 30);
 
@@ -699,4 +699,19 @@ sub mkcrypt {
     return crypt($str, $salt);
 }
 
+sub closeStats {
+    return unless (&getChanConfList("ircTextCounters"));
+
+    foreach (keys %cmdstats) {
+       my $type        = $_;
+       my $i = &dbGet("stats", "counter", "nick=".&dbQuote($type).
+                       " AND type='cmdstats'");
+       $i      += $cmdstats{$type};
+
+       &dbReplace("stats",
+               (nick => $type, type => "cmdstats", counter => $i)
+       );
+    }
+}
+
 1;