Переглянути джерело

added RECENT response to result array of sqimap_get_status in order to
remove an expensive select call in the newmail plugin. Probably the
influences on speed when the newmail plugin is disabled are minimal.

stekkel 22 роки тому
батько
коміт
fad2721642
1 змінених файлів з 6 додано та 3 видалено
  1. 6 3
      functions/imap_general.php

+ 6 - 3
functions/imap_general.php

@@ -510,9 +510,9 @@ function sqimap_unseen_messages ($imap_stream, $mailbox) {
  * Returns the number of unseen/total messages in this folder
  */
 function sqimap_status_messages ($imap_stream, $mailbox) {
-    $read_ary = sqimap_run_command ($imap_stream, "STATUS \"$mailbox\" (MESSAGES UNSEEN)", false, $result, $message);
+    $read_ary = sqimap_run_command ($imap_stream, "STATUS \"$mailbox\" (MESSAGES UNSEEN RECENT)", false, $result, $message);
     $i = 0;
-    $messages = $unseen = false;
+    $messages = $unseen = $recent = false;
     $regs = array(false,false);
     while (isset($read_ary[$i])) {
         if (preg_match('/UNSEEN\s+([0-9]+)/i', $read_ary[$i], $regs)) {
@@ -521,9 +521,12 @@ function sqimap_status_messages ($imap_stream, $mailbox) {
         if (preg_match('/MESSAGES\s+([0-9]+)/i', $read_ary[$i], $regs)) {
 	    $messages = $regs[1];
 	}
+        if (preg_match('/RECENT\s+([0-9]+)/i', $read_ary[$i], $regs)) {
+	    $recent = $regs[1];
+	}        
         $i++;
     }
-    return array('MESSAGES' => $messages, 'UNSEEN'=>$unseen);
+    return array('MESSAGES' => $messages, 'UNSEEN'=>$unseen, 'RECENT' => $recent);
 }