From 93c8eae2edcb7ccb4a3fe25817908fdb0723f324 Mon Sep 17 00:00:00 2001 From: Thomas Hochstein Date: Sun, 27 May 2012 15:53:29 +0200 Subject: [PATCH] Change interpretation of --checkgroups to template In most hierarchies, the list of valid newsgroups will change over time, so you'll have to use another checkgroups file for each month. gatherstats will now understand the value of --checkgroups to be a template and amend it with each month it is processing. Documentation changed accordingly. Signed-off-by: Thomas Hochstein --- gatherstats.pl | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/gatherstats.pl b/gatherstats.pl index 0a5a9a2..2bc426b 100755 --- a/gatherstats.pl +++ b/gatherstats.pl @@ -102,10 +102,6 @@ if ($Conf{'TLH'}) { }; }; -# read list of newsgroups from --checkgroups -# into a hash -my %ValidGroups = %{ReadGroupList($OptCheckgroupsFile)} if $OptCheckgroupsFile; - ### init database my $DBHandle = InitDB(\%Conf,1); @@ -116,6 +112,11 @@ foreach my $Month (&ListMonth($Period)) { print "---------- $Month ----------\n" if $OptDebug; if ($OptStatsType eq 'all' or $OptStatsType eq 'groups') { + # read list of newsgroups from --checkgroups + # into a hash + my %ValidGroups = %{ReadGroupList(sprintf('%s-%s',$OptCheckgroupsFile,$Month))} + if $OptCheckgroupsFile; + ### ---------------------------------------------- ### get groups data (number of postings per group) # get groups data from raw table for given month @@ -195,7 +196,7 @@ gatherstats - process statistical data from a raw source =head1 SYNOPSIS -B [B<-Vhdt>] [B<-m> I | I] [B<-s> I I]] [B<--hierarchy> I] [B<--rawdb> I] [B<-groupsdb> I] [B<--clientsdb> I] [B<--hostsdb> I] +B [B<-Vhdt>] [B<-m> I | I] [B<-s> I I]] [B<--hierarchy> I] [B<--rawdb> I] [B<-groupsdb> I] [B<--clientsdb> I] [B<--hostsdb> I] =head1 REQUIREMENTS @@ -289,15 +290,23 @@ Set processing type to one of I and I. Defaults to all (and is currently rather pointless as only I has been implemented). -=item B<-c>, B<--checkgroups> I +=item B<-c>, B<--checkgroups> I + +Check each group against a list of valid newsgroups read from a file, +one group on each line and ignoring everything after the first +whitespace (so you can use a file in checkgroups format or (part of) +your INN active file). + +The filename is taken from I, amended by each B<-- +month> B is processing, so that + + gatherstats -m 2010-01:2010-12 -c checkgroups -Check each group against a list of valid newsgroups read from -I, one group on each line and ignoring everything after the -first whitespace (so you can use a file in checkgroups format or (part -of) your INN active file). +will check against F for January 2010, against +F for February 2010 and so on. -Newsgroups not found in I will be dropped (and logged to -STDERR), and newsgroups found in I but having no postings +Newsgroups not found in the checkgroups file will be dropped (and +logged to STDERR), and newsgroups found there but having no postings will be added with a count of 0 (and logged to STDERR). =item B<--hierarchy> I (newsgroup hierarchy) @@ -341,9 +350,9 @@ Process all types of information for January of 2010: gatherstats --month 2010-01 Process only number of postings for the year of 2010, -checking against checkgroups-2010.txt: +checking against checkgroups-*: - gatherstats -m 2010-01:2010-12 -s groups -c checkgroups-2010.txt + gatherstats -m 2010-01:2010-12 -s groups -c checkgroups =head1 FILES -- 2.20.1