From 34ed3f90ce28ddc0131cd7629d8c38764ad4ac61 Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Wed, 20 Jan 2021 15:54:47 -0700 Subject: [PATCH] Add sqlite support for articles spool --- Rocksolid_Light/rocksolid/lib/message.inc.php | 41 ++++-- Rocksolid_Light/rocksolid/lib/post.inc.php | 1 + Rocksolid_Light/rocksolid/newsportal.php | 72 +++++++++- Rocksolid_Light/rocksolid/overboard.php | 38 +++-- Rocksolid_Light/rocksolid/tail.inc | 2 +- Rocksolid_Light/rslight/scripts/expire.php | 19 ++- Rocksolid_Light/rslight/scripts/nocem.php | 13 +- .../rslight/scripts/rslight-lib.php | 130 +++++++++++++----- Rocksolid_Light/rslight/scripts/spoolnews.php | 53 ++++--- 9 files changed, 283 insertions(+), 86 deletions(-) diff --git a/Rocksolid_Light/rocksolid/lib/message.inc.php b/Rocksolid_Light/rocksolid/lib/message.inc.php index 1b77049..6e61d39 100644 --- a/Rocksolid_Light/rocksolid/lib/message.inc.php +++ b/Rocksolid_Light/rocksolid/lib/message.inc.php @@ -467,10 +467,35 @@ function show_header($head,$group,$local_poster=false) { function display_full_headers($id,$group,$name,$from) { global $spoolpath, $CONFIG; - $thisgroup = preg_replace('/\./', '/', $group); + if($CONFIG['article_database'] == '1') { + $message = np_get_db_article($id, $group, 1); + foreach($message as $line) { + if(trim($line) == '') { + break; + } + if(stripos($line, 'Xref: ') === 0) { + continue; + } + if(stripos($line, 'From: ') === 0) { + $return.='From: '; + if(isset($CONFIG['hide_email']) && $CONFIG['hide_email'] == true) { + $return.=truncate_email($from); + } else { + $return.=htmlspecialchars($from); + } + if ($name != "") { + $return.=' ('.htmlspecialchars($name).')'; + } + $return.='
'; + continue; + } + $return.=mb_decode_mimeheader(htmlspecialchars($line)).'
'; + } + } else { + $thisgroup = preg_replace('/\./', '/', $group); + $message=fopen($spoolpath.$thisgroup.'/'.$id, 'r'); - $message=fopen($spoolpath.$thisgroup.'/'.$id, 'r'); - while($line=fgets($message)) { + while($line=fgets($message)) { if(trim($line) == '') { break; } @@ -489,13 +514,11 @@ function display_full_headers($id,$group,$name,$from) { } $return.='
'; continue; - } - - - $return.=mb_decode_mimeheader(htmlspecialchars($line)).'
'; + } + $return.=mb_decode_mimeheader(htmlspecialchars($line)).'
'; + } + fclose($message); } - fclose($message); - return($return); } diff --git a/Rocksolid_Light/rocksolid/lib/post.inc.php b/Rocksolid_Light/rocksolid/lib/post.inc.php index fb5bf73..323b708 100644 --- a/Rocksolid_Light/rocksolid/lib/post.inc.php +++ b/Rocksolid_Light/rocksolid/lib/post.inc.php @@ -261,6 +261,7 @@ function message_post($subject,$from,$newsgroups,$ref,$body,$encryptthis,$encryp } if (isset($CONFIG['organization'])) fputs($ns,'Organization: '.quoted_printable_encode($CONFIG['organization'])."\r\n"); + $body=trim($body); if ((isset($CONFIG['postfooter'])) && ($CONFIG['postfooter']!="")) { $body.="\n-- \n".$CONFIG['postfooter']."\n".$_SERVER['HTTP_HOST']; } diff --git a/Rocksolid_Light/rocksolid/newsportal.php b/Rocksolid_Light/rocksolid/newsportal.php index 2445847..1868c76 100644 --- a/Rocksolid_Light/rocksolid/newsportal.php +++ b/Rocksolid_Light/rocksolid/newsportal.php @@ -1198,14 +1198,14 @@ function get_date_interval($value) { return $variance; } -function rslight_db_open($database, $table) { +function rslight_db_open($database, $table='overview') { try { $dbh = new PDO('sqlite:'.$database); } catch (PDOExeption $e) { echo 'Connection failed: '.$e->getMessage(); exit; } - $dbh->exec("CREATE TABLE IF NOT EXISTS $table( + $dbh->exec("CREATE TABLE IF NOT EXISTS overview( id INTEGER PRIMARY KEY, newsgroup TEXT, number TEXT, @@ -1213,8 +1213,76 @@ function rslight_db_open($database, $table) { date TEXT, name TEXT, subject TEXT)"); + $stmt = $dbh->query('CREATE INDEX IF NOT EXISTS id_date on overview(date)'); + $stmt->execute(); + $stmt = $dbh->query('CREATE INDEX IF NOT EXISTS id_newsgroup on overview(newsgroup)'); + $stmt->execute(); + $stmt = $dbh->query('CREATE INDEX IF NOT EXISTS id_newsgroup_number on overview(newsgroup,number)'); + $stmt->execute(); return($dbh); } + +function article_db_open($database) { + try { + $dbh = new PDO('sqlite:'.$database); + } catch (PDOExeption $e) { + echo 'Connection failed: '.$e->getMessage(); + exit; + } + $dbh->exec("CREATE TABLE IF NOT EXISTS articles( + id INTEGER PRIMARY KEY, + newsgroup TEXT, + number TEXT, + msgid TEXT, + date TEXT, + name TEXT, + subject TEXT, + article TEXT)"); + $stmt = $dbh->query('CREATE INDEX IF NOT EXISTS db_number on articles(number)'); + $stmt->execute(); +return($dbh); +} + +function np_get_db_article($article, $group, $makearray=1, $dbh=null) { + global $config_dir,$path,$groupconfig,$config_name,$logdir,$spooldir; + $logfile=$logdir.'/newsportal.log'; + $msg2=""; + $closeme = 0; + $database = $spooldir.'/'.$group.'-articles.db3'; + if(!$dbh) { + $dbh = article_db_open($database); + $closeme = 1; + } +// By Message-ID + if(!is_numeric($article)) { + $stmt = $dbh->prepare("SELECT * FROM articles WHERE msgid like :terms"); + $stmt->bindParam(':terms', $article); + $stmt->execute(); + while($found = $stmt->fetch()) { + $msg2 = $found['article']; + break; + } + } else { + $stmt = $dbh->prepare("SELECT * FROM articles WHERE number = :terms"); + $stmt->bindParam(':terms', $article); + $stmt->execute(); + while($found = $stmt->fetch()) { + $msg2 = $found['article']; + break; + } + } + if($closeme == 1) { + $dbh = null; + } + file_put_contents($logfile, "\n".format_log_date()." ".$config_name." DEBUG: fetched: ".$article." from ".$group, FILE_APPEND); + if($makearray == 1) { + $thisarticle = preg_split("/\r\n|\n|\r/", trim($msg2)); + return $thisarticle; + } else { + return trim($msg2); + } +} + function get_config_value($configfile,$request) { global $config_dir; diff --git a/Rocksolid_Light/rocksolid/overboard.php b/Rocksolid_Light/rocksolid/overboard.php index e522603..1fd790b 100755 --- a/Rocksolid_Light/rocksolid/overboard.php +++ b/Rocksolid_Light/rocksolid/overboard.php @@ -98,6 +98,7 @@ $table = 'overview'; $dbh = rslight_db_open($database, $table); $query = $dbh->prepare('SELECT * FROM '.$table.' WHERE newsgroup=:findgroup AND date >= '.$oldest.' ORDER BY date DESC LIMIT '.$maxdisplay); $articles = array(); +$db_articles = array(); foreach($grouplist as $findgroup) { $groups = preg_split("/(\ |\t)/", $findgroup, 2); $findgroup = $groups[0]; @@ -108,16 +109,20 @@ foreach($grouplist as $findgroup) { continue 2; } } +/* $thisgroup = preg_replace('/\./', '/', $findgroup); if (!is_dir($spoolpath.$thisgroup)) { continue; } $stats = stat($spoolpath.$thisgroup); if($stats[9] > $oldest) { +*/ +if(1) { if($dbh) { $query->execute(['findgroup' => $findgroup]); while (($overviewline = $query->fetch()) !== false) { $articles[] = $spoolpath.$thisgroup.'/'.$overviewline['number']; + $db_articles[] = $findgroup.':'.$overviewline['number'].':'.$overviewline['date']; } } } @@ -177,17 +182,29 @@ if (isset($_GET['thisgroup'])) { $results=0; $files = array(); -foreach($articles as $article) { +if($CONFIG['article_database'] == '1') { + foreach($db_articles as $article) { + $order=explode(':', $article); + $files[$order[2]] = $article; + } +} else { + foreach($articles as $article) { if(is_dir($article)) { continue; } $files[filemtime($article)] = $article; + } } krsort($files); echo ''; //date_default_timezone_set(timezone_name_from_abbr("", $CONFIG['timezone'] * 3600, 0)); foreach($files as $article) { - $articledata = file_get_contents($article); + if($CONFIG['article_database'] == '1') { + $data = explode(':', $article); + $articledata = np_get_db_article($data[1], $data[0], 0); + } else { + $articledata = file_get_contents($article); + } $bodystart = strpos($articledata, $localeol); $header = substr($articledata, 0, $bodystart); @@ -201,12 +218,17 @@ foreach($files as $article) { } # Find group name and article number - $group = preg_replace($spoolpath_regexp, '', $article); - $group = preg_replace('/\//', '.', $group); - $findme = strrpos($group, '.'); - $groupname = substr($group, 0, $findme); - $articlenumber = substr($group, $findme+1); - + if($CONFIG['article_database'] == '1') { + $group = $data[0]; + $articlenumber = $data[1]; + $groupname = $group; + } else { + $group = preg_replace($spoolpath_regexp, '', $article); + $group = preg_replace('/\//', '.', $group); + $findme = strrpos($group, '.'); + $groupname = substr($group, 0, $findme); + $articlenumber = substr($group, $findme+1); + } # Generate link $url = $thissite."/article-flat.php?id=".$articlenumber."&group="._rawurlencode($groupname)."#".$articlenumber; $groupurl = $thissite."/thread.php?group="._rawurlencode($groupname); diff --git a/Rocksolid_Light/rocksolid/tail.inc b/Rocksolid_Light/rocksolid/tail.inc index b181f3f..6f1e061 100644 --- a/Rocksolid_Light/rocksolid/tail.inc +++ b/Rocksolid_Light/rocksolid/tail.inc @@ -1,6 +1,6 @@
-rocksolid light 0.6.7 +rocksolid light 0.6.8
clearnet i2p diff --git a/Rocksolid_Light/rslight/scripts/expire.php b/Rocksolid_Light/rslight/scripts/expire.php index 1caaaa5..73d830c 100755 --- a/Rocksolid_Light/rslight/scripts/expire.php +++ b/Rocksolid_Light/rslight/scripts/expire.php @@ -19,11 +19,6 @@ $webserver_group=$CONFIG['webserver_user']; $logfile=$logdir.'/expire.log'; - $database = $spooldir.'/articles-overview.db3'; - $table = 'overview'; - $dbh = rslight_db_open($database, $table); - $query = $dbh->prepare('DELETE FROM '.$table.' WHERE newsgroup=:newsgroup AND number=:number'); - $grouplist = file($config_dir.'/'.$config_name.'/groups.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); foreach($grouplist as $groupline) { $expireme = 0; @@ -40,6 +35,18 @@ if($expireme < 1) { continue; } + $database = $spooldir.'/articles-overview.db3'; + $dbh = rslight_db_open($database); + $query = $dbh->prepare('DELETE FROM overview WHERE newsgroup=:newsgroup AND date<:expireme'); + $query->execute([':newsgroup' => $group, ':expireme' => $expireme]); + $dbh = null; + if($CONFIG['article_database'] == '1') { + $database = $spooldir.'/'.$group.'-articles.db3'; + $articles_dbh = article_db_open($database); + $articles_query = $articles_dbh->prepare('DELETE FROM articles WHERE newsgroup=:newsgroup AND date<:expireme'); + $articles_query->execute([':newsgroup' => $group, ':expireme' => $expireme]); + $articles_dbh = null; + } $grouppath = preg_replace('/\./', '/', $group); $this_overview=$spooldir.'/'.$group.'-overview'; @@ -54,7 +61,6 @@ echo "Expiring: ".$break[4]." IN: ".$group." #".$break[0]."\r\n"; file_put_contents($logfile, "\n".format_log_date()." ".$config_name." Expiring: ".$break[4]." IN: ".$group." #".$break[0], FILE_APPEND); unlink($spooldir.'/articles/'.$grouppath.'/'.$break[0]); - $query->execute([':newsgroup' => $group, ':number' => $break[0]]); continue; } else { fputs($out_overviewfp, $line); @@ -66,7 +72,6 @@ chown($this_overview, $CONFIG['webserver_user']); chgrp($this_overview, $webserver_group); } - $dbh = null; unlink($lockfile); touch($spooldir.'/'.$config_name.'-expire-timer'); ?> diff --git a/Rocksolid_Light/rslight/scripts/nocem.php b/Rocksolid_Light/rslight/scripts/nocem.php index 6378cb9..ba4dc1b 100755 --- a/Rocksolid_Light/rslight/scripts/nocem.php +++ b/Rocksolid_Light/rslight/scripts/nocem.php @@ -99,13 +99,18 @@ function delete_message($messageid, $group) { } if($config_name) { $database = $spooldir.'/articles-overview.db3'; - $table = 'overview'; - $dbh = rslight_db_open($database, $table); - $query = $dbh->prepare('DELETE FROM '.$table.' WHERE msgid=:messageid'); + $dbh = rslight_db_open($database); + $query = $dbh->prepare('DELETE FROM overview WHERE msgid=:messageid'); $query->execute(['messageid' => $messageid]); $dbh = null; } - + if($CONFIG['article_database'] == '1') { + $database = $spooldir.'/'.$group.'-articles.db3'; + $articles_dbh = article_db_open($database); + $articles_query = $articles_dbh->prepare('DELETE FROM articles WHERE msgid=:messageid'); + $articles_query->execute(['messageid' => $messageid]); + $articles_dbh = null; + } $this_overview=$spooldir.'/'.$group.'-overview'; if(false === (is_file($this_overview))) { return; diff --git a/Rocksolid_Light/rslight/scripts/rslight-lib.php b/Rocksolid_Light/rslight/scripts/rslight-lib.php index 7310e0d..997baa7 100755 --- a/Rocksolid_Light/rslight/scripts/rslight-lib.php +++ b/Rocksolid_Light/rslight/scripts/rslight-lib.php @@ -1,7 +1,7 @@ fetch()) { $nntp_group = $found['newsgroup']; $article = $found['number']; + $this_id = $found['msgid']; break; } $dbh = null; @@ -636,13 +634,17 @@ function get_article($article, $nntp_group) { return $msg; } } + if($CONFIG['article_database'] == '1') { + $thisarticle=get_db_article($article, $nntp_group); + } else { $thisgroup = $path."/".preg_replace('/\./', '/', $nntp_group); if(!file_exists($thisgroup."/".$article)) { $msg.="430 no such article found\r\n"; return $msg; } $thisarticle=file($thisgroup."/".$article, FILE_IGNORE_NEW_LINES); - foreach($thisarticle as $thisline) { + } + foreach($thisarticle as $thisline) { if((strpos($thisline, "Message-ID: ") === 0) && !isset($mid[1])) { $mid=explode(': ', $thisline); } @@ -653,45 +655,82 @@ function get_article($article, $nntp_group) { return $msg.$msg2; } -function get_header($article, $nntp_group) { - global $nntp_article,$config_dir,$path,$groupconfig,$config_name,$spooldir; +function get_db_article($article, $group) { + global $nntp_article,$nntp_group,$config_dir,$path,$groupconfig,$config_name,$spooldir; $msg2=""; + $database = $spooldir.'/'.$nntp_group.'-articles.db3'; + $dbh = article_db_open($database); // Use article pointer if(!isset($article) && is_numeric($nntp_article)) { $article = $nntp_article; } // By Message-ID if(!is_numeric($article)) { - $database = $spooldir.'/articles-overview.db3'; - $table = 'overview'; - $dbh = rslight_db_open($database, $table); - $stmt = $dbh->prepare("SELECT * FROM $table WHERE msgid like :terms"); + $stmt = $dbh->prepare("SELECT * FROM articles WHERE msgid like :terms"); $stmt->bindParam(':terms', $article); $stmt->execute(); while($found = $stmt->fetch()) { - $nntp_group = $found['newsgroup']; - $article = $found['number']; + $msg2 = $found['article']; break; } - $dbh = null; } else { -// By article number - if($nntp_group === "") { - $msg.="412 no newsgroup has been selected\r\n"; - return $msg; - } - if(!is_numeric($article)) { - $msg.="420 no article has been selected\r\n"; - return $msg; + $stmt = $dbh->prepare("SELECT * FROM articles WHERE number = :terms"); + $stmt->bindParam(':terms', $article); + $stmt->execute(); + while($found = $stmt->fetch()) { + $msg2 = $found['article']; + break; } } - $thisgroup = $path."/".preg_replace('/\./', '/', $nntp_group); - if(!file_exists($thisgroup."/".$article)) { + $dbh = null; + + $thisarticle = preg_split("/\r\n|\n|\r/", trim($msg2)); + return $thisarticle; +} + +function get_header($article, $nntp_group) { + global $CONFIG,$nntp_article,$config_dir,$path,$groupconfig,$config_name,$spooldir; + $msg2=""; +// Use article pointer + if(!isset($article) && is_numeric($nntp_article)) { + $article = $nntp_article; + } + if($CONFIG['article_database'] == '1') { + $thisarticle=get_db_article($article, $nntp_group); + } else { +// By Message-ID + if(!is_numeric($article)) { + $database = $spooldir.'/articles-overview.db3'; + $table = 'overview'; + $dbh = rslight_db_open($database, $table); + $stmt = $dbh->prepare("SELECT * FROM $table WHERE msgid like :terms"); + $stmt->bindParam(':terms', $article); + $stmt->execute(); + while($found = $stmt->fetch()) { + $nntp_group = $found['newsgroup']; + $article = $found['number']; + break; + } + $dbh = null; + } else { +// By article number + if($nntp_group === "") { + $msg.="412 no newsgroup has been selected\r\n"; + return $msg; + } + if(!is_numeric($article)) { + $msg.="420 no article has been selected\r\n"; + return $msg; + } + } + $thisgroup = $path."/".preg_replace('/\./', '/', $nntp_group); + if(!file_exists($thisgroup."/".$article)) { $msg.="430 no such article found\r\n"; return $msg; + } + $thisarticle=file($thisgroup."/".$article, FILE_IGNORE_NEW_LINES); } - $thisarticle=file($thisgroup."/".$article, FILE_IGNORE_NEW_LINES); - foreach($thisarticle as $thisline) { + foreach($thisarticle as $thisline) { if($thisline == "") { $msg2.=".\r\n"; break; @@ -706,8 +745,15 @@ function get_header($article, $nntp_group) { } function get_body($article, $nntp_group) { - global $config_dir,$path,$groupconfig,$config_name,$spooldir; + global $CONFIG,$nntp_article,$config_dir,$path,$groupconfig,$config_name,$spooldir; $msg2=""; +// Use article pointer + if(!isset($article) && is_numeric($nntp_article)) { + $article = $nntp_article; + } + if($CONFIG['article_database'] == '1') { + $thisarticle=get_db_article($article, $nntp_group); + } else { // By Message-ID if(!is_numeric($article)) { $menulist = file($config_dir."menu.conf", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); @@ -744,6 +790,7 @@ function get_body($article, $nntp_group) { return $msg; } $thisarticle=file($thisgroup."/".$article, FILE_IGNORE_NEW_LINES); + } $body=0; foreach($thisarticle as $thisline) { if(($thisline == "") && ($body == 0)) { @@ -1015,6 +1062,15 @@ $date_i,$mid_i,$references_i,$bytes_i,$lines_i,$xref_i) { $stmt = $dbh->prepare($sql); $stmt->execute([$nntp_group, $local, $mid_i, $article_date, $from_i, $subject_i]); $dbh = null; + } + if($CONFIG['article_database'] == '1') { + $article_dbh = article_db_open($spooldir.'/'.$nntp_group.'-articles.db3'); + $article_sql = 'INSERT INTO articles(newsgroup, number, msgid, date, name, subject, article) VALUES(?,?,?,?,?,?,?)'; + $article_stmt = $article_dbh->prepare($article_sql); + $this_article = file_get_contents($grouppath."/".$local); + $article_stmt->execute([$nntp_group, $local, $mid_i, $article_date, $from_i, $subject_i, trim($this_article)]); + unlink($grouppath."/".$local); + $article_dbh = null; } fputs($overviewHandle, $local."\t".$subject_i."\t".$from_i."\t".$date_i."\t".$mid_i."\t".$references_i."\t".$bytes_i."\t".$lines_i."\t".$xref_i."\n"); fclose($overviewHandle); diff --git a/Rocksolid_Light/rslight/scripts/spoolnews.php b/Rocksolid_Light/rslight/scripts/spoolnews.php index b6a52dd..9c7ad04 100755 --- a/Rocksolid_Light/rslight/scripts/spoolnews.php +++ b/Rocksolid_Light/rslight/scripts/spoolnews.php @@ -36,7 +36,7 @@ if(!isset($maxarticles_per_run)) { $maxarticles_per_run = 100; } if(!isset($maxfirstrequest)) { - $maxfirstrequest = 1000; + $maxfirstrequest = 50000; } if(!isset($CONFIG['enable_nntp']) || $CONFIG['enable_nntp'] != true) { @@ -118,13 +118,17 @@ echo "\nSpoolnews Done\r\n"; function get_articles($ns, $group) { global $enable_rslight, $spooldir, $CONFIG, $maxarticles_per_run, $maxfirstrequest, $workpath, $path, $remote_groupfile, $local_groupfile, $local, $logdir, $config_name, $logfile; - # Prepare search database (this is only for testing atm) + # Prepare databases $database = $spooldir.'/articles-overview.db3'; $table = 'overview'; $dbh = rslight_db_open($database, $table); $sql = 'INSERT INTO '.$table.'(newsgroup, number, msgid, date, name, subject) VALUES(?,?,?,?,?,?)'; $stmt = $dbh->prepare($sql); - + if($CONFIG['article_database'] == '1') { + $article_dbh = article_db_open($spooldir.'/'.$group.'-articles.db3'); + $article_sql = 'INSERT INTO articles(newsgroup, number, msgid, date, name, subject, article) VALUES(?,?,?,?,?,?,?)'; + $article_stmt = $article_dbh->prepare($article_sql); + } if($ns == false) { file_put_contents($logfile, "\n".format_log_date()." ".$config_name." Lost connection to ".$CONFIG['remote_server'].":".$CONFIG['remote_port'], FILE_APPEND); exit(); @@ -158,15 +162,7 @@ function get_articles($ns, $group) { // Try to find last article number in local_groupfile $local = get_high_watermark($group); if(!is_numeric($local)) { - $thisgroup = $path."/".preg_replace('/\./', '/', $group); - $articles = scandir($thisgroup); - $ok_article=array(); - foreach($articles as $this_article) { - if(!is_numeric($this_article)) { - continue; - } - $ok_article[]=$this_article; - } + $ok_article = get_article_list($group); sort($ok_article); $local = $ok_article[key(array_slice($ok_article, -1, 1, true))]; if(!is_numeric($local)) { @@ -330,13 +326,17 @@ function get_articles($ns, $group) { fputs($overviewHandle, $local."\t".$subject[1]."\t".$from[1]."\t".$finddate[1]."\t".$mid[1]."\t".$references."\t".$bytes."\t".$lines."\t".$xref."\n"); fclose($overviewHandle); $references=""; -// add to search database +// add to database $stmt->execute([$group, $local, $mid[1], $article_date, $from[1], $subject[1]]); -// End Overview - - if($article_date > time()) - $article_date = time(); - touch($grouppath."/".$local, $article_date); + if($CONFIG['article_database'] == '1') { + $this_article = file_get_contents($grouppath."/".$local); + $article_stmt->execute([$group, $local, $mid[1], $article_date, $from[1], $subject[1], $this_article]); + unlink($grouppath."/".$local); + } else { + if($article_date > time()) + $article_date = time(); + touch($grouppath."/".$local, $article_date); + } echo "\nRetrieved: ".$group." ".$article."\n"; file_put_contents($logfile, "\n".format_log_date()." ".$config_name." Wrote to spool: ".$CONFIG['remote_server']." ".$group.":".$article, FILE_APPEND); $i++; @@ -386,6 +386,9 @@ function get_articles($ns, $group) { } } fclose($saveconfig); + if($CONFIG['article_database'] == '1') { + $article_dbh = null; + } $dbh = null; } @@ -482,4 +485,18 @@ function get_high_watermark($group) { } } +function get_article_list($thisgroup) { + global $spooldir; + $group_overviewfp=fopen($spooldir."/".$thisgroup."-overview", 'r'); + $ok_article=array(); + while($line = fgets($group_overviewfp)) { + $art=explode("\t", $line); + if(is_numeric($art[0])) { + $ok_article[] = $art[0]; + } + } + fclose($group_overviewfp); + return($ok_article); +} + ?>