Procházet zdrojové kódy

If no filters defined, and spam filters are not enabled, don't bother
issuing a possibly costly IMAP STATUS call to INBOX.

jangliss před 20 roky
rodič
revize
4935d499b7
2 změnil soubory, kde provedl 23 přidání a 1 odebrání
  1. 2 0
      ChangeLog
  2. 21 1
      plugins/filters/filters.php

+ 2 - 0
ChangeLog

@@ -458,6 +458,8 @@ Version 1.5.1 -- CVS
     IE6 browsers.
     IE6 browsers.
   - Rare case of session being destroyed causing PHP errors, so ensure session
   - Rare case of session being destroyed causing PHP errors, so ensure session
     is restarted.
     is restarted.
+  - If you don't have any filters defined, and spam filters are disabled, no
+    point issuing a STATUS call on INBOX for the filters plugin.
 
 
 Version 1.5.0 - 2 February 2004
 Version 1.5.0 - 2 February 2004
 -------------------------------
 -------------------------------

+ 21 - 1
plugins/filters/filters.php

@@ -192,6 +192,26 @@ function start_filters() {
     sqgetGlobalVar('username', $username, SQ_SESSION);
     sqgetGlobalVar('username', $username, SQ_SESSION);
     sqgetGlobalVar('key',      $key,      SQ_COOKIE);
     sqgetGlobalVar('key',      $key,      SQ_COOKIE);
 
 
+    $filters = load_filters();
+
+    // No point running spam filters if there aren't any to run //
+    if ($AllowSpamFilters) {
+        $spamfilters = load_spam_filters();
+
+        $AllowSpamFilters = false;
+        foreach($spamfilters as $key=>$value) {
+            if ($value['enabled'] == 'yes') {
+                $AllowSpamFilters = true;
+                break;
+            }
+        }
+    }
+
+    if (!$AllowSpamFilters && empty($filters)) {
+        return;
+    }
+
+
     // Detect if we have already connected to IMAP or not.
     // Detect if we have already connected to IMAP or not.
     // Also check if we are forced to use a separate IMAP connection
     // Also check if we are forced to use a separate IMAP connection
     if ((!isset($imap_stream) && !isset($imapConnection)) ||
     if ((!isset($imap_stream) && !isset($imapConnection)) ||
@@ -883,4 +903,4 @@ function do_error($string) {
     echo "</font></p>\n";
     echo "</font></p>\n";
 }
 }
 
 
-?>
+?>