Skip to content

Commit

Permalink
Merge pull request #394 from ikedas/refactor_task by ikedas
Browse files Browse the repository at this point in the history
Refactoring task_manager.pl
  • Loading branch information
ikedas authored Oct 20, 2018
2 parents 18f76db + 3ce3ec8 commit e45fa90
Show file tree
Hide file tree
Showing 52 changed files with 2,528 additions and 2,338 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ installconfig: installdir sympa_wizard.pl.inst
chgrp $(GROUP) data_structure.version; \
fi
-@for dir in create_list_templates custom_actions custom_conditions \
data_sources families global_task_models list_task_models \
data_sources families tasks \
mail_tt2 scenari search_filters web_tt2; do \
if [ ! -d $(DESTDIR)$(sysconfdir)/$$dir ] ; then \
echo "Creating $(DESTDIR)$(sysconfdir)/$$dir"; \
Expand Down
48 changes: 18 additions & 30 deletions default/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -53,32 +53,6 @@ nobase_default_DATA = \
create_list_templates/private_working_group/config.tt2 \
create_list_templates/public_web_forum/comment.tt2 \
create_list_templates/public_web_forum/config.tt2 \
global_task_models/chk_cert_expiration.daily.task \
global_task_models/crl_update.daily.task \
global_task_models/eval_bouncers.daily.task \
global_task_models/expire_bounce.daily.task \
global_task_models/process_bouncers.weekly.task \
global_task_models/purge_logs_table.daily.task \
global_task_models/purge_one_time_ticket_table.daily.task \
global_task_models/purge_orphan_bounces.monthly.task \
global_task_models/purge_session_table.daily.task \
global_task_models/purge_spools.daily.task \
global_task_models/purge_tables.daily.task \
global_task_models/purge_user_table.monthly.task \
list_task_models/expire.2month.task \
list_task_models/expire.3month.task \
list_task_models/expire.4month.task \
list_task_models/expire.6month.task \
list_task_models/expire.9month.task \
list_task_models/expire.yearly.task \
list_task_models/remind.2month.task \
list_task_models/remind.3month.task \
list_task_models/remind.4month.task \
list_task_models/remind.6month.task \
list_task_models/remind.9month.task \
list_task_models/remind.monthly.task \
list_task_models/remind.yearly.task \
list_task_models/sync_include.ttl.task \
scenari/add.auth \
scenari/add.authdkim \
scenari/add.closed \
Expand Down Expand Up @@ -195,6 +169,24 @@ nobase_default_DATA = \
scenari/visibility.intranet \
scenari/visibility.noconceal \
scenari/visibility.secret \
tasks/eval_bouncers.daily.task \
tasks/expire_bounce.daily.task \
tasks/process_bouncers.weekly.task \
tasks/purge_logs_table.daily.task \
tasks/purge_one_time_ticket_table.daily.task \
tasks/purge_orphan_bounces.monthly.task \
tasks/purge_session_table.daily.task \
tasks/purge_spools.daily.task \
tasks/purge_tables.daily.task \
tasks/purge_user_table.monthly.task \
tasks/remind.2month.task \
tasks/remind.3month.task \
tasks/remind.4month.task \
tasks/remind.6month.task \
tasks/remind.9month.task \
tasks/remind.monthly.task \
tasks/remind.yearly.task \
tasks/sync_include.ttl.task \
web_tt2/active_lists.tt2 \
web_tt2/admin.tt2 \
web_tt2/ajax.tt2 \
Expand Down Expand Up @@ -372,16 +364,12 @@ nobase_default_DATA = \
mail_tt2/authorization_reject.tt2 \
mail_tt2/automatic_bounce_management.tt2 \
mail_tt2/bye.tt2 \
mail_tt2/certif_warning.tt2 \
mail_tt2/command_report.tt2 \
mail_tt2/delivery_status_notification.tt2 \
mail_tt2/digestplain.tt2 \
mail_tt2/digest.tt2 \
mail_tt2/d_install_shared.tt2 \
mail_tt2/d_reject_shared.tt2 \
mail_tt2/expire_deletion.tt2 \
mail_tt2/expire_warning1.tt2 \
mail_tt2/expire_warning2.tt2 \
mail_tt2/get_archive.tt2 \
mail_tt2/global_remind.tt2 \
mail_tt2/helpfile.tt2 \
Expand Down
9 changes: 0 additions & 9 deletions default/global_task_models/expire_bounce.daily.task

This file was deleted.

9 changes: 0 additions & 9 deletions default/global_task_models/process_bouncers.weekly.task

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions default/tasks/expire_bounce.daily.task
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
title.gettext expire of bounces older than 10 days before message distribution

/ACTION
expire_bounce (10)
next ([execution_date] + 1d, ACTION)
5 changes: 5 additions & 0 deletions default/tasks/process_bouncers.weekly.task
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
title.gettext automatic management of bouncing users

/ACTION
process_bouncers ()
next([execution_date] + 1w, ACTION)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion doc/sympa_toc.pod
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Daemon to handle incoming messages

=item L<task_manager(8)>

Daemon to Process Periodical Sympa Tasks
Daemon to process periodical Sympa tasks

=back

Expand Down
2 changes: 1 addition & 1 deletion po/sympa/Makefile.in.in
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
default/web_tt2/*.tt2 default/mail_tt2/*.tt2 \
default/mhonarc-ressources.tt2 default/topics.conf \
default/scenari/* \
default/global_task_models/* default/list_task_models/* \
default/tasks/* \
default/create_list_templates/*/* \
ext/*/lib/Sympa/*.pm \
ext/*/lib/Sympa/*/tt2/*.tt2 ext/*/lib/Sympa/*/*/tt2/*.tt2;\
Expand Down
40 changes: 20 additions & 20 deletions po/sympa/POTFILES.in
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# List of source files which contain translatable strings.
#default/mail_tt2/authorization_reject.tt2
default/mail_tt2/bye.tt2
default/mail_tt2/certif_warning.tt2
#default/mail_tt2/certif_warning.tt2
default/mail_tt2/command_report.tt2
default/mail_tt2/digestplain.tt2
default/mail_tt2/digest.tt2
default/mail_tt2/d_install_shared.tt2
default/mail_tt2/d_reject_shared.tt2
default/mail_tt2/expire_deletion.tt2
default/mail_tt2/expire_warning1.tt2
default/mail_tt2/expire_warning2.tt2
#default/mail_tt2/expire_deletion.tt2
#default/mail_tt2/expire_warning1.tt2
#default/mail_tt2/expire_warning2.tt2
default/mail_tt2/get_archive.tt2
default/mail_tt2/global_remind.tt2
default/mail_tt2/helpfile.tt2
Expand Down Expand Up @@ -62,22 +62,22 @@ default/create_list_templates/private_working_group/comment.tt2
default/create_list_templates/private_working_group/config.tt2
default/create_list_templates/public_web_forum/comment.tt2
default/create_list_templates/public_web_forum/config.tt2
default/global_task_models/chk_cert_expiration.daily.task
default/global_task_models/crl_update.daily.task
default/global_task_models/eval_bouncers.daily.task
default/global_task_models/expire_bounce.daily.task
default/global_task_models/process_bouncers.weekly.task
default/global_task_models/purge_logs_table.daily.task
default/global_task_models/purge_one_time_ticket_table.daily.task
default/global_task_models/purge_orphan_bounces.monthly.task
default/global_task_models/purge_session_table.daily.task
default/global_task_models/purge_tables.daily.task
default/global_task_models/purge_user_table.monthly.task
default/list_task_models/expire.yearly.task
default/list_task_models/remind.2month.task
default/list_task_models/remind.monthly.task
default/list_task_models/remind.yearly.task
default/list_task_models/sync_include.ttl.task
##default/global_task_models/chk_cert_expiration.daily.task
##default/global_task_models/crl_update.daily.task
#default/global_task_models/eval_bouncers.daily.task
#default/global_task_models/expire_bounce.daily.task
#default/global_task_models/process_bouncers.weekly.task
#default/global_task_models/purge_logs_table.daily.task
#default/global_task_models/purge_one_time_ticket_table.daily.task
#default/global_task_models/purge_orphan_bounces.monthly.task
#default/global_task_models/purge_session_table.daily.task
#default/global_task_models/purge_tables.daily.task
#default/global_task_models/purge_user_table.monthly.task
##default/list_task_models/expire.yearly.task
#default/list_task_models/remind.2month.task
#default/list_task_models/remind.monthly.task
#default/list_task_models/remind.yearly.task
#default/list_task_models/sync_include.ttl.task
default/mhonarc-ressources.tt2
default/scenari/archive_web_access.closed
default/scenari/archive_web_access.intranet
Expand Down
6 changes: 6 additions & 0 deletions po/sympa/cs.po
Original file line number Diff line number Diff line change
Expand Up @@ -20029,6 +20029,12 @@ msgstr ""
#~ msgid "Moderation"
#~ msgstr "Moderátoři"

msgid "expire of bounces older than 10 days before message distribution"
msgstr "expirace vrácených zpráv starších než 10 dní od poslední rozeslané zprávy"

msgid "automatic management of bouncing users"
msgstr "automatická správa vracejících se adres"

#, fuzzy
#~ msgid "Someone, probably you, requested to subscribe to list %1@%2."
#~ msgstr "Požadoval jste přihlášení do konference %1"
3 changes: 3 additions & 0 deletions po/sympa/et.po
Original file line number Diff line number Diff line change
Expand Up @@ -20918,6 +20918,9 @@ msgstr ""
#~ msgid "Moderation"
#~ msgstr "Modereerimine"

msgid "expire of bounces older than 10 days before message distribution"
msgstr "vigased kirjad eemaldatakse 10 päeva peale kirja saatmist"

#~ msgid ""
#~ "Someone, probably you, requested to subscribe to list %1@%2. (This "
#~ "request came from host %3)."
Expand Down
8 changes: 7 additions & 1 deletion po/sympa/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -3015,7 +3015,7 @@ msgstr ""
"Janvier:Février:Mars:Avril:Mai:Juin:Juillet:Août:Septembre:Octobre:Novembre:"
"Décembre"

# Tout dépend du contexte d'utilisation.
# Tout dépend du contexte d'utilisation.
# Après une heure donnée, on peut préciser soit "du matin" pour AM soit "de l'après-midi" ou "du soir" pour PM
#: src/lib/Sympa/Language.pm:644
msgid "AM:PM"
Expand Down Expand Up @@ -20802,6 +20802,12 @@ msgstr ""
#~ msgid "Moderation"
#~ msgstr "Modération"

msgid "expire of bounces older than 10 days before message distribution"
msgstr "expiration de bounces 10 jours antérieurs au dernier mail diffusé"

msgid "automatic management of bouncing users"
msgstr "effectue les actions automatiques sur les bouncers"

#~ msgid ""
#~ "Someone, probably you, requested to subscribe to list %1@%2. (This "
#~ "request came from host %3)."
Expand Down
6 changes: 3 additions & 3 deletions src/cgi/wwsympa.fcgi.in
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ use Sympa::Spool::Auth;
use Sympa::Spool::Held;
use Sympa::Spool::Incoming;
use Sympa::Spool::Moderation;
use Sympa::Task;
use Sympa::Template;
use Sympa::Ticket;
use Sympa::Tools::Data;
Expand Down Expand Up @@ -10882,9 +10883,8 @@ sub _do_edit_list_request {
}
$pitem->{format} = $list_of_scenario;
} elsif ($pitem->{task}) {
my $list_of_task =
$list->load_task_list($pitem->{task}, $robot);
$pitem->{format} = $list_of_task;
my $tasks = Sympa::Task::get_tasks($list, $pitem->{task});
$pitem->{format} = { map { ($_->{name} => $_) } @$tasks };
} elsif ($pitem->{datasource}) {
my $list_of_data_sources = $list->load_data_sources_list($robot);
$pitem->{format} = $list_of_data_sources;
Expand Down
2 changes: 2 additions & 0 deletions src/lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ nobase_modules_DATA = \
Sympa/Spindle/ProcessModeration.pm \
Sympa/Spindle/ProcessOutgoing.pm \
Sympa/Spindle/ProcessRequest.pm \
Sympa/Spindle/ProcessTask.pm \
Sympa/Spindle/ProcessTemplate.pm \
Sympa/Spindle/ResendArchive.pm \
Sympa/Spindle/ToAlarm.pm \
Expand All @@ -162,6 +163,7 @@ nobase_modules_DATA = \
Sympa/Spool/Held.pm \
Sympa/Spool/Incoming.pm \
Sympa/Spool/Moderation.pm \
Sympa/Spool/Task.pm \
Sympa/Task.pm \
Sympa/Template.pm \
Sympa/Ticket.pm \
Expand Down
22 changes: 16 additions & 6 deletions src/lib/Sympa/ConfDef.pm
Original file line number Diff line number Diff line change
Expand Up @@ -717,30 +717,35 @@ our @params = (
'gettext_comment' =>
'This task resets bouncing information for addresses not bouncing in the last 10 days after the latest message distribution.',
'file' => 'sympa.conf',
'task' => 'expire_bounce',
},
{ 'name' => 'purge_orphan_bounces_task',
'gettext_id' => 'Task for cleaning invalidated bounces',
'gettext_comment' =>
'This task deletes bounce information for unsubscribed users.',
'default' => 'monthly',
'task' => 'purge_orphan_bounces',
},
{ 'name' => 'eval_bouncers_task',
'gettext_id' => 'Task for updating bounce scores',
'gettext_comment' =>
'This task scans all bouncing users for all lists, and updates "bounce_score_subscriber" field in "subscriber_table" table. The scores may be used for management of bouncers.',
'default' => 'daily',
'task' => 'eval_bouncers',
},
{ 'name' => 'process_bouncers_task',
'gettext_id' => 'Task for management of bouncers',
'gettext_comment' =>
'This task executes actions on bouncing users configured by each list, according to their scores.',
'default' => 'weekly',
'task' => 'process_bouncers',
},
{ 'name' => 'purge_tables_task',
'gettext_id' => 'Task for cleaning tables',
'gettext_comment' =>
'This task cleans old tracking information from "notification_table" table.',
'default' => 'daily',
'task' => 'purge_tables',
},
{ 'name' => 'minimum_bouncing_count',
'gettext_id' => 'Minimum number of bounces',
Expand Down Expand Up @@ -1047,6 +1052,7 @@ our @params = (
'gettext_id' => 'Task for cleaning spools',
'gettext_comment' => 'This task cleans old content in spools.',
'default' => 'daily',
'task' => 'purge_spools',
},
{ 'name' => 'clean_delay_queue',
'gettext_id' => 'Max age of incoming bad messages',
Expand Down Expand Up @@ -1206,12 +1212,14 @@ our @params = (
'gettext_comment' =>
'This task removes rows in the "user_table" table which have not corresponding entries in the "subscriber_table" table.',
'default' => 'monthly',
'task' => 'purge_user_table',
},
{ 'name' => 'purge_logs_table_task',
'gettext_id' => 'Task for cleaning tables',
'gettext_comment' =>
'This task cleans old logs from "logs_table" table.',
'default' => 'daily',
'task' => 'purge_logs_table',
},
{ 'name' => 'logs_expiration_period',
'gettext_id' => 'Max age of logs in database',
Expand Down Expand Up @@ -1557,6 +1565,7 @@ our @params = (
'gettext_comment' =>
'This task removes old entries in the "session_table" table.',
'default' => 'daily',
'task' => 'purge_session_table',
},
{ 'name' => 'session_table_ttl',
'gettext_id' => 'Max age of sessions',
Expand Down Expand Up @@ -1674,6 +1683,7 @@ our @params = (
},
{ 'name' => 'purge_one_time_ticket_table_task',
'default' => 'daily',
'task' => 'purge_one_time_ticket_table',
},
{ 'name' => 'one_time_ticket_table_ttl',
'default' => '10d',
Expand Down Expand Up @@ -2074,12 +2084,6 @@ our @params = (
'vhost' => '1',
'file' => 'wwsympa.conf',
},
{ 'name' => 'purge_challenge_table_task', #FIXME: deprecated?
'default' => 'daily',
},
{ 'name' => 'challenge_table_ttl', #FIXME: deprecated?
'default' => '5d',
},
{ 'name' => 'filesystem_encoding',
'default' => 'utf-8',
},
Expand Down Expand Up @@ -2154,6 +2158,12 @@ our @params = (
## 'name' => 'ldap_export_suffix',
## 'optional' => '1',
## },
## { 'name' => 'purge_challenge_table_task',
## 'default' => 'daily',
## },
## { 'name' => 'challenge_table_ttl',
## 'default' => '5d',
## },
## No longer used
## {
## 'name' => 'sort',
Expand Down
6 changes: 1 addition & 5 deletions src/lib/Sympa/Internals/Workflow.pod
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,11 @@ workflow of Sympa. For more details see documentation on each class.
Request::Collection / *3
=> [ProcessRequest]

=begin comment

These have not been implemented yet.
=head2 Task processing

<<task_manager.pl>>

Task => [ProcessTask] => Task

=end comment

=head2 Legend

Expand Down
Loading

0 comments on commit e45fa90

Please sign in to comment.