Преглед изворни кода

* Continue after empty directories were found (closes SF tracker #1184874 by nandmaster).
* Latest topic was sometimes set -1 days ago (reported by Jarkko Seppelin).

Christoph Berg пре 21 година
родитељ
комит
d14a3c471d
2 измењених фајлова са 11 додато и 4 уклоњено
  1. 3 0
      docs/Changelog
  2. 8 4
      modules/Pisg/Parser/Logfile.pm

+ 3 - 0
docs/Changelog

@@ -12,6 +12,9 @@ pisg (0.66) - ??
      nandmaster).
    * Update supy.pm for new log format (thanks to James Vega for the patch).
    * Add bxlog script supplied by Hannes Tarien.
+   * Continue after empty directories were found (closes SF tracker #1184874
+     by nandmaster).
+   * Latest topic was sometimes set -1 days ago (reported by Jarkko Seppelin).
 
 pisg (0.65) - Fri Apr, 15th 2005
    Christoph:

+ 8 - 4
modules/Pisg/Parser/Logfile.pm

@@ -122,6 +122,8 @@ sub analyze
         monocount  => 0,
         day_lines => [ undef ],
         day_times => [ undef ],
+        parsedlines => 0,
+        totallines => 0,
     );
 
     if ($self->{cfg}->{cachedir} and not -d $self->{cfg}->{cachedir}) {
@@ -193,10 +195,12 @@ sub _parse_dir
         my @filesarray;
         opendir(LOGDIR, $logdir) or
         die("Can't opendir ${logdir}: $!");
-        @filesarray = grep {
+        unless(@filesarray = grep {
             /^[^\.]/ && /^$self->{cfg}->{logprefix}/ && -f "$logdir/$_"
-        } readdir(LOGDIR) or
-        die("No files in \"$logdir\" matched prefix \"$self->{cfg}->{logprefix}\"");
+            } readdir(LOGDIR)) {
+                print ("No files in \"$logdir\" matched prefix \"$self->{cfg}->{logprefix}\"\n");
+                return;
+        }
         closedir(LOGDIR);
 
         if ($self->{cfg}->{logsuffix} ne '') {
@@ -853,7 +857,7 @@ sub _merge_stats
             }
         } elsif ($key =~ /^topics$/) { # {key}->[] = topic hash: append
             push @{$stats->{$key}}, map {
-                my %a = %$_; $a{days} += $days_offset; \%a; # make new hash
+                my %a = %$_; $a{days} += $days_offset - 1 + $days_rollover; \%a; # make new hash
             } @{$s->{$key}};
         } elsif ($key =~ /^day_lines$/) { # {key}->[] = int: append
             my @list = @{$s->{day_lines}};