return if ($_[0] eq "2"); # defer.
}
- if (&ChanConfList("news")) {
- } else {
+ if (!&ChanConfList("news")) {
&DEBUG("newsFlush: news disabled? (chan => $chan)");
return;
}
my $i = 0;
my $total = scalar(keys %{ $::news{$chan} });
- &DEBUG("newsFlush: chan => $chan (total => $total)");
+ if (!$total) {
+ delete $::news{$chan};
+ next;
+ }
foreach $item (keys %{ $::news{$chan} }) {
my $t = $::news{$chan}{$item}{Expire};
$i++;
}
- &status("NEWS (newsflush) {$chan}: deleted [$i/$total] news entries.");
+ &status("NEWS (newsflush) {$chan}: deleted [$i/$total] news entries.") if ($i);
$none{$chan} = 1 if ($total == $i);
}
return if ($_[0] eq "2");
}
- $cache{chanlimitCheck}++;
- &DEBUG("clC: chanlimitCheck => $cache{chanlimitCheck}");
-
foreach $chan ( &ChanConfList("chanlimitcheck") ) {
next unless (&validChan($chan));
if (scalar keys %netsplitservers) {
if (defined $limit) {
- &DEBUG("chanlimit: removing it for $chan.");
+ &status("chanlimit: netsplit; removing it for $chan.");
&rawout("MODE $chan -l");
$cache{chanlimitChange}{$chan} = time();
}
delete $cache{warn}{chanlimit}{$chan};
if (!defined $limit) {
- &status("ChanLimit: setting for first time or from netsplit, for $chan");
+ &status("chanLimit: setting for first time or from netsplit, for $chan");
}
if (exists $cache{chanlimitChange}{$chan}) {
my $delta = time() - $cache{chanlimitChange}{$chan};
if ($delta < $interval*60) {
- &DEBUG("not going to change chanlimit! ($delta<$interval*60)");
+ &DEBUG("chanLimit: not going to change chanlimit! ($delta<$interval*60)");
return;
}
}
&DEBUG("running netsplitCheck... $cache{netsplitCache}");
if (!scalar %netsplit and scalar %netsplitservers) {
- &DEBUG("nsc: FIRST!!! ok hash netsplit is NULL; purging hash netsplitservers");
+ &DEBUG("nsC: !hash netsplit but hash netsplitservers <- removing!");
undef %netsplitservers;
+ return;
}
+ # well... this shouldn't happen since %netsplit code does it anyway.
foreach $s1 (keys %netsplitservers) {
foreach $s2 (keys %{ $netsplitservers{$s1} }) {
my $delta = time() - $netsplitservers{$s1}{$s2};
- if ($delta > 3600) {
+ if ($delta > 60*30) {
&status("netsplit between $s1 and $s2 appears to be stale.");
delete $netsplitservers{$s1}{$s2};
&chanlimitCheck();
# %netsplit hash checker.
my $count = scalar keys %netsplit;
- my(@delete);
+ my $delete = 0;
foreach (keys %netsplit) {
- if (&IsNickInAnyChan($_)) {
- &DEBUG("netsplitC: $_ is in some chan; removing from netsplit list.");
+ if (&IsNickInAnyChan($_)) { # why would this happen?
+# &DEBUG("nsC: $_ is in some chan; removing from netsplit list.");
delete $netsplit{$_};
+ $delete++;
next;
}
- # todo: change time value?
- next unless (time() - $netsplit{$_} > 60*30);
- push(@delete, $_);
+ next unless (time() - $netsplit{$_} > 60*15);
+
+ $delete++;
delete $netsplit{$_};
}
- &DEBUG("removed from netsplit list (".scalar(@delete)."): @delete") if (@delete);
- &DEBUG("nsC: netsplitservers: ".scalar(keys %netsplitservers) );
- &DEBUG("nsC: netsplit: ".scalar(keys %netsplit) );
+ if ($delete) {
+ my $j = scalar(keys %netsplit);
+ &DEBUG("nsC: removed from netsplit list: (before: $count; after: $j)");
+ }
if (!scalar %netsplit and scalar %netsplitservers) {
- &DEBUG("nsc: ok hash netsplit is NULL; purging hash netsplitservers");
+ &DEBUG("nsC: ok hash netsplit is NULL; purging hash netsplitservers");
undef %netsplitservers;
}
}
my @list = &searchTable("factoids", "factoid_key", "factoid_key", " #DEL#");
- my $stale = &getChanConfDefault("factoidDeleteDelay", 30) *60*60*24;
+ my $stale = &getChanConfDefault("factoidDeleteDelay", 14) *60*60*24;
if ($stale < 1) {
# disable it since it's "illegal".
return;
}
- &DEBUG("stale => $stale");
my $time = time();
foreach (@list) {
my $age = &getFactInfo($_, "modified_time");
- &DEBUG("fC: _ => '$_'; age => $age");
if (!defined $age or $age !~ /^\d+$/) {
if (scalar @list > 50) {
next;
}
- &DEBUG("del factoid: delta => ".($time - $age) );
- &DEBUG("del factoid: stale => $stale");
next unless ($time - $age > $stale);
my $fix = $_;
$fix =~ s/ #DEL#$//g;
my $agestr = &Time2String($time - $age);
- &DEBUG("safedel: Removing '$_' for good. [$agestr old]");
-
- last;
+ &status("safedel: Removing '$_' for good. [$agestr old]");
&delFactoid($_);
}
my $backup = 0;
if (! -f $file) {
- &WARN("mkB: file '$file' does not exist.");
+ &VERB("mkB: file '$file' does not exist.",2);
return;
}
+ my $age = "New";
if ( -e "$file~" ) {
- $backup++ if ((stat $file)[9] - (stat "$file~")[9] > $time);
+ $backup++ if ((stat $file)[9] - (stat "$file~")[9] > $time);
+ my $delta = time() - (stat "$file~")[9];
+ $age = &Time2String($delta);
} else {
$backup++;
}
- return unless ($backup);
- # should delta be time(file) - time(file~)?
- my $delta = time() - (stat "$file~")[9];
- my $age = &Time2String($delta);
+ return unless ($backup);
### TODO: do internal copying.
&status("Backup: $file ($age)");