소스 검색

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 년 전
부모
커밋
cc5084acf0
2개의 변경된 파일12개의 추가작업 그리고 10개의 파일을 삭제
  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');