Clean up prefer Injection-Date to Date to not skip article with bad date format in Date header (if Injection-Date header exists).

This commit is contained in:
Retro_Guy 2024-10-12 09:04:05 -07:00
parent f30b07b09e
commit 450e31a166
2 changed files with 12 additions and 9 deletions

View File

@ -1651,7 +1651,7 @@ function repair_broken_group($group)
$newsportal_start = explode(" ", $newsportal_info);
$rslight_start = explode(" ", $rslight_info);
if ($newsportal_start[0] != $rslight_start[0] || (($rslight_start[2] - $newsportal_start[2]) > 10)) {
file_put_contents($debug_log, "\n " . format_log_date() . " GROUP MISMATCH: " . $group . " rslight: " . $rslight_info . " newsportal: " . $newsportal_info . " Repairing...", FILE_APPEND);
file_put_contents($debug_log, "\n" . format_log_date() . " GROUP MISMATCH: " . $group . " rslight: " . $rslight_info . " newsportal: " . $newsportal_info . " Repairing...", FILE_APPEND);
wipe_newsportal_spool_info($group);
}
}
@ -3099,7 +3099,7 @@ function delete_message($messageid, $group = null, $overview_dbh = null)
// This function returns FALSE if article is OK
// Else returns a string with reason for failure
function check_article_integrity($rawmessage)
function check_article_integrity($rawmessage, $artdate = false)
{
global $CONFIG, $logfile, $config_name;
$returnval = false;
@ -3114,14 +3114,17 @@ function check_article_integrity($rawmessage)
// Parse the Header:
$message->header = parse_header($rawheader);
if(!$artdate) {
$artdate = $message->header->date;
}
// Check if date is in future (allow up to 60 seconds in future)
if ($message->header->date > (time() + 60)) {
$returnval = " Skipping message (date in future): " . $message->header->id . " (" . date('M d H:i:s', $message->header->date) . ")";
if ($artdate > (time() + 60)) {
$returnval = "437 401 Skipping message (date in future): " . $message->header->id . " (" . date('M d H:i:s', $artdate) . ")";
return $returnval;
}
// Date is probably 1 Jan 1970
if ($message->header->date < 100) {
$returnval = " Skipping message (date too old): " . $message->header->id . " (" . date('M d H:i:s', $message->header->date) . ")";
if ($artdate < 100) {
$returnval = "437 402 Skipping message (date too old): " . $message->header->id . " (" . date('M d H:i:s', $artdate) . ")";
return $returnval;
}
// Now we know if the message is a mime-multipart message:

View File

@ -449,9 +449,9 @@ function get_articles($ns, $group)
// Prefer Injection-Date to Date header
if (isset($injectiondate)) {
$artdate = $injectiondate;
// file_put_contents($debug_log, "\n" . format_log_date() . " " . $config_name . " Used Injection-Date for: " . $mid[1], FILE_APPEND);
file_put_contents($debug_log, "\n" . format_log_date() . " " . $config_name . " Used Injection-Date " . $artdate . " for: " . $mid[1], FILE_APPEND);
} else {
// file_put_contents($debug_log, "\n" . format_log_date() . " " . $config_name . " Used Date for: " . $mid[1], FILE_APPEND);
file_put_contents($debug_log, "\n" . format_log_date() . " " . $config_name . " Used Date " . $artdate . " for: " . $mid[1], FILE_APPEND);
}
// Check if date matches exactly another article and handle else sorting doesn't like it
@ -468,7 +468,7 @@ function get_articles($ns, $group)
if (($banned !== false) || ($integrity !== false)) {
unlink($articleHandle);
if ($integrity) {
file_put_contents($logfile, "\n" . format_log_date() . $integrity, FILE_APPEND);
file_put_contents($logfile, "\n" . format_log_date() . " " . $integrity, FILE_APPEND);
} elseif ($banned) {
file_put_contents($spamlog, "\n" . format_log_date() . " " . $banned . " :\tSPAM\t" . $mid[1] . "\t" . $groupnames[1] . "\t" . $from[1], FILE_APPEND);
}