Only need to do this check if no messages in mbox.
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 10 Dec 2008 23:07:11 +0000 (16:07 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 10 Dec 2008 23:07:11 +0000 (16:07 -0700)
imp/lib/Views/ListMessages.php

index 7627da8..e54794f 100644 (file)
@@ -97,26 +97,6 @@ class IMP_Views_ListMessages
         $result->label = $label;
         $result->cacheid = $imp_mailbox->getCacheID();
 
-        /* Check for UIDVALIDITY expiration. It is the first element in the
-         * cacheid returned from the browser. If it has changed, we need to
-         * purge the cached items on the browser (send 'reset' param to
-         * ViewPort). */
-        if (!empty($args['cacheid']) && !empty($args['cached'])) {
-            $uid_expire = false;
-            try {
-                $status = $GLOBALS['imp_imap']->ob->status($folder, Horde_Imap_Client::STATUS_UIDVALIDITY);
-                list($old_uidvalid,) = explode('|', $args['cacheid']);
-                $uid_expire = ($old_uidvalid != $status['uidvalidity']);
-            } catch (Horde_Imap_Cache_Exception $e) {
-                $uid_expire = true;
-            }
-
-            if ($uid_expire) {
-                $args['cached'] = array();
-                $result->reset = 1;
-            }
-        }
-
         /* Determine the row slice to process. */
         if (isset($args['slice_rownum'])) {
             $rownum = max(1, $args['slice_rownum']);
@@ -174,6 +154,26 @@ class IMP_Views_ListMessages
             return $result;
         }
 
+        /* Check for UIDVALIDITY expiration. It is the first element in the
+         * cacheid returned from the browser. If it has changed, we need to
+         * purge the cached items on the browser (send 'reset' param to
+         * ViewPort). */
+        if (!empty($args['cacheid']) && !empty($args['cached'])) {
+            $uid_expire = false;
+            try {
+                $status = $GLOBALS['imp_imap']->ob->status($folder, Horde_Imap_Client::STATUS_UIDVALIDITY);
+                list($old_uidvalid,) = explode('|', $args['cacheid']);
+                $uid_expire = ($old_uidvalid != $status['uidvalidity']);
+            } catch (Horde_Imap_Cache_Exception $e) {
+                $uid_expire = true;
+            }
+
+            if ($uid_expire) {
+                $args['cached'] = array();
+                $result->reset = 1;
+            }
+        }
+
         /* Get the cached list. */
         if (empty($args['cached'])) {
             $cached = array();