Monitor newsportal article count mismatches and rebuild thread cache when necessary.
This commit is contained in:
parent
df79eb256e
commit
4e23a4127a
|
@ -1632,7 +1632,29 @@ function logging_prefix($sockip = null)
|
|||
}
|
||||
}
|
||||
|
||||
function wipe_newsportal_spool_info($group) {
|
||||
function repair_broken_group($group)
|
||||
{
|
||||
global $debug_log, $spooldir;
|
||||
$rslight_file = $spooldir . '/' . $group . '-rslight_info.txt';
|
||||
$newsportal_file = $spooldir . '/' . $group . '-info.txt';
|
||||
|
||||
if (file_exists($rslight_file) && file_exists($newsportal_file)) {
|
||||
$rslight_info = file_get_contents($rslight_file);
|
||||
$newsportal_info = file($newsportal_file);
|
||||
$newsportal_info = trim($newsportal_info[1]);
|
||||
$newsportal_start = explode(" ", $newsportal_info);
|
||||
$rslight_start = explode(" ", $rslight_info);
|
||||
|
||||
$variance = fdiv(floatval($newsportal_start[0]), floatval($rslight_start[0]));
|
||||
if($variance != 1) {
|
||||
file_put_contents($debug_log, "\n " . format_log_date() . " GROUP MISMATCH: " . $group . " Start rslight: " . $rslight_start[0] . " Start newsportal: " . $newsportal_start[0] . " Repairing...", FILE_APPEND);
|
||||
wipe_newsportal_spool_info($group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function wipe_newsportal_spool_info($group)
|
||||
{
|
||||
global $spooldir;
|
||||
$gpath = $spooldir . '/' . $group;
|
||||
@unlink($gpath . '-cache.txt');
|
||||
|
|
|
@ -1037,7 +1037,7 @@ function get_listgroup($nntp_group, $msgsock)
|
|||
|
||||
function get_group($change_group)
|
||||
{
|
||||
global $spooldir, $path, $nntp_group, $nntp_article, $groupconfig;
|
||||
global $spooldir, $path, $nntp_group, $nntp_article, $groupconfig, $debug_log;
|
||||
$grouplist = file($groupconfig, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
$ok_group = false;
|
||||
$count = 0;
|
||||
|
@ -1064,6 +1064,13 @@ function get_group($change_group)
|
|||
$first = 0;
|
||||
$nntp_article = $first;
|
||||
$msg = "211 " . $count . " " . $first . " " . $last . " " . $nntp_group . "\r\n";
|
||||
|
||||
// Write article number statistics to file (matching newsportal info.txt format)
|
||||
$articlestats = explode(" ", $msg);
|
||||
$savestats = $articlestats[2] . " " . $articlestats[3] . " " . $articlestats[1];
|
||||
file_put_contents($spooldir . '/' . $nntp_group . '-rslight_info.txt', $savestats);
|
||||
|
||||
repair_broken_group($nntp_group);
|
||||
return $msg;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue