Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename some modules for spool-like objects #608 #717

Merged
merged 2 commits into from
Aug 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/bin/upgrade_bulk_spool.pl.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
# 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 2017 The Sympa Community. See the AUTHORS.md file at the top-level
# directory of this distribution and at
# Copyright 2017, 2019 The Sympa Community. See the AUTHORS.md file at
# the top-level directory of this distribution and at
# <https://github.com/sympa-community/sympa.git>.
#
# This program is free software; you can redistribute it and/or modify
Expand All @@ -35,14 +35,14 @@ use MIME::Base64 qw();
use Pod::Usage;
use POSIX qw();

use Sympa::Bulk;
use Conf;
use Sympa::Constants;
use Sympa::DatabaseManager;
use Sympa::List;
use Sympa::Log;
use Sympa::Message;
use Sympa::Spool;
use Sympa::Spool::Outgoing;

my %options;
unless (GetOptions(\%options, 'help|h', 'dry_run', 'version|v')) {
Expand Down Expand Up @@ -85,7 +85,7 @@ process();
exit 0;

sub process {
my $bulk = Sympa::Bulk->new;
my $bulk = Sympa::Spool::Outgoing->new;

my $sdm = Sympa::DatabaseManager->instance
or die 'Can\'t connect to database';
Expand Down Expand Up @@ -305,7 +305,9 @@ robot configuration parameters in C<robot.conf> are referred.

=head1 SEE ALSO

L<sympa.conf(5)>, L<Sympa::Bulk>, L<Sympa::Message>.
L<sympa.conf(5)>,
L<Sympa::Message>,
L<Sympa::Spool::Outgoing>.

=head1 HISTORY

Expand Down
8 changes: 4 additions & 4 deletions src/bin/upgrade_send_spool.pl.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
# 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 2017 The Sympa Community. See the AUTHORS.md file at the top-level
# directory of this distribution and at
# Copyright 2017, 2019 The Sympa Community. See the AUTHORS.md file at
# the top-level directory of this distribution and at
# <https://github.com/sympa-community/sympa.git>.
#
# This program is free software; you can redistribute it and/or modify
Expand All @@ -34,12 +34,12 @@ use English qw(-no_match_vars);
use Getopt::Long;
use Pod::Usage;

use Sympa::Bulk;
use Sympa::Constants;
use Conf;
use Sympa::Log;
use Sympa::Spool;
use Sympa::Spool::Incoming;
use Sympa::Spool::Outgoing;

my %options;
unless (GetOptions(\%options, 'help|h', 'dry_run', 'version|v')) {
Expand Down Expand Up @@ -73,7 +73,7 @@ unless (($GID == (getgrnam(Sympa::Constants::GROUP))[2])
# Sets the UMASK
umask oct $Conf::Conf{'umask'};

my $bulk = Sympa::Bulk->new;
my $bulk = Sympa::Spool::Outgoing->new;
my $spool = Sympa::Spool::Incoming->new;
my $spool_dir = $spool->{directory};

Expand Down
8 changes: 4 additions & 4 deletions src/cgi/sympa_soap_server.fcgi.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
# 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 2017, 2018 The Sympa Community. See the AUTHORS.md file at the
# top-level directory of this distribution and at
# Copyright 2017, 2018, 2019 The Sympa Community. See the AUTHORS.md file at
# the top-level directory of this distribution and at
# <https://github.com/sympa-community/sympa.git>.
#
# This program is free software; you can redistribute it and/or modify
Expand All @@ -34,10 +34,10 @@ use SOAP::Lite;

## Sympa API
use Conf;
use Sympa::Alarm;
use Sympa::DatabaseManager;
use Sympa::List;
use Sympa::Log;
use Sympa::Spool::Listmaster;
use Sympa::WWW::SOAP;
use Sympa::WWW::SOAP::Transport;

Expand Down Expand Up @@ -71,7 +71,7 @@ unless (Sympa::DatabaseManager->instance) {

## The process should not fork for sending mail
## Messages will be spooled instead
Sympa::Alarm->instance->{use_bulk} = 1;
Sympa::Spool::Listmaster->instance->{use_bulk} = 1;

## Loading all Lists at startup, in order to increase execution speed

Expand Down
24 changes: 13 additions & 11 deletions src/cgi/wwsympa.fcgi.in
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ use Data::Dumper; # tentative
BEGIN { eval 'use Crypt::OpenSSL::X509'; }

use Sympa;
use Sympa::Alarm;
use Sympa::Archive;
use Sympa::Bulk;
use Conf;
use Sympa::ConfDef;
use Sympa::Constants;
Expand All @@ -80,15 +78,17 @@ use Sympa::Spool::Archive;
use Sympa::Spool::Auth;
use Sympa::Spool::Held;
use Sympa::Spool::Incoming;
use Sympa::Spool::Listmaster;
use Sympa::Spool::Moderation;
use Sympa::Spool::Outgoing;
use Sympa::Spool::Topic;
use Sympa::Task;
use Sympa::Template;
use Sympa::Ticket;
use Sympa::Tools::Data;
use Sympa::Tools::File;
use Sympa::Tools::Password;
use Sympa::Tools::Text;
use Sympa::Topic;
use Sympa::Tracking;
use Sympa::User;
use Sympa::WWW::Auth;
Expand Down Expand Up @@ -131,7 +131,7 @@ $log->{level} = $Conf::Conf{'log_level'};
$log->openlog($Conf::Conf{'log_facility'} || $Conf::Conf{'syslog'},
$Conf::Conf{'log_socket_type'});

Sympa::Alarm->instance->{use_bulk} = 1;
Sympa::Spool::Listmaster->instance->{use_bulk} = 1;

# hash of all the description files already loaded
# format :
Expand Down Expand Up @@ -1035,7 +1035,7 @@ my $query;

my $birthday = [stat $PROGRAM_NAME]->[9];

my $bulk = Sympa::Bulk->new;
my $bulk = Sympa::Spool::Outgoing->new;

$log->syslog('info', 'WWSympa started, process %d', $PID);

Expand Down Expand Up @@ -1066,7 +1066,7 @@ while ($query = CGI::Fast->new) {
$language->set_lang(Sympa::best_language('*'));

# Process grouped notifications.
Sympa::Alarm->instance->flush;
Sympa::Spool::Listmaster->instance->flush;

## Check effective ID
unless ($EUID eq (getpwnam(Sympa::Constants::USER))[2]) {
Expand Down Expand Up @@ -1828,7 +1828,7 @@ while ($query = CGI::Fast->new) {
}

# Purge grouped notifications
Sympa::Alarm->instance->flush(purge => 1);
Sympa::Spool::Listmaster->instance->flush(purge => 1);

##############################################################
#-#\#|#/#-#\#|#/#-#\#|#/#-#\#|#/#-#\#|#/#-#\#|#/#-#\#|#/#-#\#|#/
Expand Down Expand Up @@ -7897,7 +7897,7 @@ sub do_distribute {

# TAG
if (@topics) {
Sympa::Topic->new(
Sympa::Spool::Topic->new(
topic => join(',', @topics),
method => 'editor'
)->store($message);
Expand Down Expand Up @@ -14929,8 +14929,10 @@ sub do_send_mail {
if (@to_list and $in{'sub_action'} eq 'sendmailtolist') {
# TAG
if ($list_topics) {
Sympa::Topic->new(topic => $list_topics, method => 'sender')
->store($message);
Sympa::Spool::Topic->new(
topic => $list_topics,
method => 'sender'
)->store($message);
}

my $l_message = $message->dup;
Expand Down Expand Up @@ -15099,7 +15101,7 @@ sub do_tag_topic_by_sender {
}

# TAG
Sympa::Topic->new(topic => $list_topics, method => 'sender')
Sympa::Spool::Topic->new(topic => $list_topics, method => 'sender')
->store($message);

## CONFIRM
Expand Down
8 changes: 4 additions & 4 deletions src/lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@ nobase_dist_modules_DATA = \
Sympa/Internals/Workflow.pod
nobase_modules_DATA = \
Sympa.pm \
Sympa/Alarm.pm \
Sympa/Aliases.pm \
Sympa/Aliases/CheckSMTP.pm \
Sympa/Aliases/External.pm \
Sympa/Aliases/Template.pm \
Sympa/Archive.pm \
Sympa/Bulk.pm \
Sympa/CommandDef.pm \
Conf.pm \
Sympa/ConfDef.pm \
Expand Down Expand Up @@ -147,14 +145,14 @@ nobase_modules_DATA = \
Sympa/Spindle/ProcessTask.pm \
Sympa/Spindle/ProcessTemplate.pm \
Sympa/Spindle/ResendArchive.pm \
Sympa/Spindle/ToAlarm.pm \
Sympa/Spindle/ToArchive.pm \
Sympa/Spindle/ToAuth.pm \
Sympa/Spindle/ToAuthOwner.pm \
Sympa/Spindle/ToDigest.pm \
Sympa/Spindle/ToEditor.pm \
Sympa/Spindle/ToHeld.pm \
Sympa/Spindle/ToList.pm \
Sympa/Spindle/ToListmaster.pm \
Sympa/Spindle/ToMailer.pm \
Sympa/Spindle/ToModeration.pm \
Sympa/Spindle/ToOutgoing.pm \
Expand All @@ -170,8 +168,11 @@ nobase_modules_DATA = \
Sympa/Spool/Digest/Collection.pm \
Sympa/Spool/Held.pm \
Sympa/Spool/Incoming.pm \
Sympa/Spool/Listmaster.pm \
Sympa/Spool/Moderation.pm \
Sympa/Spool/Outgoing.pm \
Sympa/Spool/Task.pm \
Sympa/Spool/Topic.pm \
Sympa/Task.pm \
Sympa/Template.pm \
Sympa/Ticket.pm \
Expand All @@ -183,7 +184,6 @@ nobase_modules_DATA = \
Sympa/Tools/SMIME.pm \
Sympa/Tools/Text.pm \
Sympa/Tools/Time.pm \
Sympa/Topic.pm \
Sympa/Tracking.pm \
Sympa/Upgrade.pm \
Sympa/User.pm \
Expand Down
6 changes: 3 additions & 3 deletions src/lib/Sympa.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# 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 2017, 2018 The Sympa Community. See the AUTHORS.md file at the
# top-level directory of this distribution and at
# Copyright 2017, 2018, 2019 The Sympa Community. See the AUTHORS.md file at
# the top-level directory of this distribution and at
# <https://github.com/sympa-community/sympa.git>.
#
# This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -478,7 +478,7 @@ sub send_notify_to_listmaster {
rcpt => $email,
data => $ts->{'data'},

splicing_to => ['Sympa::Spindle::ToAlarm'],
splicing_to => ['Sympa::Spindle::ToListmaster'],
);
unless ($spindle
and $spindle->spin
Expand Down
5 changes: 4 additions & 1 deletion src/lib/Sympa/Crash.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
# 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 2019 The Sympa Community. See the AUTHORS.md file at
# the top-level directory of this distribution and at
# <https://github.com/sympa-community/sympa.git>.
#
# 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
Expand Down Expand Up @@ -98,7 +101,7 @@ sub _crash_handler {
# Cleanup.
# If any of corresponding modules have not been loaded, they are ignored.
eval { Sympa::Log->instance->syslog('err', 'DIED: %s', $mess); };
eval { Sympa::Alarm->instance->flush(purge => 1); };
eval { Sympa::Spool::Listmaster->instance->flush(purge => 1); };
eval { Sympa::DatabaseManager->disconnect(); }; # unlock database
eval { Sys::Syslog::closelog(); }; # flush log
eval { Sympa::Log->instance->{level} = -1; }; # disable log
Expand Down
35 changes: 16 additions & 19 deletions src/lib/Sympa/Internals/Workflow.pod
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ workflow of Sympa. For more details see documentation on each class.
+-> [DoMessage] /
\ /---> [ToHeld] => Held
*3 (CONFIRM) +-> [AuthorizeMessage]
: / \---> [ToModeration] => Mod.
v / \
: / : \---> [ToModeration] => Mod.
v / Topic \
Held => [ProcessHeld] ------+ \
+-> [DistributeMessage]
*3 (DISTRIBUTE) / \
Expand All @@ -61,22 +61,24 @@ workflow of Sympa. For more details see documentation on each class.
+-------------------------------------------+
\
[TransformIncoming]
<<wwsympa.fcgi>> \
\ :
\ Topic
<<wwsympa.fcgi>> \
[ToArchive] => Archive
(list archive) \
(list archive) \
=> [ResendArchive] -- [TransformOutgoing] -+
\ \
\ \
[ToDigest] => Digest \
\ \
+---------------+-> [ToList] => Outgoing

+-> [TransformDigestFinal]
/ \
<<Template sending>> / +----------> [ToOutgoing] => Outgoing
\ \
+-------------+-> [ToList] => Outgoing
:
+-> [TransformDigestFinal] Topic
/ \
<<Template sending>> / +------> [ToOutgoing] => Outgoing
/ /
(mail template) => [ProcessTemplate] ---------> [ToAlarm] => Alarm
(mail template) => [ProcessTemplate] -----> [ToListmaster] => Listmaster
/ \
^ +----------> [ToMailer] => (Mailer)
^ +------> [ToMailer] => (Mailer)
|
*1

Expand Down Expand Up @@ -116,14 +118,9 @@ Spool class. Prefix C<Sympa::Spool::> is omitted.

=over

=item C<Alarm>

=item C<Outgoing>

=item C<Tracking>

L<Sympa::Alarm>, L<Sympa::Bulk> and L<Sympa::Tracking> classes
(they are named such by historical reason).
L<Sympa::Tracking> class

=back

Expand Down
6 changes: 3 additions & 3 deletions src/lib/Sympa/List.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6467,16 +6467,16 @@ sub is_msg_topic_tagging_required {
}

# DEPRECATED.
# Use Sympa::Message::compute_topic() and Sympa::Topic::store() instead.
# Use Sympa::Message::compute_topic() and Sympa::Spool::Topic::store() instead.
#sub automatic_tag;

# Moved to Sympa::Message::compute_topic().
#sub compute_topic;

# DEPRECATED. Use Sympa::Topic::store() instead.
# DEPRECATED. Use Sympa::Spool::Topic::store() instead.
#sub tag_topic;

# DEPRECATED. Use Sympa::Topic::load() instead.
# DEPRECATED. Use Sympa::Spool::Topic::load() instead.
#sub load_msg_topic_file;

# Moved to _notify_deleted_topic() in wwsympa.fcgi.
Expand Down
5 changes: 3 additions & 2 deletions src/lib/Sympa/Mailer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ sub _new_instance {
#DEPRECATED.
#sub sendto;

# DEPRECATED. Use Sympa::Mailer::store() or Sympa::Bulk::store().
# DEPRECATED. Use Sympa::Mailer::store() or Sympa::Spool::Outgoing::store().
# Old name:
# mail::sending(), Sympa::Mail::sending(), Sympa::Mailer::send_message().
#sub send_message ($self, $message, $rcpt, %params);
Expand Down Expand Up @@ -377,7 +377,8 @@ If set, maximum number of invocation of sendmail is divided by this value.

=head1 SEE ALSO

L<Sympa::Alarm>, L<Sympa::Bulk>, L<Sympa::Message>, L<Sympa::Process>.
L<Sympa::Message>, L<Sympa::Process>,
L<Sympa::Spool::Listmaster>, L<Sympa::Spool::Outgoing>.

=head1 HISTORY

Expand Down
Loading