From fb75a74e8e9d37f5d6832e0921bec8dd353cb10d Mon Sep 17 00:00:00 2001 From: stekkel Date: Fri, 14 May 2004 19:55:10 +0000 Subject: [PATCH] Removed double select call (select calls are expensive, do not do that) and removed unneeded expunge call (don't do that expunges are expensive) git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@7460 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/mailbox_display.php | 14 +++++++------- src/right_main.php | 8 +++++--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index 107d2d96..a48daf4c 100644 --- a/functions/mailbox_display.php +++ b/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 diff --git a/src/right_main.php b/src/right_main.php index 27dd05f0..53840768 100644 --- a/src/right_main.php +++ b/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'); -- 2.25.1