[vhffs-dev] [376] Adding public archive generator using mhonarc

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 376
Author:   gradator
Date:     2006-12-17 01:37:21 +0000 (Sun, 17 Dec 2006)

Log Message:
-----------
Adding public archive generator using mhonarc

Modified Paths:
--------------
    trunk/Makefile
    trunk/vhffs-backend/conf/vhffs.conf

Added Paths:
-----------
    trunk/vhffs-listengine/misc/
    trunk/vhffs-listengine/misc/config.mhonarc
    trunk/vhffs-robots/src/listengine_publicarchives.pl


Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2006-12-16 21:55:41 UTC (rev 375)
+++ trunk/Makefile	2006-12-17 01:37:21 UTC (rev 376)
@@ -129,9 +129,10 @@
 	install -d -m 755 $(LEWEB)
 	install -d -m 755 $(LEWEB)/archives
 	install -d -m 755 $(LEWEB)/templates
-	install -m 755 vhffs-listengine/src/archives/archives.pl      $(LEWEB)/archives/
-	install -m 755 vhffs-listengine/src/archives/show_msg.pl      $(LEWEB)/archives/
+	install -d -m 755 $(LEWEB)/misc
+	install -m 755 vhffs-listengine/src/archives/*.pl             $(LEWEB)/archives/
 	install -m 644 vhffs-listengine/src/archives/templates/*.tmpl $(LEWEB)/templates
+	install -m 644 vhffs-listengine/src/misc/*                    $(LEWEB)/misc
 	if [ ! -L $(LEWEB)/archives/themes ]; then ln -fs $(PANELDIR)/themes $(LEWEB)/archives/themes ; fi
 
 install-listengine: install-listengine-web

Modified: trunk/vhffs-backend/conf/vhffs.conf
===================================================================
--- trunk/vhffs-backend/conf/vhffs.conf	2006-12-16 21:55:41 UTC (rev 375)
+++ trunk/vhffs-backend/conf/vhffs.conf	2006-12-17 01:37:21 UTC (rev 376)
@@ -276,6 +276,8 @@
 		smtp_server	= "localhost"
 		#Directory which contains template for the archives
 		templatesdir	=	/usr/share/vhffs/listengine/templates/
+		#Directory which contains misc files
+		miscdir		=	/usr/share/vhffs/listengine/misc/
 		#Url of archives
 		www-archives	=	http://localhost/listengine
 	</listengine>

Added: trunk/vhffs-listengine/misc/config.mhonarc
===================================================================
--- trunk/vhffs-listengine/misc/config.mhonarc	2006-12-16 21:55:41 UTC (rev 375)
+++ trunk/vhffs-listengine/misc/config.mhonarc	2006-12-17 01:37:21 UTC (rev 376)
@@ -0,0 +1,301 @@
+<!-- variable definitions, change as necessary -->
+
+<UMASK>
+0022
+</UMASK>
+
+<DBFILEPERMS>
+0600
+</DBFILEPERMS>
+
+<FILEPERMS>
+0644
+</FILEPERMS>
+
+<SPAMMODE>
+
+<NODOC>
+
+<timezones>
+<!-- These numbers are negated because mhonarc SUBTRACTS offsets! -->
+NST: 3.5
+UT: 0
+BST: -1
+MET: -1
+EET: -2
+JST: -9
+GMT-12: 12
+GMT-11: 11
+GMT-10: 10
+GMT-9: 9
+GMT-8: 8
+GMT-7: 7
+GMT-6: 6
+GMT-5: 5
+GMT-4: 4
+GMT-3: 3
+GMT-2: 2
+GMT-1: 1
+GMT+1: -1
+GMT+2: -2
+GMT+3: -3
+GMT+4: -4
+GMT+5: -5
+GMT+6: -6
+GMT+7: -7
+GMT+8: -8
+GMT+9: -9
+GMT+10: -10
+GMT+11: -11
+GMT+12: -12
+GMT+13: -13
+PST8PDT: +8
+</timezones>
+
+
+<!-- generate maillist.html and threads.html -->
+<idxfname>
+maillist.html
+</idxfname>
+
+<tidxfname>
+threads.html
+</tidxfname>
+
+<!-- date index customization -->
+<IdxPgBegin>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+
+<head>
+	<title>$IDXTITLE$</title>
+	<style type="text/css">
+	hr { color: #929292; height: 2px; }
+	</style>
+	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+</head>
+
+<body bgcolor="#ffffff" text="#000000" link="#777777" vlink="#aaaaaa">
+
+<table cellspacing="0" cellpadding="4" border="0" width="100%" bgcolor="#929292">
+<tr><td><font size="+2">$IDXTITLE$</font></td></tr>
+</table>
+</IdxPgBegin>
+
+<IdxPgEnd>
+<br/>
+<table cellspacing="0" cellpadding="4" border="0" width="100%" bgcolor="#929292">
+<tr>
+<td align="left">Mail converted by <a href="http://www.mhonarc.org/"; style="font-size: small; color: #000000;">MHonArc</a> $VERSION$</td>
+<td align="right"><a href="http://listengine.tuxfamily.org/"; style="font-size: small; color: #000000;">http://listengine.tuxfamily.org/</a></td>
+</tr>
+</table>
+</body>
+</html>
+</IdxPgEnd>
+
+<title>
+$MAIN-TITLE$
+</title>
+
+<msglocaldatefmt>
+%H:%M, %a %b %d
+</msglocaldatefmt>
+
+<gmtdatefmt>
+%a %d %B at %H:%M GMT
+</gmtdatefmt>
+
+<listbegin>
+<p>[ <a href="$TIDXFNAME$">Thread Index</a>
+<!-- | <a href="../">More $MAIN-TITLE$ Archives</A> -->
+] </p>
+<p>$NUMOFMSG$ message(s), the most recent arriving on $GMTDATE$.</p>
+<hr/>
+</listbegin>
+
+<daybegin>
+$MSGLOCALDATE(CUR;%A %B %d)$
+<ul>
+</daybegin>
+
+<dayend>
+</ul>
+</dayend>
+
+<listend>
+
+</listend>
+
+<litemplate>
+<li><strong>$SUBJECT$</strong> <em>$FROMNAME$</em></li>
+</litemplate>
+
+<!-- thread index customization -->
+<TIdxPgBegin>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+
+<head>
+	<title>$TIDXTITLE$</title>
+	<style type="text/css">
+	hr { color: #929292; height: 2px; }
+	</style>
+	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+</head>
+
+<body bgcolor="#ffffff" text="#000000" link="#777777" vlink="#aaaaaa">
+
+<table cellspacing="0" cellpadding="4" border="0" width="100%" bgcolor="#929292">
+<tr><td><font size="+2">$TIDXTITLE$</font></td></tr>
+</table>
+</TIdxPgBegin>
+
+<TIdxPgEnd>
+<br/>
+<table cellspacing="0" cellpadding="4" border="0" width="100%" bgcolor="#929292">
+<tr>
+<td align="left">Mail converted by <a href="http://www.mhonarc.org/"; style="font-size: small; color: #000000;">MHonArc</a> $VERSION$</td>
+<td align="right"><a href="http://listengine.tuxfamily.org/"; style="font-size: small; color: #000000;">http://listengine.tuxfamily.org/</a></td>
+</tr>
+</table>
+</body>
+</html>
+</TIdxPgEnd>
+
+<ttitle>
+$MAIN-TITLE$
+</ttitle>
+
+<tlevels>
+9
+</tlevels>
+
+<thead>
+<p>[ <a href="$IDXFNAME$">Date Index</a>
+<!-- | <a href="../">More $MAIN-TITLE$ Archives</a> -->
+] </p>
+<p>$NUMOFMSG$ message(s), the most recent arriving on $GMTDATE$.</p>
+<hr/>
+<p>
+<ul>
+</thead>
+
+<tfoot>
+</ul>
+<p>
+</tfoot>
+
+<ttopbegin>
+<li><a $A_NAME$><strong>$SUBJECTNA$</strong></a>
+<ul>
+<li><a $A_HREF$>$FROMNAME$</a> <em>$MSGLOCALDATE$</em>
+</ttopbegin>
+
+<tsingletxt>
+<li><a $A_NAME$><strong>$SUBJECTNA$</strong></a>
+<ul>
+<li><a $A_HREF$>$FROMNAME$</a> <em>$MSGLOCALDATE$</em></li>
+</ul>
+<br/>
+</li>
+</tsingletxt>
+
+<tlitxt>
+<li><a $A_HREF$>$FROMNAME$</a> <em>$MSGLOCALDATE$</em>
+</tlitxt>
+
+<tliend>
+</li>
+</tliend>
+
+<ttopend>
+<br/>
+</li></ul>
+</ttopend>
+
+<!-- if we used the Subject line to determine if this is a followup ... -->
+
+<tsubjectbeg>
+<!-- Possible follow-ups --><li><em>Possible follow-up(s)</em></li>
+</tsubjectbeg>
+
+<!-- message customization -->
+<excs>
+resent-.*
+references
+in-reply-to
+mail-followup-to
+importance
+priority
+delivered-to
+list-.*
+sender
+envelope-to
+user-agent
+reply-to
+</excs>
+
+<MsgPgBegin>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+
+<head>
+	<title>$SUBJECTNA:72$</title>
+	<link rev="made" href="mailto:$FROMADDR$";>
+	<link rel="start" href="../">
+	<link rel="contents" href="$TIDXFNAME$#$MSGNUM$">
+	<link rel="index" href="$IDXFNAME$#$MSGNUM$">
+	<link rel="prev" href="$MSG(TPREV)$">
+	<link rel="next" href="$MSG(TNEXT)$">
+	<style type="text/css">
+	hr { color: #929292; height: 2px; }
+	</style>
+	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+</head>
+
+<body bgcolor="#ffffff" text="#000000" link="#777777" vlink="#aaaaaa">
+</MsgPgBegin>
+
+<MsgPgEnd>
+<br/>
+<table cellspacing="0" cellpadding="4" border="0" width="100%" bgcolor="#929292">
+<tr>
+<td align="left">Mail converted by <a href="http://www.mhonarc.org/"; style="font-size: small; color: #000000;">MHonArc</a> $VERSION$</td>
+<td align="right"><a href="http://listengine.tuxfamily.org/"; style="font-size: small; color: #000000;">http://listengine.tuxfamily.org/</a></td>
+</tr>
+</table>
+</body>
+</html>
+</MsgPgEnd>
+
+<msghead>
+
+</msghead>
+
+<toplinks>
+
+</toplinks>
+
+<SubjectHeader>
+<table cellspacing="0" cellpadding="4" border="0" width="100%" bgcolor="#929292">
+<tr><td><font size="+2">$SUBJECTNA$</font></td></tr>
+</table>
+
+<p>[ <a href="$TIDXFNAME$">Thread Index</a> | 
+<a href="$IDXFNAME$">Date Index</a>
+<!-- | <a href="../">More $MAIN-TITLE$ Archives</a> -->
+] </p>
+</SubjectHeader>
+
+<HeadBodySep>
+<hr/>
+</HeadBodySep>
+
+<BotLinks>
+<ul>
+<li><b>Messages sorted by:</b> [ <a href="$IDXFNAME$#$MSGNUM$">date</A> | <a href="$TIDXFNAME$#$MSGNUM$">thread</A> ]</li>
+$LINK(PREV)$$LINK(NEXT)$
+$LINK(TPREV)$$LINK(TNEXT)$
+</ul>
+</BotLinks>

Added: trunk/vhffs-robots/src/listengine_publicarchives.pl
===================================================================
--- trunk/vhffs-robots/src/listengine_publicarchives.pl	2006-12-16 21:55:41 UTC (rev 375)
+++ trunk/vhffs-robots/src/listengine_publicarchives.pl	2006-12-17 01:37:21 UTC (rev 376)
@@ -0,0 +1,103 @@
+#!/usr/bin/perl -w 
+
+use strict;
+
+use Vhffs::Main;
+use Vhffs::Group;
+use Vhffs::Functions;
+use Vhffs::Services::Mailing;
+use Vhffs::Constants;
+
+my $vhffs = init Vhffs::Main;
+die "Cannot init vhffs" if ( !defined $vhffs  ||  $vhffs < 0 );
+
+my $listdir;
+my $outputlistdir;
+my @years;
+my $year;
+my $yearpath;
+my $outputyeardir;
+my @months;
+my $month;
+my $monthpath;
+my $outputmonthdir;
+my $cmd;
+
+my $archivedir = $vhffs->get_config->get_listengine_datadir."/archives";
+my $outputdir = $vhffs->get_config->get_listengine_datadir."/public";
+
+my $configmhonarc;
+my $leconfig = $vhffs->get_config->get_service( "listengine" );
+$configmhonarc = $leconfig->{miscdir}."/config.mhonarc" if ( defined $leconfig );
+$configmhonarc = "/usr/share/vhffs/listengine/misc/config.mhonarc" if( ! -f $configmhonarc );
+die "mhonarc configuration file unavailable" if( ! -f $configmhonarc );
+
+
+mkdir($outputdir, 0755);
+if (! -d $outputdir)  { die "Cannot create ".$outputdir." directory\n"; };
+
+my $lists = Vhffs::Services::Mailing::getall( $vhffs , Vhffs::Constants::ACTIVATED , undef );
+if( defined $lists )
+{
+	foreach my $list ( @{$lists} )
+	{
+#		print $list->get_domain." ".$list->get_localpart." ".Vhffs::Group::get_name_by_gid( $vhffs , $list->get_ownergid )." ".$list->get_oid." ".Vhffs::Functions::status_string_from_status_id( $list->get_status )."\n";
+
+		next if ( !defined $list->get_domain  ||  !defined $list->get_localpart  ||  $list->get_domain eq ""  ||  $list->get_localpart eq "" );
+
+		# delete previous public archives (if available) if there is no public archives for this list
+		if ( $list->get_open_archive == 0 )  {
+			my $publicdir = $outputdir."/".$list->get_domain."/".$list->get_localpart;
+			if ( -d $publicdir)  {
+				system("rm -rf $publicdir 2>/dev/null");
+			}
+			next;
+		}
+
+		$listdir = $archivedir."/".$list->get_domain."/".$list->get_localpart;
+		next if( !defined opendir( LISTDIR , $listdir ) );
+
+		$outputlistdir = $outputdir."/".$list->get_domain;
+		mkdir($outputlistdir, 0755);
+		if (! -d $outputlistdir)  { die "Cannot create ".$outputlistdir." directory\n"; };
+
+		$outputlistdir = $outputdir."/".$list->get_domain."/".$list->get_localpart;
+		mkdir($outputlistdir, 0755);
+		if (! -d $outputlistdir)  { die "Cannot create ".$outputlistdir." directory\n"; };
+
+		@years = readdir( LISTDIR );
+		foreach $year ( @years )
+		{
+			next if( ( $year eq '.' ) || ( $year eq '..' ) );
+
+			$yearpath = $listdir."/".$year;
+
+			next if( !defined opendir( YEARDIR , $yearpath ) );
+
+			$outputyeardir = $outputlistdir."/".$year;
+			mkdir($outputyeardir, 0755);
+			if (! -d $outputyeardir)  { die "Cannot create ".$outputyeardir." directory\n"; };
+
+			@months = readdir( YEARDIR );
+			foreach $month ( @months )
+			{
+				next if( ( $month eq '.' ) || ( $month eq '..' ) );
+
+				$monthpath = $yearpath."/".$month;
+
+				$outputmonthdir = $outputyeardir."/".$month;
+				mkdir($outputmonthdir, 0755);
+				if (! -d $outputmonthdir)  { die "Cannot create ".$outputmonthdir." directory\n"; };
+
+				print $monthpath." -> ".$outputmonthdir."\n";
+				$cmd = "mhonarc -add -rc " . $configmhonarc . " -definevar MAIN-TITLE='" . $list->get_domain . "/" . $list->get_localpart . "' -outdir " . $outputmonthdir . " " . $monthpath . "/*/*";
+				print $cmd."\n";
+				system( $cmd );
+			}
+
+			closedir ( YEARDIR );
+		}
+
+		closedir( LISTDIR );
+	}
+}


Property changes on: trunk/vhffs-robots/src/listengine_publicarchives.pl
___________________________________________________________________
Name: svn:executable
   + *


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/