Ticket #8805: Optimize folder tree initialization
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 5 Feb 2010 21:21:09 +0000 (14:21 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 5 Feb 2010 21:21:09 +0000 (14:21 -0700)
imp/docs/CHANGES
imp/lib/Imap/Tree.php

index c8a009b..38d6fd7 100644 (file)
@@ -144,6 +144,7 @@ v5.0-git
 v4.3.7-cvs
 ----------
 
+[mms] Optimize folder tree initialization (Ticket #8805).
 [mms] Add command line fetchmail script (tjacyno@galasoft.net, Ticket #8812).
 [jan] Workaround broken PHP number formatting with some locales (Bug #8780).
 
index 5abb53c..66aa741 100644 (file)
@@ -1079,12 +1079,18 @@ class IMP_Imap_Tree
     protected function _modifyExpandedList($id, $action)
     {
         $this->_initExpandedList();
+
         if ($action == 'add') {
+            $change = empty($this->_expanded[$id]);
             $this->_expanded[$id] = true;
         } else {
+            $change = !empty($this->_expanded[$id]);
             unset($this->_expanded[$id]);
         }
-        $GLOBALS['prefs']->setValue('expanded_folders', serialize($this->_expanded));
+
+        if ($change) {
+            $GLOBALS['prefs']->setValue('expanded_folders', serialize($this->_expanded));
+        }
     }
 
     /**