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, id INTEGER PRIMARY KEY,
newsgroup TEXT, newsgroup TEXT,
number TEXT, number TEXT,
msgid TEXT UNIQUE, msgid TEXT,
date TEXT, date TEXT,
name TEXT, name TEXT,
subject TEXT)"); subject TEXT)");
@ -1304,7 +1304,7 @@ function article_db_open($database) {
$dbh->exec("CREATE TABLE IF NOT EXISTS articles( $dbh->exec("CREATE TABLE IF NOT EXISTS articles(
id INTEGER PRIMARY KEY, id INTEGER PRIMARY KEY,
newsgroup TEXT, newsgroup TEXT,
number TEXT, number TEXT UNIQUE,
msgid TEXT UNIQUE, msgid TEXT UNIQUE,
date TEXT, date TEXT,
name TEXT, name TEXT,

View File

@ -687,7 +687,7 @@ function get_db_article($article, $group) {
$msg2=""; $msg2="";
$ok_article = 0; $ok_article = 0;
$database = $spooldir.'/'.$nntp_group.'-articles.db3'; $database = $spooldir.'/'.$nntp_group.'-articles.db3';
$dbh = article_db_open($database); $dbh = rslight_db_open($database);
// Use article pointer // Use article pointer
if(!isset($article) && is_numeric($nntp_article)) { if(!isset($article) && is_numeric($nntp_article)) {
$article = $nntp_article; $article = $nntp_article;
@ -1136,16 +1136,17 @@ $date_i,$mid_i,$references_i,$bytes_i,$lines_i,$xref_i) {
} }
function get_article_list($thisgroup) { function get_article_list($thisgroup) {
global $spooldir; global $spooldir;
$group_overviewfp=fopen($spooldir."/".$thisgroup."-overview", 'r'); $database = $spooldir."/articles-overview.db3";
$ok_article=array(); $table = 'overview';
while($line = fgets($group_overviewfp)) { $dbh = rslight_db_open($database, $table);
$art=explode("\t", $line); $stmt = $dbh->prepare("SELECT * FROM overview WHERE newsgroup=:thisgroup ORDER BY number");
if(is_numeric($art[0])) { $stmt->execute(['thisgroup' => $thisgroup]);
$ok_article[] = $art[0]; $ok_article=array();
} 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']); $ns=nntp2_open($CONFIG['remote_server'], $CONFIG['remote_port']);
$ns2=nntp_open(); $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); file_put_contents($logfile, "\n".format_log_date()." ".$config_name." Failed to connect to ".$CONFIG['remote_server'].":".$CONFIG['remote_port'], FILE_APPEND);
exit(); exit();
} }