[Svn] r3712 - trunk/roundcubemail/program/include

trac at roundcube.net trac at roundcube.net
Fri Jun 4 11:58:37 CEST 2010


Author: alec
Date: 2010-06-04 04:58:37 -0500 (Fri, 04 Jun 2010)
New Revision: 3712

Modified:
   trunk/roundcubemail/program/include/rcube_imap.php
   trunk/roundcubemail/program/include/rcube_imap_generic.php
Log:
- performance improvement: skip SEARCH command when mailbox is empty and SEARCH is called just after SELECT


Modified: trunk/roundcubemail/program/include/rcube_imap.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_imap.php	2010-06-04 09:16:30 UTC (rev 3711)
+++ trunk/roundcubemail/program/include/rcube_imap.php	2010-06-04 09:58:37 UTC (rev 3712)
@@ -476,11 +476,7 @@
                 $search_str .= " UNSEEN";
             // get message count using SEARCH
             // not very performant but more precise (using UNDELETED)
-            // disable THREADS for this request
-            $threads = $this->threading;
-            $this->threading = false;
-            $index = $this->_search_index($mailbox, $search_str);
-            $this->threading = $threads;
+            $index = $this->conn->search($mailbox, $search_str);
 
             $count = is_array($index) ? count($index) : 0;
 

Modified: trunk/roundcubemail/program/include/rcube_imap_generic.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_imap_generic.php	2010-06-04 09:16:30 UTC (rev 3711)
+++ trunk/roundcubemail/program/include/rcube_imap_generic.php	2010-06-04 09:58:37 UTC (rev 3712)
@@ -1584,10 +1584,17 @@
 
     function search($folder, $criteria, $return_uid=false)
     {
+        $old_sel = $this->selected;
+
 	    if (!$this->select($folder)) {
     		return false;
 	    }
 
+        // return empty result when folder is empty and we're just after SELECT
+        if ($old_sel != $folder && !$this->exists) {
+            return array();
+	    }
+
     	$data = '';
 	    $query = 'srch1 ' . ($return_uid ? 'UID ' : '') . 'SEARCH ' . chop($criteria);
 

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list