Skip to content

Commit

Permalink
Merge pull request #1405 from ikedas/issue-1386_part2 by ikedas
Browse files Browse the repository at this point in the history
Deprecate scripts under bin/ (#1386), part 2 of 2
  • Loading branch information
ikedas authored Nov 15, 2022
2 parents 12b26a3 + 19a7960 commit 4616f36
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 227 deletions.
1 change: 0 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 0 additions & 10 deletions doc/sympa_toc.pod
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,6 @@ Alias database maintenance

=back

=head3 Maintenance tools

=over

=item L<mod2html(1)>

Generates HTML view of messages to be moderated

=back

=head2 Auxiliary Programs

=over
Expand Down
3 changes: 1 addition & 2 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

SUBDIRS = bin cgi lib libexec sbin

SUBDIRS = cgi lib libexec sbin
61 changes: 0 additions & 61 deletions src/bin/Makefile.am

This file was deleted.

106 changes: 0 additions & 106 deletions src/bin/mod2html.pl.in

This file was deleted.

59 changes: 31 additions & 28 deletions src/cgi/wwsympa.fcgi.in
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Expand All @@ -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) {
Expand Down
8 changes: 2 additions & 6 deletions src/lib/Sympa/Spindle/ToModeration.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
28 changes: 15 additions & 13 deletions src/lib/Sympa/Upgrade.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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: <family_name>.<date>.<rand> to
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 4616f36

Please sign in to comment.