[dev] [PATCH] Stale folder lists

Bernard Blackham b-horde at blackham.com.au
Fri Oct 31 18:35:43 PST 2003


On Fri, Oct 31, 2003 at 04:09:26PM -0500, Chuck Hagenbuch wrote:
> This patch doesn't apply for me - can you send it as a text/plain attachment
> instead?

Tis attached.

Thanks,
Bernard.

-- 
 Bernard Blackham 
 bernard at blackham dot com dot au
-------------- next part --------------
diff -u -r1.401 IMP.php
--- imp/lib/IMP.php	28 Oct 2003 18:33:38 -0000	1.401
+++ imp/lib/IMP.php	31 Oct 2003 16:49:04 -0000
@@ -453,50 +453,11 @@
     function flistSelect($heading = '', $abbrev = true, $filter = array(),
                          $selected = null, $new_folder_header = false)
     {
-        global $conf, $imp;
-        static $cache;
-
-        $signature = serialize(array($heading, $abbrev, $filter, $selected, $new_folder_header));
-
-        /* Use the cached value, if possible. */
-        if ($conf['server']['cache_folders']) {
-            require_once HORDE_BASE . '/lib/SessionObjects.php';
-            $sessionOb = &Horde_SessionObjects::singleton();
-            if (!isset($imp['cache']['flistselect'])) {
-                $imp['cache']['flistselect'] = array();
-            }
-            $flist_cache = &$imp['cache']['flistselect'];
-            if (isset($imp['cache']['folder_cache']) &&
-                isset($flist_cache['_md5']) &&
-                isset($flist_cache[$signature])) {
-                $md5sum = md5(serialize($imp['cache']['folder_cache']));
-                /* Determine if the folder cache has changed since we last
-                   generated the select list. */
-                if ($md5sum == $flist_cache['_md5']) {
-                    $cachedata = $sessionOb->query($flist_cache[$signature]);
-                    if ($cachedata) {
-                        return $cachedata;
-                    }
-                } else {
-                    unset($flist_cache['_md5']);
-                    foreach ($flist_cache as $key => $val) {
-                        $sessionOb->setPruneFlag($val, true);
-                    }
-                    $flist_cache = array();
-                }
-            }
-        } elseif (isset($cache)) {
-            if (isset($cache[$signature])) {
-                return $cache[$signature];
-            }
-        } else {
-            $cache = array();
-        }
-            
         require_once HORDE_BASE . '/lib/Text.php';
         require_once IMP_BASE . '/lib/Folder.php';
 
         $imp_folder = &IMP_Folder::singleton();
+        /* Caching is performed by flist_IMP, so we needed worry about it. */
         $mailboxes = $imp_folder->flist_IMP($filter);
         $text = '';
 
@@ -519,17 +480,6 @@
                 $label = $mbox['label'];
             }
             $text .= sprintf('<option value="%s"%s>%s</option>%s', $val, $sel, Text::htmlSpaces($label), "\n");
-        }
-
-        /* Cache results. */
-        if ($conf['server']['cache_folders']) {
-            if (!isset($md5sum)) {
-                $md5sum = md5(serialize($imp['cache']['folder_cache']));
-            }
-            $flist_cache['_md5'] = $md5sum;
-            $flist_cache[$signature] = $sessionOb->storeOid($text, false);
-        } else {
-            $cache[$signature] = $text;
         }
 
         return $text;


More information about the dev mailing list