From: Timo Sirainen Date: Sat, 25 Oct 2008 12:55:35 +0000 (+0300) Subject: FTS: If mail_debug=yes, log messages if fts is disabled. X-Git-Tag: 1.2.alpha4~159 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=14bb36cbb67b42e32105c3d843a8c974dc7ed436;p=thirdparty%2Fdovecot%2Fcore.git FTS: If mail_debug=yes, log messages if fts is disabled. --HG-- branch : HEAD --- diff --git a/src/plugins/fts-lucene/fts-backend-lucene.c b/src/plugins/fts-lucene/fts-backend-lucene.c index 77e0866b53..0d1bd49809 100644 --- a/src/plugins/fts-lucene/fts-backend-lucene.c +++ b/src/plugins/fts-lucene/fts-backend-lucene.c @@ -52,6 +52,8 @@ static struct fts_backend *fts_backend_lucene_init(struct mailbox *box) "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; } diff --git a/src/plugins/fts-squat/fts-backend-squat.c b/src/plugins/fts-squat/fts-backend-squat.c index 292b0359ae..bc3aeda0c5 100644 --- a/src/plugins/fts-squat/fts-backend-squat.c +++ b/src/plugins/fts-squat/fts-backend-squat.c @@ -61,6 +61,8 @@ static struct fts_backend *fts_backend_squat_init(struct mailbox *box) 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; } diff --git a/src/plugins/fts/fts-plugin.c b/src/plugins/fts/fts-plugin.c index 1a40b30707..ba9c44fb94 100644 --- a/src/plugins/fts/fts-plugin.c +++ b/src/plugins/fts/fts-plugin.c @@ -4,14 +4,19 @@ #include "mail-storage-private.h" #include "fts-plugin.h" +#include + 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) diff --git a/src/plugins/fts/fts-storage.c b/src/plugins/fts/fts-storage.c index 50ae01fb65..9f135616e9 100644 --- a/src/plugins/fts/fts-storage.c +++ b/src/plugins/fts/fts-storage.c @@ -621,6 +621,9 @@ static void fts_box_backends_init(struct mailbox *box) 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 @@ void fts_mailbox_opened(struct mailbox *box) 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);