Fix incomplete mods to expire.php.
This commit is contained in:
parent
500023723e
commit
fef3c8e58a
|
@ -61,17 +61,19 @@ file_put_contents($logfile, "\n".format_log_date()." ".$config_name." ".$group."
|
||||||
$dbh = overview_db_open($database);
|
$dbh = overview_db_open($database);
|
||||||
$query = $dbh->prepare('SELECT * FROM overview WHERE newsgroup=:newsgroup AND date<:expireme');
|
$query = $dbh->prepare('SELECT * FROM overview WHERE newsgroup=:newsgroup AND date<:expireme');
|
||||||
$query->execute([':newsgroup' => $group, ':expireme' => $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);
|
$grouppath = preg_replace('/\./', '/', $group);
|
||||||
$status = "deleted";
|
$status = "deleted";
|
||||||
$statusdate = time();
|
$statusdate = time();
|
||||||
$statusreason = "expired";
|
$statusreason = "expired";
|
||||||
|
$i=0;
|
||||||
while($row = $query->fetch()) {
|
while($row = $query->fetch()) {
|
||||||
if(is_file($spooldir.'/articles/'.$grouppath.'/'.$row['number'])) {
|
if(is_file($spooldir.'/articles/'.$grouppath.'/'.$row['number'])) {
|
||||||
unlink($spooldir.'/articles/'.$grouppath.'/'.$row['number']);
|
unlink($spooldir.'/articles/'.$grouppath.'/'.$row['number']);
|
||||||
}
|
}
|
||||||
add_to_history($group, $row['number'], $row['msgid'], $status, $statusdate, $statusreason, $statusnotes);
|
add_to_history($group, $row['number'], $row['msgid'], $status, $statusdate, $statusreason, $statusnotes);
|
||||||
thread_cache_removearticle($group,$row['number']);
|
thread_cache_removearticle($group,$row['number']);
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
$stmt->execute([':newsgroup' => $group, ':expireme' => $expireme]);
|
$stmt->execute([':newsgroup' => $group, ':expireme' => $expireme]);
|
||||||
$dbh = null;
|
$dbh = null;
|
||||||
|
@ -79,4 +81,5 @@ file_put_contents($logfile, "\n".format_log_date()." ".$config_name." ".$group."
|
||||||
touch($spooldir.'/'.$config_name.'-expire-timer');
|
touch($spooldir.'/'.$config_name.'-expire-timer');
|
||||||
echo "Expired ".$i." articles for ".$group."\n";
|
echo "Expired ".$i." articles for ".$group."\n";
|
||||||
file_put_contents($logfile, "\n".format_log_date()." ".$config_name." Expired ".$i." articles for ".$group, FILE_APPEND);
|
file_put_contents($logfile, "\n".format_log_date()." ".$config_name." Expired ".$i." articles for ".$group, FILE_APPEND);
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue