dovecot-1.2: FTS: If mail_debug=yes, log messages if fts is disa...
dovecot at dovecot.org
dovecot at dovecot.org
Sat Oct 25 15:55:39 EEST 2008
details: http://hg.dovecot.org/dovecot-1.2/rev/16a99d3a34dd
changeset: 8330:16a99d3a34dd
user: Timo Sirainen <tss at iki.fi>
date: Sat Oct 25 15:55:35 2008 +0300
description:
FTS: If mail_debug=yes, log messages if fts is disabled.
diffstat:
4 files changed, 16 insertions(+), 4 deletions(-)
src/plugins/fts-lucene/fts-backend-lucene.c | 2 ++
src/plugins/fts-squat/fts-backend-squat.c | 2 ++
src/plugins/fts/fts-plugin.c | 9 +++++++--
src/plugins/fts/fts-storage.c | 7 +++++--
diffs (74 lines):
diff -r c7d14e00c158 -r 16a99d3a34dd src/plugins/fts-lucene/fts-backend-lucene.c
--- 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 @@ static struct fts_backend *fts_backend_l
"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 -r c7d14e00c158 -r 16a99d3a34dd src/plugins/fts-squat/fts-backend-squat.c
--- 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 @@ static struct fts_backend *fts_backend_s
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 -r c7d14e00c158 -r 16a99d3a34dd src/plugins/fts/fts-plugin.c
--- 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
@@ -3,6 +3,8 @@
#include "lib.h"
#include "mail-storage-private.h"
#include "fts-plugin.h"
+
+#include <stdlib.h>
const char *fts_plugin_version = PACKAGE_VERSION;
@@ -10,8 +12,11 @@ void (*fts_next_hook_mailbox_opened)(str
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 -r c7d14e00c158 -r 16a99d3a34dd src/plugins/fts/fts-storage.c
--- 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 @@ static void fts_box_backends_init(struct
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 *
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);
More information about the dovecot-cvs
mailing list