From: Thomas Hochstein Date: Mon, 2 Sep 2013 04:46:40 +0000 (+0200) Subject: Merge branch 'gatherstats' into next X-Git-Tag: 0.01~1^2~7 X-Git-Url: https://code.th-h.de/?p=usenet%2Fnewsstats.git;a=commitdiff_plain;h=cce2fd0b7f1e3c90d9b521ba3f4977b86eb3db7b;hp=1c3adb8de25bb4f3fb75129990890e55e8829ac5 Merge branch 'gatherstats' into next * gatherstats: Get empty 'virtual' hierarchies working. --- diff --git a/NewsStats.pm b/NewsStats.pm index 428719e..bfcb37b 100644 --- a/NewsStats.pm +++ b/NewsStats.pm @@ -33,6 +33,7 @@ require Exporter; SplitPeriod ListMonth ListNewsgroups + ParseHierarchies ReadGroupList OutputData FormatOutput diff --git a/gatherstats.pl b/gatherstats.pl index ae7d65d..4c539f1 100755 --- a/gatherstats.pl +++ b/gatherstats.pl @@ -19,7 +19,7 @@ BEGIN { } use strict; -use NewsStats qw(:DEFAULT :TimePeriods ListNewsgroups ReadGroupList); +use NewsStats qw(:DEFAULT :TimePeriods ListNewsgroups ParseHierarchies ReadGroupList); use DBI; use Getopt::Long qw(GetOptions); @@ -145,13 +145,15 @@ foreach my $Month (&ListMonth($Period)) { if (%ValidGroups) { foreach (sort keys %ValidGroups) { if (!defined($Postings{$_})) { - # expand newsgroup with hierarchies - my @Newsgroups = ParseHierarchies($_); - # add each empty newsgroup and empty hierarchies, too, as needed - foreach (@Newsgroups) { - if (!defined($Postings{$_})) { - $Postings{$_} = 0; - warn (sprintf("ADDED: %s as empty group\n",$_)); + # add current newsgroup as empty group + $Postings{$_} = 0; + warn (sprintf("ADDED: %s as empty group\n",$_)); + # add empty hierarchies for current newsgroup as needed + foreach (ParseHierarchies($_)) { + my $Hierarchy = $_ . '.ALL'; + if (!defined($Postings{$Hierarchy})) { + $Postings{$Hierarchy} = 0; + warn (sprintf("ADDED: %s as empty group\n",$Hierarchy)); }; }; }