From c832ef7927a5550fd1e2267b0b7c21290a2789e7 Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Wed, 23 Aug 2023 12:50:56 -0700 Subject: [PATCH] Temp change for lastarticleinfo.dat issue. --- Rocksolid_Light/rocksolid/newsportal.php | 49 +++++++++++++----------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/Rocksolid_Light/rocksolid/newsportal.php b/Rocksolid_Light/rocksolid/newsportal.php index b521785..5ee125d 100644 --- a/Rocksolid_Light/rocksolid/newsportal.php +++ b/Rocksolid_Light/rocksolid/newsportal.php @@ -647,31 +647,34 @@ function groups_show($gruppen) if ($g->description != "-") $groupdisplay .= '

' . $g->description . '

'; // Subscribed features - $filename = $spooldir . "/" . $g->name . "-lastarticleinfo.dat"; - if (is_file($filename)) { - $lastarticleinfo = unserialize(file_get_contents($filename)); - } else { - $lastarticleinfo['date'] = 0; + // lastarticleinfo.dat is NOT reliable + /* + * $filename = $spooldir . "/" . $g->name . "-lastarticleinfo.dat"; + * if (is_file($filename)) { + * $lastarticleinfo = unserialize(file_get_contents($filename)); + * } else { + * $lastarticleinfo['date'] = 0; + * } + */ + // if ($lastarticleinfo['date'] < 1) { + // Look up last article info for group (np does not write lastarticleinfo.dat properly for some reason) + $database = $spooldir . '/articles-overview.db3'; + $table = 'overview'; + $articles_dbh = overview_db_open($database); + $articles_query = $articles_dbh->prepare('SELECT * FROM overview WHERE newsgroup=:group ORDER BY date DESC LIMIT 2'); + $articles_query->execute([ + 'group' => $g->name + ]); + $found = 0; + while ($row = $articles_query->fetch()) { + $found = 1; + break; } - if ($lastarticleinfo['date'] < 1) { - // Look up last article info for group (np does not write this file sometimes for some reason) - $database = $spooldir . '/articles-overview.db3'; - $table = 'overview'; - $articles_dbh = overview_db_open($database); - $articles_query = $articles_dbh->prepare('SELECT * FROM overview WHERE newsgroup=:group ORDER BY date DESC LIMIT 2'); - $articles_query->execute([ - 'group' => $g->name - ]); - $found = 0; - while ($row = $articles_query->fetch()) { - $found = 1; - break; - } - $articles_dbh = null; - if ($found == 1) { - $lastarticleinfo['date'] = $row['date']; - } + $articles_dbh = null; + if ($found == 1) { + $lastarticleinfo['date'] = $row['date']; } + // } if (isset($userdata[$g->name])) { $groupdisplay .= '

'; $groupdisplay .= '(unsubscribe)';