Hi all,
This patch should let the administrator specify alternative external
archivers. All you have to do is set the PUBLIC_EXTERNAL_ARCHIVER and/or
PRIVATE_EXTERNAL_ARCHIVER variables to the command line you wish to use. If
you put "$LISTNAME" or "${LISTNAME}" in the command line, it is replaced
with the name of the list. Mailman will run the command line and pipe each
post to it.
The main advantage to this is that all post filtering is done without
having to subscribe a procmailrc to the list. This prevents list-admins
from accidentally unsubscribing the archiver.
If the variables given above are set to "" (the default), Mailman will fall
back to the built-in Pipermail archiver, so this should not break any
existing installations.
My apologies for using regsub, but I have not been able to find enough
documentation on the re module. Perhaps someone better acquainted with it
could migrate this patch to it?
--
Paul Hebble
-- BEGIN PATCH (Also attached in gzip format)
diff -Nru --exclude=CVS --exclude=Makefile --exclude=crontab.in --exclude=mm_cfg.py.dist --exclude=*.pyc --exclude=.*.tmp --exclude=config.* mailman/Mailman/Archiver/Archiver.py mailman-archiving/Mailman/Archiver/Archiver.py
--- mailman/Mailman/Archiver/Archiver.py Thu Jul 1 13:59:51 1999
+++ mailman-archiving/Mailman/Archiver/Archiver.py Tue Aug 3 09:46:14 1999
@@ -29,6 +29,7 @@
import sys, os, string
import errno
from Mailman.Utils import reraise, mkdir
+import regsub
#
# package/project modules
@@ -174,6 +175,13 @@
# Resurrect original date setting.
post.SetHeader('Date', olddate)
+ def ExternalArchive(self, ar, txt):
+ regsub.gsub("\$LISTNAME\>", self.real_name, ar)
+ regsub.gsub("\${LISTNAME}", self.real_name, ar)
+ extarch = os.popen(ar, "w")
+ extarch.write(txt)
+ extarch.close()
+
#
# archiving in real time this is called from list.post(msg)
#
@@ -207,6 +215,16 @@
if line and line[:5] == 'From ':
line = '>' + line
txt = txt + "%s\n" % line
+ if not self.archive_private \
+ and mm_cfg.PUBLIC_EXTERNAL_ARCHIVER is not "" and \
+ mm_cfg.PUBLIC_EXTERNAL_ARCHIVER is not "pipermail":
+ ExternalArchive(mm_cfg.PUBLIC_EXTERNAL_ARCHIVER, txt)
+ os._exit(0)
+ if self.archive_private \
+ and mm_cfg.PRIVATE_EXTERNAL_ARCHIVER is not "" and \
+ mm_cfg.PRIVATE_EXTERNAL_ARCHIVER is not "pipermail":
+ ExternalArchive(mm_cfg.PRIVATE_EXTERNAL_ARCHIVER, txt)
+ os._exit(0)
f = StringIO(txt)
import HyperArch
h = HyperArch.HyperArchive(self)
diff -Nru --exclude=CVS --exclude=Makefile --exclude=crontab.in --exclude=mm_cfg.py.dist --exclude=*.pyc --exclude=.*.tmp --exclude=config.* mailman/Mailman/Defaults.py mailman-archiving/Mailman/Defaults.py
--- mailman/Mailman/Defaults.py Wed Aug 4 10:16:26 1999
+++ mailman-archiving/Mailman/Defaults.py Tue Aug 3 09:14:44 1999
@@ -62,6 +62,8 @@
#
DEFAULT_ARCHIVE_VOLUME_FREQUENCY = 1
+PUBLIC_EXTERNAL_ARCHIVER = ""
+PRIVATE_EXTERNAL_ARCHIVER = ""
HOME_PAGE = 'index.html'
MAILMAN_OWNER = 'mailman-owner@%s' % DEFAULT_HOST_NAME
diff -Nru --exclude=CVS --exclude=Makefile --exclude=crontab.in --exclude=mm_cfg.py.dist --exclude=*.pyc --exclude=.*.tmp --exclude=config.* mailman/Mailman/Defaults.py.in mailman-archiving/Mailman/Defaults.py.in
--- mailman/Mailman/Defaults.py.in Mon Aug 2 11:42:20 1999
+++ mailman-archiving/Mailman/Defaults.py.in Tue Aug 3 09:15:02 1999
@@ -62,6 +62,8 @@
#
DEFAULT_ARCHIVE_VOLUME_FREQUENCY = 1
+PUBLIC_EXTERNAL_ARCHIVER = ""
+PRIVATE_EXTERNAL_ARCHIVER = ""
HOME_PAGE = 'index.html'
MAILMAN_OWNER = 'mailman-owner@%s' % DEFAULT_HOST_NAME