Avoid reusing deleted article numbers when writing new articles

This commit is contained in:
Retro_Guy 2021-01-05 00:04:05 -07:00
parent 7545c5192a
commit 92c932cf75

View File

@ -146,13 +146,10 @@ function get_articles($ns, $group) {
} }
} }
if(isset($CONFIG['enable_nntp']) && $CONFIG['enable_nntp'] == true) { if(isset($CONFIG['enable_nntp']) && $CONFIG['enable_nntp'] == true) {
$grouplist = file($local_groupfile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach($grouplist as $findgroup) { // Try to find last article number in local_groupfile
$name = explode(':', $findgroup); $local = get_config_value($local_groupfile, $group);
if (strcmp($name[0], $group) == 0) { if(!is_numeric($local)) {
if (is_numeric($name[1]))
$local = $name[1];
else {
$thisgroup = $path."/".preg_replace('/\./', '/', $group); $thisgroup = $path."/".preg_replace('/\./', '/', $group);
$articles = scandir($thisgroup); $articles = scandir($thisgroup);
$ok_article=array(); $ok_article=array();
@ -164,11 +161,9 @@ function get_articles($ns, $group) {
} }
sort($ok_article); sort($ok_article);
$local = $ok_article[key(array_slice($ok_article, -1, 1, true))]; $local = $ok_article[key(array_slice($ok_article, -1, 1, true))];
if(!is_numeric($local)) if(!is_numeric($local)) {
$local = 0; $local = 0;
} }
break;
}
} }
if($local < 1) if($local < 1)
$local = 1; $local = 1;