gatherstats.pl: Move TLH check to NewsStats.pm.
Signed-off-by: Thomas Hochstein <thh@inter.net>
This commit is contained in:
parent
ad60979271
commit
89db2f904d
|
@ -156,10 +156,11 @@ sub ListNewsgroups {
|
||||||
### hierarchy names where every newsgroup and hierarchy appears only once:
|
### hierarchy names where every newsgroup and hierarchy appears only once:
|
||||||
### de.alt.test,de.alt.admin -> de.ALL, de.alt.ALL, de.alt.test, de.alt.admin
|
### de.alt.test,de.alt.admin -> de.ALL, de.alt.ALL, de.alt.test, de.alt.admin
|
||||||
### IN : $Newsgroups : a list of newsgroups (content of Newsgroups: header)
|
### IN : $Newsgroups : a list of newsgroups (content of Newsgroups: header)
|
||||||
|
### $TLH : top level hierarchy (all other newsgroups are ignored)
|
||||||
### $ValidGroupsR: reference to a hash containing all valid newsgroups
|
### $ValidGroupsR: reference to a hash containing all valid newsgroups
|
||||||
### as keys
|
### as keys
|
||||||
### OUT: %Newsgroups : hash containing all newsgroup and hierarchy names as keys
|
### OUT: %Newsgroups : hash containing all newsgroup and hierarchy names as keys
|
||||||
my ($Newsgroups,$ValidGroupsR) = @_;
|
my ($Newsgroups,$TLH,$ValidGroupsR) = @_;
|
||||||
my %ValidGroups = %{$ValidGroupsR} if $ValidGroupsR;
|
my %ValidGroups = %{$ValidGroupsR} if $ValidGroupsR;
|
||||||
my %Newsgroups;
|
my %Newsgroups;
|
||||||
chomp($Newsgroups);
|
chomp($Newsgroups);
|
||||||
|
@ -167,6 +168,8 @@ sub ListNewsgroups {
|
||||||
$Newsgroups =~ s/\s//;
|
$Newsgroups =~ s/\s//;
|
||||||
# call &HierarchyCount for each newsgroup in $Newsgroups:
|
# call &HierarchyCount for each newsgroup in $Newsgroups:
|
||||||
for (split /,/, $Newsgroups) {
|
for (split /,/, $Newsgroups) {
|
||||||
|
# don't count newsgroup/hierarchy in wrong TLH
|
||||||
|
next if($TLH and !/^$TLH/);
|
||||||
# don't count invalid newsgroups
|
# don't count invalid newsgroups
|
||||||
if(%ValidGroups and !defined($ValidGroups{$_})) {
|
if(%ValidGroups and !defined($ValidGroups{$_})) {
|
||||||
warn (sprintf("DROPPED: %s\n",$_));
|
warn (sprintf("DROPPED: %s\n",$_));
|
||||||
|
|
|
@ -77,7 +77,7 @@ foreach my $Month (&ListMonth($StartMonth,$EndMonth)) {
|
||||||
my %Postings;
|
my %Postings;
|
||||||
while (($_) = $DBQuery->fetchrow_array) {
|
while (($_) = $DBQuery->fetchrow_array) {
|
||||||
# get list oft newsgroups and hierarchies from Newsgroups:
|
# get list oft newsgroups and hierarchies from Newsgroups:
|
||||||
my %Newsgroups = ListNewsgroups($_,$Options{'l'} ? \%ValidGroups : '');
|
my %Newsgroups = ListNewsgroups($_,$Conf{'TLH'},$Options{'l'} ? \%ValidGroups : '');
|
||||||
# count each newsgroup and hierarchy once
|
# count each newsgroup and hierarchy once
|
||||||
foreach (sort keys %Newsgroups) {
|
foreach (sort keys %Newsgroups) {
|
||||||
$Postings{$_}++;
|
$Postings{$_}++;
|
||||||
|
|
Loading…
Reference in a new issue