Avoid duplicate 'Duplicate' checking in spoolnews.php.

This commit is contained in:
Retro_Guy 2023-12-24 06:49:34 -07:00
parent 8baaf3322c
commit e37b1bc826
4 changed files with 44 additions and 33 deletions

View File

@ -29,7 +29,12 @@ $CONFIG = include ($config_file);
$OVERRIDES = include ($config_dir . '/overrides.inc.php');
// Spool directory size and minimum in Gigabytes
if ($OVERRIDES['min_spool_disk_space'] > 0) {
$min_spool_disk_space = $OVERRIDES['min_spool_disk_space'];
} else {
$min_spool_disk_space = 2;
}
$free_spool_disk_space = disk_free_space($spooldir) * 9.313E-10;
if ($free_spool_disk_space < $min_spool_disk_space) {
$low_spool_disk_space = true;

View File

@ -1896,13 +1896,14 @@ function get_next_article_number($group)
return $local;
}
function insert_article_from_array($this_article)
function insert_article_from_array($this_article, $check_duplicates = true)
{
global $CONFIG, $config_name, $spooldir, $logdir;
$logfile = $logdir . '/spoolnews.log';
$group = $this_article['group'];
$grouppath = $path . preg_replace('/\./', '/', $group);
if ($check_duplicates) {
// Create list of message-ids
$database = $spooldir . '/articles-overview.db3';
$table = 'overview';
@ -1932,6 +1933,7 @@ function insert_article_from_array($this_article)
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Duplicate Message-ID for: " . $group . ":" . $this_article['local'], FILE_APPEND);
return "441 Insert failed (duplicate)\r\n";
}
}
// Open articles Database
if ($CONFIG['article_database'] == '1') {
$article_dbh = article_db_open($spooldir . '/' . $group . '-articles.db3');

View File

@ -458,6 +458,10 @@ function get_articles($ns, $group)
$current_article['snippet'] = $this_snippet;
// Check Spam
if ($OVERRIDES['disable_spamassassin_spooling'] === true) {
$CONFIG['spamassassin'] = false;
$res = 0;
}
if (isset($CONFIG['spamassassin']) && ($CONFIG['spamassassin'] == true)) {
$spam_result_array = check_spam($subject[1], $from[1], $groupnames[1], $references, $body, $mid[1]);
$res = $spam_result_array['res'];
@ -482,10 +486,10 @@ function get_articles($ns, $group)
$current_article['group'] = $agroup;
if ($group == $agroup) {
$current_article['local'] = $local;
insert_article_from_array($current_article);
insert_article_from_array($current_article, false);
} else {
$current_article['local'] = get_next_article_number($agroup);
insert_article_from_array($current_article);
insert_article_from_array($current_article, false);
}
}
}

View File

@ -1 +1 @@
0.9.2
0.9.5