Bug #7745: Fix cache expiration when deleting a mailbox
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 10 Mar 2009 21:10:40 +0000 (15:10 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 10 Mar 2009 21:10:40 +0000 (15:10 -0600)
imp/docs/CHANGES
imp/lib/Imap/Tree.php

index 72cc65c..8d5ebd6 100644 (file)
@@ -62,6 +62,7 @@ v4.3.4-cvs
 
 [mms] SECURITY: Don't cache local PGP public keys retrieved from the
       addressbook (found by Peter Meier <peter.meier@immerda.ch>).
+[mms] Fix cache issues in folder tree when deleting a mailbox (Bug #7745).
 [mms] Fix updating POP3 indices when deleting in mailbox view (Bug #8035).
 [jan] If updating a calendar event fails, try to import it instead (Bug #7589).
 [mms] Fix [un]escaping of various URLs on message screen caused by security
index 352a425..bc79114 100644 (file)
@@ -821,8 +821,8 @@ class IMP_Imap_Tree
              $this->isVFolder($this->_tree[$search_id]))) {
             if (!$vfolder_base) {
                 $id = $search_id;
-
             }
+
             $parent = $this->_tree[$id]['p'];
             unset($this->_tree[$id]);
 
@@ -853,6 +853,13 @@ class IMP_Imap_Tree
 
         $elt = &$this->_tree[$id];
 
+        /* Delete the entry from the folder list cache(s). */
+        foreach (array('_subscribed', '_fulllist') as $var) {
+            if (!is_null($this->$var)) {
+                $this->$var = array_values(array_diff($this->$var, array($id)));
+            }
+        }
+
         /* Do not delete from tree if there are child elements - instead,
          * convert to a container element. */
         if ($this->hasChildren($elt)) {