1#!--PERL-- 2# -*- indent-tabs-mode: nil; -*- 3# vim:ft=perl:et:sw=4 4# $Id$ 5 6use lib split(/:/, $ENV{SYMPALIB} || ''), '--modulesdir--'; 7use strict; 8use warnings; 9use English qw(-no_match_vars); 10 11use Conf; 12use Sympa::Constants; 13use Sympa::Log; 14use Sympa::Spool::Moderation; 15 16my $log = Sympa::Log->instance; 17 18unless (Conf::load(Sympa::Constants::CONFIG)) { 19 die 'Can\'t load Sympa configuration file'; 20} 21$log->openlog( 22 $Conf::Conf{'syslog'}, 23 $Conf::Conf{'log_socket_type'}, 24 service => 'sympa/mod2html' 25); 26 27# Set the UserID & GroupID for the process 28$GID = $EGID = (getgrnam(Sympa::Constants::GROUP))[2]; 29$UID = $EUID = (getpwnam(Sympa::Constants::USER))[2]; 30 31# Sets the UMASK. 32umask oct $Conf::Conf{'umask'}; 33 34my $spool_mod = Sympa::Spool::Moderation->new; 35 36while (1) { 37 my ($message, $handle) = $spool_mod->next(no_lock => 1); 38 last unless $handle; 39 next unless $message; 40 41 my $context = $message->{context}; 42 next 43 unless ref $context eq 'Sympa::List' 44 and $message->{authkey} 45 and $message->{authkey} =~ /\A\w+\z/; 46 next 47 if -f join('/', 48 $spool_mod->{html_base_directory}, $context->get_id, 49 $message->{authkey}, 'msg00000.html'); 50 51 printf "Creating HTML version for %s\n", $message->get_id; 52 53 $spool_mod->html_store($message, $message->{authkey}); 54} 55 56exit 0; 57 58__END__ 59 60=encoding utf-8 61 62=head1 NAME 63 64mod2html, mod2html.pl - Generates HTML view of messages to be moderated 65 66=head1 SYNOPSIS 67 68 mod2html.pl 69 70=head1 DESCRIPTION 71 72Until Sympa release 3.4.3.1, HTML view of moderated messages was created by 73wwsympa.fcgi, when needed. 74It is now created by sympa.pl when the message is received. 75 76This script will create all missing HTML files. 77 78=head1 CONFIGURATION PARAMETERS 79 80Following site configuration parameters in F<--CONFIG--> will be referred. 81 82=over 83 84=item mhonarc 85 86Path to MHonArc mail-to-HTML converter. 87 88=item queuemod 89 90Directory for moderation spool. 91 92=item viewmail_dir 93 94Directory containing HTML file generated by MHonArc while displaying messages 95other than archives. 96 97=back 98 99=head1 HISTORY 100 101mod2html.pl appeared on Sympa 3.4.4. 102 1036.2a.32 or earlier stored HTML view into moderation spool. 1046.2b has dedicated directory specified by viewmail_dir parameter. 105 106=cut 107