Get empty 'virtual' hierarchies working.
Commit b5125b1099
was broken.
We didn't add empty .ALL hierarchies as needed;
we added empty (non-existant) hierarchies without
appended '.ALL', and didn't add the original
empty group we started with.
(What's more, gatherstats didn't even start any
more due to missing ex- and import of
&ParseHierarchies from NewsStats.pm.)
Fixes #52 (and some more breakage).
Signed-off-by: Thomas Hochstein <thh@inter.net>
This commit is contained in:
parent
b5125b1099
commit
1703b8e3b4
|
@ -33,6 +33,7 @@ require Exporter;
|
||||||
SplitPeriod
|
SplitPeriod
|
||||||
ListMonth
|
ListMonth
|
||||||
ListNewsgroups
|
ListNewsgroups
|
||||||
|
ParseHierarchies
|
||||||
ReadGroupList
|
ReadGroupList
|
||||||
OutputData
|
OutputData
|
||||||
FormatOutput
|
FormatOutput
|
||||||
|
|
|
@ -19,7 +19,7 @@ BEGIN {
|
||||||
}
|
}
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
use NewsStats qw(:DEFAULT :TimePeriods ListNewsgroups ReadGroupList);
|
use NewsStats qw(:DEFAULT :TimePeriods ListNewsgroups ParseHierarchies ReadGroupList);
|
||||||
|
|
||||||
use DBI;
|
use DBI;
|
||||||
use Getopt::Long qw(GetOptions);
|
use Getopt::Long qw(GetOptions);
|
||||||
|
@ -145,13 +145,15 @@ foreach my $Month (&ListMonth($Period)) {
|
||||||
if (%ValidGroups) {
|
if (%ValidGroups) {
|
||||||
foreach (sort keys %ValidGroups) {
|
foreach (sort keys %ValidGroups) {
|
||||||
if (!defined($Postings{$_})) {
|
if (!defined($Postings{$_})) {
|
||||||
# expand newsgroup with hierarchies
|
# add current newsgroup as empty group
|
||||||
my @Newsgroups = ParseHierarchies($_);
|
|
||||||
# add each empty newsgroup and empty hierarchies, too, as needed
|
|
||||||
foreach (@Newsgroups) {
|
|
||||||
if (!defined($Postings{$_})) {
|
|
||||||
$Postings{$_} = 0;
|
$Postings{$_} = 0;
|
||||||
warn (sprintf("ADDED: %s as empty group\n",$_));
|
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));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue