Browse Source

Removed double select call (select calls are expensive, do not do that) and
removed unneeded expunge call (don't do that expunges are expensive)

stekkel 21 năm trước cách đây
mục cha
commit
cc5084acf0
2 tập tin đã thay đổi với 12 bổ sung10 xóa
  1. 7 7
      functions/mailbox_display.php
  2. 5 3
      src/right_main.php

+ 7 - 7
functions/mailbox_display.php

@@ -532,7 +532,7 @@ function getSelfSortMessages($imapConnection, $start_msg, $show_num,
  */
 function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs,
                                 $start_msg, $sort, $color, $show_num,
-                                $use_cache, $mode='') {
+                                $use_cache, $mode='',$mbxresponse) {
     global $msgs, $msort, $auto_expunge, $thread_sort_messages,
            $allow_server_sort, $server_sort_order;
 
@@ -552,14 +552,14 @@ function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs,
 
     //$start = microtime();
     /* If autoexpunge is turned on, then do it now. */
-    $mbxresponse = sqimap_mailbox_select($imapConnection, $mailbox);
+    //$mbxresponse = sqimap_mailbox_select($imapConnection, $mailbox);
     $srt = $sort;
     /* If autoexpunge is turned on, then do it now. */
-    if ($auto_expunge == true) {
-        $exp_cnt = sqimap_mailbox_expunge($imapConnection, $mailbox, false, '');
-        $mbxresponse['EXISTS'] = $mbxresponse['EXISTS'] - $exp_cnt;
-        $num_msgs = $mbxresponse['EXISTS'];
-    }
+    //if ($auto_expunge == true) {
+    //    $exp_cnt = sqimap_mailbox_expunge($imapConnection, $mailbox, false, '');
+    //    $mbxresponse['EXISTS'] = $mbxresponse['EXISTS'] - $exp_cnt;
+    //    $num_msgs = $mbxresponse['EXISTS'];
+    //}
 
     if ($mbxresponse['EXISTS'] > 0) {
         /* if $start_msg is lower than $num_msgs, we probably deleted all messages

+ 5 - 3
src/right_main.php

@@ -151,7 +151,7 @@ else {
 
 do_hook ('generic_header');
 
-sqimap_mailbox_select($imapConnection, $mailbox);
+$aMbxResponse = sqimap_mailbox_select($imapConnection, $mailbox);
 
 if ($composenew) {
     $comp_uri = SM_PATH . 'src/compose.php?mailbox='. urlencode($mailbox).
@@ -203,7 +203,9 @@ if (! isset($use_mailbox_cache)) {
 }
 
 if ($use_mailbox_cache && sqsession_is_registered('msgs')) {
-    showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color, $show_num, $use_mailbox_cache);
+    showMessagesForMailbox($imapConnection, $mailbox, $numMessages, 
+                           $startMessage, $sort, $color, $show_num, 
+                           $use_mailbox_cache, '',$aMbxResponse);
 } else {
     if (sqsession_is_registered('msgs')) {
         unset($msgs);
@@ -221,7 +223,7 @@ if ($use_mailbox_cache && sqsession_is_registered('msgs')) {
 
     showMessagesForMailbox($imapConnection, $mailbox, $numMessages,
                            $startMessage, $sort, $color, $show_num,
-                           $use_mailbox_cache);
+                           $use_mailbox_cache,'',$aMbxResponse);
 
     if (sqsession_is_registered('msgs') && isset($msgs)) {
         sqsession_register($msgs, 'msgs');