Fix incomplete mods to expire.php.

This commit is contained in:
Retro_Guy 2023-08-19 08:03:25 -07:00
parent 500023723e
commit fef3c8e58a
1 changed files with 4 additions and 1 deletions

View File

@ -61,17 +61,19 @@ file_put_contents($logfile, "\n".format_log_date()." ".$config_name." ".$group."
$dbh = overview_db_open($database);
$query = $dbh->prepare('SELECT * FROM overview WHERE newsgroup=:newsgroup AND date<:expireme');
$query->execute([':newsgroup' => $group, ':expireme' => $expireme]);
$stmt = $articles_dbh->prepare('DELETE FROM overview WHERE newsgroup=:newsgroup AND date<:expireme');
$stmt = $dbh->prepare('DELETE FROM overview WHERE newsgroup=:newsgroup AND date<:expireme');
$grouppath = preg_replace('/\./', '/', $group);
$status = "deleted";
$statusdate = time();
$statusreason = "expired";
$i=0;
while($row = $query->fetch()) {
if(is_file($spooldir.'/articles/'.$grouppath.'/'.$row['number'])) {
unlink($spooldir.'/articles/'.$grouppath.'/'.$row['number']);
}
add_to_history($group, $row['number'], $row['msgid'], $status, $statusdate, $statusreason, $statusnotes);
thread_cache_removearticle($group,$row['number']);
$i++;
}
$stmt->execute([':newsgroup' => $group, ':expireme' => $expireme]);
$dbh = null;
@ -79,4 +81,5 @@ file_put_contents($logfile, "\n".format_log_date()." ".$config_name." ".$group."
touch($spooldir.'/'.$config_name.'-expire-timer');
echo "Expired ".$i." articles for ".$group."\n";
file_put_contents($logfile, "\n".format_log_date()." ".$config_name." Expired ".$i." articles for ".$group, FILE_APPEND);
}
?>