Refactor getting raw headers.
Signed-off-by: Thomas Hochstein <thh@thh.name>
This commit is contained in:
parent
995173456b
commit
f78d4c2158
|
@ -261,21 +261,7 @@ sub HostStats {
|
|||
|
||||
my (%Postings,$DBQuery);
|
||||
|
||||
if (!$MID) {
|
||||
# get raw header data from raw table for given month
|
||||
$DBQuery = $DBHandle->prepare(sprintf("SELECT newsgroups,headers FROM %s ".
|
||||
"WHERE day LIKE ? AND NOT disregard",
|
||||
$DBRaw));
|
||||
$DBQuery->execute($Month.'-%')
|
||||
or &Bleat(2,sprintf("Can't get hosts data for %s from %s: ".
|
||||
"$DBI::errstr\n",$Month,$DBRaw));
|
||||
} else {
|
||||
$DBQuery = $DBHandle->prepare(sprintf("SELECT newsgroups,headers FROM %s ".
|
||||
"WHERE mid = ?", $DBRaw));
|
||||
$DBQuery->execute($MID)
|
||||
or &Bleat(2,sprintf("Can't get hosts data for %s from %s: ".
|
||||
"$DBI::errstr\n",$MID,$DBRaw));
|
||||
}
|
||||
$DBQuery = GetHeaders($DBHandle,$DBRaw,$Month,$MID);
|
||||
|
||||
### ----------------------------------------------
|
||||
print "----- HostStats -----\n" if $Debug;
|
||||
|
@ -372,6 +358,36 @@ sub HostStats {
|
|||
};
|
||||
};
|
||||
|
||||
sub GetHeaders {
|
||||
### ----------------------------------------------------------------------------
|
||||
### get (newsgroups and) raw headers from database
|
||||
### IN : $DBHandle : database handle
|
||||
### $DBRaw : database table for raw data (to read from)
|
||||
### $Month : current month to do
|
||||
### $MID : specific Message-ID to fetch (testing purposes)
|
||||
### OUT: DBI statement handle
|
||||
my ($DBHandle,$DBRaw,$Month,$MID) = @_;
|
||||
|
||||
my $DBQuery;
|
||||
|
||||
if (!$MID) {
|
||||
# get raw header data from raw table for given month
|
||||
$DBQuery = $DBHandle->prepare(sprintf("SELECT newsgroups,headers FROM %s ".
|
||||
"WHERE day LIKE ? AND NOT disregard",
|
||||
$DBRaw));
|
||||
$DBQuery->execute($Month.'-%')
|
||||
or &Bleat(2,sprintf("Can't get header data for %s from %s: ".
|
||||
"$DBI::errstr\n",$Month,$DBRaw));
|
||||
} else {
|
||||
$DBQuery = $DBHandle->prepare(sprintf("SELECT newsgroups,headers FROM %s ".
|
||||
"WHERE mid = ?", $DBRaw));
|
||||
$DBQuery->execute($MID)
|
||||
or &Bleat(2,sprintf("Can't get header data for %s from %s: ".
|
||||
"$DBI::errstr\n",$MID,$DBRaw));
|
||||
}
|
||||
return $DBQuery;
|
||||
}
|
||||
|
||||
sub CheckTLH {
|
||||
### ----------------------------------------------------------------------------
|
||||
### count newsgroups from legal TLH(s)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
NewsStats 0.4.0 (unreleased)
|
||||
* Reformat $Conf{TLH} for GroupStats only.
|
||||
* Extract TLH check from HostStats to subroutine, fix no-op check.
|
||||
* Extract getting raw headers from HostStats to subroutine.
|
||||
|
||||
NewsStats 0.3.0 (2025-05-18)
|
||||
* Extract GroupStats (in gatherstats) to subroutine.
|
||||
|
|
Loading…
Reference in a new issue