]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
FTS: If mail_debug=yes, log messages if fts is disabled.
authorTimo Sirainen <tss@iki.fi>
Sat, 25 Oct 2008 12:55:35 +0000 (15:55 +0300)
committerTimo Sirainen <tss@iki.fi>
Sat, 25 Oct 2008 12:55:35 +0000 (15:55 +0300)
--HG--
branch : HEAD

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

index 77e0866b53eac5e7b9dac674bca9c299c999565e..0d1bd49809828a6f25f5aad05bb5a5e4556d98e2 100644 (file)
@@ -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;
                }
 
index 292b0359ae87a05755763b2bbfbb49040813cfb6..bc3aeda0c5bc0a4bd905c4c4833588a6512be6f3 100644 (file)
@@ -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;
        }
 
index 1a40b307074e34087f911dbd2a35205e54d75953..ba9c44fb946f6c01cfa775d3d7901e6367820c2c 100644 (file)
@@ -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)
index 50ae01fb65cd986a73cc3fa397f59661a5379ade..9f135616e9a904199e8ff967031bd053eb47d346 100644 (file)
@@ -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);