aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2023-06-08 16:01:58 +0300
committerSergey Poznyakoff <gray@gnu.org>2023-06-08 16:01:58 +0300
commitb38f588b715030300d1641ef5fca2dba6d16d4e3 (patch)
tree51881a65eca3a38bfa229ab0a6a6b93c8100838c
parent60fd5370e70ea31e5bfeac3b1322a7f0cd99994e (diff)
downloadmailman-master.tar.gz
mailman-master.tar.bz2
Minor fixHEADmaster
* bin/mailsync: Remove mhonarc database if --reset is requested.
-rwxr-xr-xbin/mailsync15
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

Return to:

Send suggestions and report system problems to the System administrator.