groupstats.pl: More input validation.
Set -o to 'pretty' for time periods. Set -b to 10 if < 1. Signed-off-by: Thomas Hochstein <thh@inter.net>
This commit is contained in:
parent
f6d15ca78e
commit
d8695b1c04
|
@ -75,8 +75,8 @@ if ($Options{'l'}) {
|
||||||
my ($StartMonth,$EndMonth) = &GetTimePeriod($Options{'m'},$Options{'p'});
|
my ($StartMonth,$EndMonth) = &GetTimePeriod($Options{'m'},$Options{'p'});
|
||||||
# reset to one month for 'dump' output type
|
# reset to one month for 'dump' output type
|
||||||
if ($Options{'o'} eq 'dump' and $Options{'p'}) {
|
if ($Options{'o'} eq 'dump' and $Options{'p'}) {
|
||||||
$StartMonth = $EndMonth;
|
warn ("$MySelf: W: You cannot combine time periods (-p) with '-o dump', changing output type to '-o pretty'.\n");
|
||||||
warn ("$MySelf: W: You cannot combine time periods (-p) with '-o dump'. Month was set to $StartMonth.\n");
|
$Options{'o'} = 'pretty';
|
||||||
};
|
};
|
||||||
|
|
||||||
### init database
|
### init database
|
||||||
|
@ -136,6 +136,8 @@ if (!defined($Options{'b'}) and !defined($Options{'l'})) {
|
||||||
} else {
|
} else {
|
||||||
$OrderClause = 'postings DESC';
|
$OrderClause = 'postings DESC';
|
||||||
};
|
};
|
||||||
|
# set -b to 10 if < 1 (Top 10)
|
||||||
|
$Options{'b'} = 10 if $Options{'b'} !~ /^\d*$/ or $Options{'b'} < 1;
|
||||||
# push LIMIT to GroupList to match number of binding vars for DBQuery->execute
|
# push LIMIT to GroupList to match number of binding vars for DBQuery->execute
|
||||||
push @GroupList,$Options{'b'};
|
push @GroupList,$Options{'b'};
|
||||||
# prepare query: get sum of postings per group from groups table for given months and newsgroups with LIMIT
|
# prepare query: get sum of postings per group from groups table for given months and newsgroups with LIMIT
|
||||||
|
|
Loading…
Reference in a new issue