summaryrefslogtreecommitdiff
path: root/cron
diff options
context:
space:
mode:
authorbwarsaw2002-05-28 03:11:19 +0000
committerbwarsaw2002-05-28 03:11:19 +0000
commit42e672a6f46b933ae4190ce4fac905e841228926 (patch)
treed78442afdd62237e9a1b89756784e7a87eec5cec /cron
parent4164a2ea7c53a030d5d33f853e14fffd3f55af18 (diff)
downloadmailman-42e672a6f46b933ae4190ce4fac905e841228926.tar.gz
mailman-42e672a6f46b933ae4190ce4fac905e841228926.tar.zst
mailman-42e672a6f46b933ae4190ce4fac905e841228926.zip
Diffstat (limited to 'cron')
-rwxr-xr-xcron/checkdbs48
1 files changed, 30 insertions, 18 deletions
diff --git a/cron/checkdbs b/cron/checkdbs
index cf1401b2f..163270490 100755
--- a/cron/checkdbs
+++ b/cron/checkdbs
@@ -50,27 +50,39 @@ def main():
mlist = MailList.MailList(name)
try:
count = mlist.NumRequestsPending()
- # Don't save the list since we've done nothing to modify its state
+ # While we're at it, let's evict yesterday's autoresponse data
+ midnightToday = Utils.midnight()
+ evictions = []
+ for sender in mlist.hold_and_cmd_autoresponses.keys():
+ date, count = mlist.hold_and_cmd_autoresponses[sender]
+ if Utils.midnight(date) < midnightToday:
+ evictions.append(sender)
+ if evictions:
+ for sender in evictions:
+ del mlist.hold_and_cmd_autoresponses[sender]
+ # Only here have we changed the list's database
+ mlist.Save()
+ if count:
+ i18n.set_language(mlist.preferred_language)
+ realname = mlist.real_name
+ text = Utils.maketext(
+ 'checkdbs.txt',
+ {'count' : count,
+ 'host_name': mlist.host_name,
+ 'adminDB' : mlist.GetScriptURL('admindb', absolute=1),
+ 'real_name': realname,
+ }, mlist=mlist)
+ text += '\n' + pending_requests(mlist)
+ subject = _(
+ '%(count)d %(realname)s moderator request(s) waiting')
+ msg = Message.UserNotification(mlist.GetOwnerEmail(),
+ mlist.GetBouncesEmail(),
+ subject, text,
+ mlist.preferred_language)
+ msg.send(mlist, **{'tomoderators': 1})
finally:
mlist.Unlock()
- if count:
- i18n.set_language(mlist.preferred_language)
- realname = mlist.real_name
- text = Utils.maketext(
- 'checkdbs.txt',
- {'count' : count,
- 'host_name': mlist.host_name,
- 'adminDB' : mlist.GetScriptURL('admindb', absolute=1),
- 'real_name': realname,
- }, mlist=mlist)
- text += '\n' + pending_requests(mlist)
- subject = _('%(count)d %(realname)s moderator request(s) waiting')
- msg = Message.UserNotification(mlist.GetOwnerEmail(),
- mlist.GetBouncesEmail(),
- subject, text,
- mlist.preferred_language)
- msg.send(mlist, **{'tomoderators': 1})