Mercurial > dovecot > original-hg > dovecot-1.2
changeset 8330:16a99d3a34dd HEAD
FTS: If mail_debug=yes, log messages if fts is disabled.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 25 Oct 2008 15:55:35 +0300 |
parents | c7d14e00c158 |
children | 8fb20b423f8b |
files | src/plugins/fts-lucene/fts-backend-lucene.c src/plugins/fts-squat/fts-backend-squat.c src/plugins/fts/fts-plugin.c src/plugins/fts/fts-storage.c |
diffstat | 4 files changed, 16 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/fts-lucene/fts-backend-lucene.c Sat Oct 25 15:42:42 2008 +0300 +++ b/src/plugins/fts-lucene/fts-backend-lucene.c Sat Oct 25 15:55:35 2008 +0300 @@ -52,6 +52,8 @@ "INBOX"); if (path == NULL) { /* in-memory indexes */ + if ((box->storage->flags & MAIL_STORAGE_FLAG_DEBUG) != 0) + i_info("fts squat: Disabled with in-memory indexes"); return NULL; }
--- a/src/plugins/fts-squat/fts-backend-squat.c Sat Oct 25 15:42:42 2008 +0300 +++ b/src/plugins/fts-squat/fts-backend-squat.c Sat Oct 25 15:55:35 2008 +0300 @@ -61,6 +61,8 @@ mailbox_get_name(box)); if (*path == '\0') { /* in-memory indexes */ + if ((storage->flags & MAIL_STORAGE_FLAG_DEBUG) != 0) + i_info("fts squat: Disabled with in-memory indexes"); return NULL; }
--- a/src/plugins/fts/fts-plugin.c Sat Oct 25 15:42:42 2008 +0300 +++ b/src/plugins/fts/fts-plugin.c Sat Oct 25 15:55:35 2008 +0300 @@ -4,14 +4,19 @@ #include "mail-storage-private.h" #include "fts-plugin.h" +#include <stdlib.h> + const char *fts_plugin_version = PACKAGE_VERSION; void (*fts_next_hook_mailbox_opened)(struct mailbox *box); void fts_plugin_init(void) { - fts_next_hook_mailbox_opened = hook_mailbox_opened; - hook_mailbox_opened = fts_mailbox_opened; + if (getenv("FTS") != NULL) { + fts_next_hook_mailbox_opened = hook_mailbox_opened; + hook_mailbox_opened = fts_mailbox_opened; + } else if (getenv("DEBUG") != NULL) + i_info("fts: Missing fts setting, disabled"); } void fts_plugin_deinit(void)
--- a/src/plugins/fts/fts-storage.c Sat Oct 25 15:42:42 2008 +0300 +++ b/src/plugins/fts/fts-storage.c Sat Oct 25 15:55:35 2008 +0300 @@ -621,6 +621,9 @@ fbox->backend_fast = backend; } } + if ((box->storage->flags & MAIL_STORAGE_FLAG_DEBUG) != 0 && + fbox->backend_substr == NULL && fbox->backend_fast == NULL) + i_info("fts: No backends enabled by the fts setting"); } static struct mailbox_transaction_context * @@ -735,8 +738,8 @@ const char *env; env = getenv("FTS"); - if (env != NULL) - fts_mailbox_init(box, env); + i_assert(env != NULL); + fts_mailbox_init(box, env); if (fts_next_hook_mailbox_opened != NULL) fts_next_hook_mailbox_opened(box);