Some changes to use -overview less in favor of .db3

This commit is contained in:
Retro_Guy 2021-02-18 22:10:43 -07:00
parent 26a810fdeb
commit 953b203226
3 changed files with 16 additions and 15 deletions

View File

@ -1279,7 +1279,7 @@ function rslight_db_open($database, $table='overview') {
id INTEGER PRIMARY KEY,
newsgroup TEXT,
number TEXT,
msgid TEXT UNIQUE,
msgid TEXT,
date TEXT,
name TEXT,
subject TEXT)");
@ -1304,7 +1304,7 @@ function article_db_open($database) {
$dbh->exec("CREATE TABLE IF NOT EXISTS articles(
id INTEGER PRIMARY KEY,
newsgroup TEXT,
number TEXT,
number TEXT UNIQUE,
msgid TEXT UNIQUE,
date TEXT,
name TEXT,

View File

@ -687,7 +687,7 @@ function get_db_article($article, $group) {
$msg2="";
$ok_article = 0;
$database = $spooldir.'/'.$nntp_group.'-articles.db3';
$dbh = article_db_open($database);
$dbh = rslight_db_open($database);
// Use article pointer
if(!isset($article) && is_numeric($nntp_article)) {
$article = $nntp_article;
@ -1137,15 +1137,16 @@ $date_i,$mid_i,$references_i,$bytes_i,$lines_i,$xref_i) {
function get_article_list($thisgroup) {
global $spooldir;
$group_overviewfp=fopen($spooldir."/".$thisgroup."-overview", 'r');
$database = $spooldir."/articles-overview.db3";
$table = 'overview';
$dbh = rslight_db_open($database, $table);
$stmt = $dbh->prepare("SELECT * FROM overview WHERE newsgroup=:thisgroup ORDER BY number");
$stmt->execute(['thisgroup' => $thisgroup]);
$ok_article=array();
while($line = fgets($group_overviewfp)) {
$art=explode("\t", $line);
if(is_numeric($art[0])) {
$ok_article[] = $art[0];
while($found = $stmt->fetch()) {
$ok_article[] = $found['number'];
}
}
fclose($group_overviewfp);
return($ok_article);
$dbh = null;
return(array_unique($ok_article));
}
?>

View File

@ -91,7 +91,7 @@ $enable_rslight=0;
}
$ns=nntp2_open($CONFIG['remote_server'], $CONFIG['remote_port']);
$ns2=nntp_open();
if($ns == false) {
if(!$ns) {
file_put_contents($logfile, "\n".format_log_date()." ".$config_name." Failed to connect to ".$CONFIG['remote_server'].":".$CONFIG['remote_port'], FILE_APPEND);
exit();
}