diff --git a/Rocksolid_Light/rocksolid/newsportal.php b/Rocksolid_Light/rocksolid/newsportal.php index fef06fa..2a0fd70 100644 --- a/Rocksolid_Light/rocksolid/newsportal.php +++ b/Rocksolid_Light/rocksolid/newsportal.php @@ -635,13 +635,23 @@ function groups_show($gruppen) if ($memcacheD) { unset($lastarticleinfo); $lar_memcache = 'lastarticleinfo-' . $g->name; - $grouppath = $spooldir . '/articles/' . preg_replace('/\./', '/', $g->name); - if ($lar_cachetime = $memcacheD->get($lar_memcache)) { - if (filemtime($grouppath) < $lar_cachetime) { - $lastarticleinfo['date'] = $lar_cachetime; + $groupfile = $spooldir . '/' . $g->name . '-lastupdate.dat'; + if ($lastarticleinfo = unserialize($memcacheD->get($lar_memcache))) { + if ($lastarticleinfo && file_exists($groupfile) && filemtime($groupfile) <= $lastarticleinfo['date']) { if ($enable_memcache_logging) { file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . ' Found lastarticleinfo for ' . $g->name . ' in memcache', FILE_APPEND); + $found = 1; } + } else { + $result = $memcacheD->delete($lar_memcache); + if ($enable_memcache_logging) { + if ($result) { + file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " Deleted $lar_memcache from memcache", FILE_APPEND); + } else { + file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " Failed to delete (or not found) $lar_memcache from memcache", FILE_APPEND); + } + } + unset($lastarticleinfo); } } } @@ -661,9 +671,12 @@ function groups_show($gruppen) $overview_dbh = null; if ($found == 1) { - $lastarticleinfo['date'] = $row['date']; + $lastarticleinfo = $row; if ($memcacheD) { - $memcacheD->add($lar_memcache, $lastarticleinfo['date'], $memcache_ttl); + touch($groupfile, $lastarticleinfo['date']); + $memcacheD->delete($lar_memcache); + $memcacheD->add($lar_memcache, serialize($row), $memcache_ttl); + file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " Wrote $lar_memcache to memcache", FILE_APPEND); } } } @@ -744,7 +757,7 @@ function groups_show($gruppen) $groupdisplay .= '