From 9a43a06b84a80b2e58df29095bcaed16ffd53e4f Mon Sep 17 00:00:00 2001 From: jangliss Date: Tue, 25 Oct 2005 21:08:21 +0000 Subject: [PATCH] If no filters defined, and spam filters are not enabled, don't bother issuing a possibly costly IMAP STATUS call to INBOX. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@10199 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- ChangeLog | 2 ++ plugins/filters/filters.php | 22 +++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 57630f8d..49bf87c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -458,6 +458,8 @@ Version 1.5.1 -- CVS IE6 browsers. - Rare case of session being destroyed causing PHP errors, so ensure session 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 ------------------------------- diff --git a/plugins/filters/filters.php b/plugins/filters/filters.php index aa9f8b3c..0882e4fe 100644 --- a/plugins/filters/filters.php +++ b/plugins/filters/filters.php @@ -192,6 +192,26 @@ function start_filters() { sqgetGlobalVar('username', $username, SQ_SESSION); 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. // Also check if we are forced to use a separate IMAP connection if ((!isset($imap_stream) && !isset($imapConnection)) || @@ -883,4 +903,4 @@ function do_error($string) { echo "

\n"; } -?> \ No newline at end of file +?> -- 2.25.1