Mercurial > dovecot > core-2.2
changeset 20217:f8e7e20407d4
lib-storage: Added MAILBOX_FLAG_DELETE_UNSAFE
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Fri, 27 May 2016 22:15:07 +0300 |
parents | 4dd0eae220d3 |
children | bb25b02501b8 |
files | src/lib-storage/mail-storage.h src/plugins/lazy-expunge/lazy-expunge-plugin.c src/plugins/quota/quota-storage.c |
diffstat | 3 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/mail-storage.h Fri May 06 00:29:16 2016 +0300 +++ b/src/lib-storage/mail-storage.h Fri May 27 22:15:07 2016 +0300 @@ -49,7 +49,13 @@ /* Force opening mailbox and ignoring any ACLs */ MAILBOX_FLAG_IGNORE_ACLS = 0x100, /* Open mailbox even if it's already marked as deleted */ - MAILBOX_FLAG_OPEN_DELETED = 0x200 + MAILBOX_FLAG_OPEN_DELETED = 0x200, + /* Mailbox is opened for deletion, which should be performed as + efficiently as possible, even allowing the mailbox state to become + inconsistent. For example this disables lazy_expunge plugin and + quota updates (possibly resulting in broken quota). and This is + useful for example when deleting entire user accounts. */ + MAILBOX_FLAG_DELETE_UNSAFE = 0x400 }; enum mailbox_feature {
--- a/src/plugins/lazy-expunge/lazy-expunge-plugin.c Fri May 06 00:29:16 2016 +0300 +++ b/src/plugins/lazy-expunge/lazy-expunge-plugin.c Fri May 27 22:15:07 2016 +0300 @@ -448,7 +448,7 @@ union mailbox_module_context *mbox; struct mailbox_vfuncs *v = box->vlast; - if (llist == NULL) + if (llist == NULL || (box->flags & MAILBOX_FLAG_DELETE_UNSAFE) != 0) return; mbox = p_new(box->pool, union mailbox_module_context, 1);
--- a/src/plugins/quota/quota-storage.c Fri May 06 00:29:16 2016 +0300 +++ b/src/plugins/quota/quota-storage.c Fri May 27 22:15:07 2016 +0300 @@ -328,7 +328,8 @@ if (qbox->module_ctx.super.sync_notify != NULL) qbox->module_ctx.super.sync_notify(box, uid, sync_type); - if (sync_type != MAILBOX_SYNC_TYPE_EXPUNGE || qbox->recalculate) { + if (sync_type != MAILBOX_SYNC_TYPE_EXPUNGE || qbox->recalculate || + (box->flags & MAILBOX_FLAG_DELETE_UNSAFE) != 0) { if (uid == 0) { /* free the transaction before view syncing begins, otherwise it'll crash. */