diff --git a/configure.ac b/configure.ac index f3355bf5d..a56af4f71 100644 --- a/configure.ac +++ b/configure.ac @@ -664,7 +664,6 @@ AC_CONFIG_FILES([ po/web_help/Makefile.in service/Makefile src/Makefile - src/bin/Makefile src/cgi/Makefile src/lib/Makefile src/libexec/Makefile diff --git a/doc/sympa_toc.pod b/doc/sympa_toc.pod index c8086b434..40a30cfa0 100644 --- a/doc/sympa_toc.pod +++ b/doc/sympa_toc.pod @@ -89,16 +89,6 @@ Alias database maintenance =back -=head3 Maintenance tools - -=over - -=item L - -Generates HTML view of messages to be moderated - -=back - =head2 Auxiliary Programs =over diff --git a/src/Makefile.am b/src/Makefile.am index 81edd5a08..0895a9c54 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -20,5 +20,4 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -SUBDIRS = bin cgi lib libexec sbin - +SUBDIRS = cgi lib libexec sbin \ No newline at end of file diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am deleted file mode 100644 index 6ece64f61..000000000 --- a/src/bin/Makefile.am +++ /dev/null @@ -1,61 +0,0 @@ -# $Id$ - -# Sympa - SYsteme de Multi-Postage Automatique -# -# Copyright (c) 1997, 1998, 1999 Institut Pasteur & Christophe Wolfhugel -# Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010, 2011 Comite Reseau des Universites -# Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017 GIP RENATER -# Copyright 2018 The Sympa Community. See the AUTHORS.md file at the -# top-level directory of this distribution and at -# . -# -# 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 -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -perlscripts = \ - mod2html.pl - -script_SCRIPTS = $(perlscripts) - -man1_MANS = \ - mod2html.1 - -EXTRA_DIST = \ - mod2html.pl.in - -CLEANFILES = $(perlscripts) $(bin_SCRIPTS) $(man1_MANS) - -mod2html.pl: Makefile - @rm -f $@ - $(AM_V_GEN)$(SED) \ - -e 's|--PERL--|$(PERL)|' \ - -e 's|--defaultdir--|$(defaultdir)|' \ - -e 's|--docdir--|$(docdir)|' \ - -e 's|--libexecdir--|$(libexecdir)|' \ - -e 's|--localedir--|$(localedir)|' \ - -e 's|--modulesdir--|$(modulesdir)|' \ - -e 's|--piddir--|$(piddir)|' \ - -e 's|--spooldir--|$(spooldir)|' \ - -e 's|--sysconfdir--|$(sysconfdir)|' \ - -e 's|--CONFIG--|$(CONFIG)|' \ - -e 's|--SENDMAIL_ALIASES--|$(SENDMAIL_ALIASES)|' \ - < $(srcdir)/$@.in > $@ - @chmod +x $@ - -mod2html.pl: $(srcdir)/mod2html.pl.in - -.pl.1: Makefile - @rm -f $@ - $(AM_V_GEN)$(POD2MAN) --section=1 --center="sympa $(VERSION)" \ - --lax --release="$(VERSION)" $< $@ diff --git a/src/bin/mod2html.pl.in b/src/bin/mod2html.pl.in deleted file mode 100755 index c86a9d94f..000000000 --- a/src/bin/mod2html.pl.in +++ /dev/null @@ -1,106 +0,0 @@ -#!--PERL-- -# -*- indent-tabs-mode: nil; -*- -# vim:ft=perl:et:sw=4 -# $Id$ - -use lib split(/:/, $ENV{SYMPALIB} || ''), '--modulesdir--'; -use strict; -use warnings; -use English qw(-no_match_vars); - -use Conf; -use Sympa::Constants; -use Sympa::Log; -use Sympa::Spool::Moderation; - -my $log = Sympa::Log->instance; - -unless (Conf::load(Sympa::Constants::CONFIG)) { - die 'Can\'t load Sympa configuration file'; -} -$log->openlog( - $Conf::Conf{'syslog'}, - $Conf::Conf{'log_socket_type'}, - service => 'sympa/mod2html' -); - -# Set the UserID & GroupID for the process -$GID = $EGID = (getgrnam(Sympa::Constants::GROUP))[2]; -$UID = $EUID = (getpwnam(Sympa::Constants::USER))[2]; - -# Sets the UMASK. -umask oct $Conf::Conf{'umask'}; - -my $spool_mod = Sympa::Spool::Moderation->new; - -while (1) { - my ($message, $handle) = $spool_mod->next(no_lock => 1); - last unless $handle; - next unless $message; - - my $context = $message->{context}; - next - unless ref $context eq 'Sympa::List' - and $message->{authkey} - and $message->{authkey} =~ /\A\w+\z/; - next - if -f join('/', - $spool_mod->{html_base_directory}, $context->get_id, - $message->{authkey}, 'msg00000.html'); - - printf "Creating HTML version for %s\n", $message->get_id; - - $spool_mod->html_store($message, $message->{authkey}); -} - -exit 0; - -__END__ - -=encoding utf-8 - -=head1 NAME - -mod2html, mod2html.pl - Generates HTML view of messages to be moderated - -=head1 SYNOPSIS - - mod2html.pl - -=head1 DESCRIPTION - -Until Sympa release 3.4.3.1, HTML view of moderated messages was created by -wwsympa.fcgi, when needed. -It is now created by sympa_msg.pl daemon when the message is received. - -This script will create all missing HTML files. - -=head1 CONFIGURATION PARAMETERS - -Following site configuration parameters in F<--CONFIG--> will be referred. - -=over - -=item mhonarc - -Path to MHonArc mail-to-HTML converter. - -=item queuemod - -Directory for moderation spool. - -=item viewmail_dir - -Directory containing HTML file generated by MHonArc while displaying messages -other than archives. - -=back - -=head1 HISTORY - -mod2html.pl appeared on Sympa 3.4.4. - -6.2a.32 or earlier stored HTML view into moderation spool. -6.2b has dedicated directory specified by viewmail_dir parameter. - -=cut diff --git a/src/cgi/wwsympa.fcgi.in b/src/cgi/wwsympa.fcgi.in index 41572e4fc..f666a0214 100644 --- a/src/cgi/wwsympa.fcgi.in +++ b/src/cgi/wwsympa.fcgi.in @@ -7905,10 +7905,36 @@ sub do_viewmod { push(@{$param->{'available_files'}}, $file); } - my $html_dir = - $Conf::Conf{'viewmail_dir'} . '/mod/' - . $list->get_id . '/' - . $in{'id'}; + my $id = $in{'id'}; + + my $spool_mod = + Sympa::Spool::Moderation->new(context => $list, authkey => $id); + my ($message, $handle); + while (1) { + ($message, $handle) = $spool_mod->next(no_lock => 1); + last unless $handle; + last if $message and not $message->{validated}; + } + unless ($message) { + add_stash('user', 'already_moderated', {key => $id}); + wwslog('err', 'Unable to get message with <%s> for list %s', + $id, $list); + web_db_log( + { 'parameters' => $id, + 'status' => 'error', + 'error_type' => 'internal' + } + ); + return undef; + } + + my $html_dir = sprintf '%s/mod/%s/%s', + $Conf::Conf{'viewmail_dir'}, $list->get_id, $id; + unless (-d $html_dir) { + # Keep decrypted form for HTML view. + $message->smime_decrypt; + $spool_mod->html_store($message, $id); + } unless (-d $html_dir) { add_stash('intern', 'no_html_message_available', {dir => $html_dir}); @@ -7933,32 +7959,9 @@ sub do_viewmod { close $fh; } - #XXX#FIXME: Is this required? + #XXX Not required anymore. #XXXpush @other_include_path, $html_dir; - my $id = $in{'id'}; - - my $spool_mod = - Sympa::Spool::Moderation->new(context => $list, authkey => $id); - my ($message, $handle); - while (1) { - ($message, $handle) = $spool_mod->next(no_lock => 1); - last unless $handle; - last if $message and not $message->{validated}; - } - unless ($message) { - add_stash('user', 'already_moderated', {key => $id}); - wwslog('err', 'Unable to get message with <%s> for list %s', - $id, $list); - web_db_log( - { 'parameters' => $id, - 'status' => 'error', - 'error_type' => 'internal' - } - ); - return undef; - } - my ($date_smtp, $date_epoch, $date); $date_smtp = $message->get_header('Date') || undef; if ($date_smtp) { diff --git a/src/lib/Sympa/Spindle/ToModeration.pm b/src/lib/Sympa/Spindle/ToModeration.pm index cb4841d8a..f4460e391 100644 --- a/src/lib/Sympa/Spindle/ToModeration.pm +++ b/src/lib/Sympa/Spindle/ToModeration.pm @@ -122,14 +122,10 @@ sub _send_confirm_to_editor { my $list = $message->{context}; my $spool_mod = Sympa::Spool::Moderation->new(context => $list); - my $modkey; # Keeps a copy of the message. # Move message to mod spool. - # If crypted, store the crypted form of the message (keep decrypted - # form for HTML view). - if ($modkey = $spool_mod->store($message, original => 1)) { - $spool_mod->html_store($message, $modkey); - } + # If crypted, store the crypted form of the message. + my $modkey = $spool_mod->store($message, original => 1); unless ($modkey) { $log->syslog('err', 'Cannot create moderation key of %s for %s', $message, $list); diff --git a/src/lib/Sympa/Upgrade.pm b/src/lib/Sympa/Upgrade.pm index 32e30b233..9040980b1 100644 --- a/src/lib/Sympa/Upgrade.pm +++ b/src/lib/Sympa/Upgrade.pm @@ -1218,14 +1218,15 @@ sub upgrade { } } - # Create HTML view of pending messages - if (lower_version($previous_version, '6.2b.1')) { - $log->syslog('notice', 'Creating HTML view of moderation spool...'); - my $status = - system(Sympa::Constants::SCRIPTDIR() . '/' . 'mod2html.pl') >> 8; - $log->syslog('err', 'mod2html.pl failed with status %s', $status) - if $status; - } + # 6.2.70: Now HTML view of held messages will be created on demand. + ## Create HTML view of pending messages + #if (lower_version($previous_version, '6.2b.1')) { + # $log->syslog('notice', 'Creating HTML view of moderation spool...'); + # my $status = + # system(Sympa::Constants::SCRIPTDIR() . '/' . 'mod2html.pl') >> 8; + # $log->syslog('err', 'mod2html.pl failed with status %s', $status) + # if $status; + #} # Rename files in automatic spool with older format created by # sympa-milter 0.6 or earlier: .. to @@ -1695,11 +1696,12 @@ sub upgrade { closedir $dh; } - $log->syslog('notice', 'Creating HTML view of moderation spool...'); - my $status = - system(Sympa::Constants::SCRIPTDIR() . '/' . 'mod2html.pl') >> 8; - $log->syslog('err', 'mod2html.pl failed with status %s', $status) - if $status; + # 6.2.70: Now HTML view of held messages will be created on demand. + #$log->syslog('notice', 'Creating HTML view of moderation spool...'); + #my $status = + # system(Sympa::Constants::SCRIPTDIR() . '/' . 'mod2html.pl') >> 8; + #$log->syslog('err', 'mod2html.pl failed with status %s', $status) + # if $status; } # Upgrading moderation spool on subscription.