Fix cache issues
authorx2003bruneau <x2003bruneau@9869982d-c50d-0410-be91-f2a2ec7c7c7b>
Sun, 9 Jul 2006 19:04:58 +0000 (19:04 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 4 Jan 2008 23:34:49 +0000 (00:34 +0100)
git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@71 9869982d-c50d-0410-be91-f2a2ec7c7c7b

Changelog
banana/spool.inc.php

index ae50c29..bbfb9f2 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -3,6 +3,7 @@ Sun, 09 Jul 2006                    Florent Bruneau <florent.bruneau@m4x.org>
        * Can use a user-defined Array instead of $_GET
        * Bugfix: can remove all subscriptions
        * Bugfix: case sensitivity of newsgroup names
+       * Bugfix: correctly remove outdated cache entries
 
 Sat, 08 Jul 2006                    Florent Bruneau <florent.bruneau@m4x.org>
 
index 7c70727..c7a7dae 100644 (file)
@@ -104,18 +104,22 @@ class BananaSpool
         $this->_readFromFile();
 
         $do_save = false;
-        $first   = $banana->maxspool ? max($groupinfo[2]-$banana->maxspool, $groupinfo[1]) : $groupinfo[1];
-        $last    = $groupinfo[2];        
-        if ($this->version == BANANA_SPOOL_VERSION && is_array($this->overview)) {
-            if (count($this->overview)) {
-                for ($id = min(array_keys($this->overview)); $id<$first; $id++) { 
+        $first   = $banana->maxspool ? max($groupinfo[2] - $banana->maxspool, $groupinfo[1]) : $groupinfo[1];
+        $last    = $groupinfo[2]; 
+
+               if ($this->version == BANANA_SPOOL_VERSION && is_array($this->overview)) {
+                       $mids = array_keys($this->overview);
+                       foreach ($mids as $id) {
+                               if (($first <= $last && ($id < $first || $id > $last))
+                                               || ($first > $last && $id < $first && $id > $last))
+                               {
                     $this->delid($id, false);
                     $do_save = true;
                 }
             }
             if (!empty($this->overview)) {
                 $first = max(array_keys($this->overview))+1;
-            }
+                       }
         } else {
             unset($this->overview, $this->ids);
             $this->version = BANANA_SPOOL_VERSION;