diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2023-06-08 16:01:58 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2023-06-08 16:01:58 +0300 |
commit | b38f588b715030300d1641ef5fca2dba6d16d4e3 (patch) | |
tree | 51881a65eca3a38bfa229ab0a6a6b93c8100838c | |
parent | 60fd5370e70ea31e5bfeac3b1322a7f0cd99994e (diff) | |
download | mailman-master.tar.gz mailman-master.tar.bz2 |
* bin/mailsync: Remove mhonarc database if --reset is requested.
-rwxr-xr-x | bin/mailsync | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/bin/mailsync b/bin/mailsync index bc83a79..97a89b4 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -1,5 +1,5 @@ #! /usr/bin/python -# Copyright (C) 2014-2015 Sergey Poznyakoff +# Copyright (C) 2014-2023 Sergey Poznyakoff # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -26,8 +26,8 @@ from time import strftime, strptime from subprocess import Popen,PIPE,call dbg = 0 -dry_run = 0 -reset_state = 0 +dry_run = False +reset_state = False EX_OK = 0 EX_FAILURE = 1 @@ -124,6 +124,7 @@ def mboxtohtml(listid): else: n = get_state(listid) t = 0 + reset_map = {} for message in inbox.values()[n:]: frm = message.get_from() s = frm.split(' ', 1) @@ -133,6 +134,10 @@ def mboxtohtml(listid): dirname = absdir(conf['core']['htmlrootdir'] + "/" + listid + "/" + period) if not os.path.exists(dirname): os.makedirs(dirname, 02775) + reset_map[period] = True + elif reset_state and not period in reset_map: + os.remove(dirname + '/.mhonarc.db') + reset_map[period] = True cmd = [ 'mhonarc', '-add', @@ -278,9 +283,9 @@ if __name__ == '__main__': elif o in ("-c", "--config"): config = a elif o in ("-n", "--dry-run"): - dry_run = 1 + dry_run = True elif o in ("-r", "--reset"): - reset_state = 1 + reset_state = True if dry_run: dbg += 1 |