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

Added a 'copy_list' parameter in the sympa.pl command #470

Closed
bmarchal54 opened this issue Nov 9, 2018 · 5 comments
Closed

Added a 'copy_list' parameter in the sympa.pl command #470

bmarchal54 opened this issue Nov 9, 2018 · 5 comments
Milestone

Comments

@bmarchal54
Copy link
Contributor

Previously, up to 6.2.34, it was easy to copy one list to another by manipulating the 'config' file of the first one.
With the establishment of owners and moderators in the database, it becomes more complex, while there is everything you need internally in Sympa.
I propose to add a parameter 'copy_list' that would do the job (or at least a good part). This would make it possible to be independent of the future structural evolutions of Sympa.

Expected Behavior

The same as for the rename_list option

Current Behavior

nothing is done

Possible Solution

Context

@bmarchal54
Copy link
Contributor Author

bmarchal54 commented Nov 9, 2018

Without factoring with the 'rename_list' option, it could give something like that.
The only real difference is the use of the 'copy' mode in the object's call Sympa :: Spindle :: ProcessRequest

diff sympa.pl sympa.pl.6.2.37b2 
72c72
<         'close_list=s',         'rename_list=s', 'copy_list=s',
---
>         'close_list=s',         'rename_list=s',
635,676d634
< } elsif ($main::options{'copy_list'}) {
<     my $current_list =
<         Sympa::List->new(split(/\@/, $main::options{'copy_list'}, 2),
<         {just_try => 1});
<     unless ($current_list) {
<         printf STDERR "Incorrect list name %s\n",
<             $main::options{'rename_list'};
<         exit 1;
<     }
< 
<     my $listname = $main::options{'new_listname'};
<     unless (defined $listname and length $listname) {
<         print STDERR "Missing parameter new_listname\n";
<         exit 1;
<     }
< 
<     my $robot_id = $main::options{'new_listrobot'};
<     unless (defined $robot_id) {
<         $robot_id = $current_list->{'domain'};
<     } else {
<         unless (length $robot_id and Conf::valid_robot($robot_id)) {
<             printf STDERR "Unknown robot \"%s\"\n", $robot_id;
<             exit 1;
<         }
<     }
< 
<     my $spindle = Sympa::Spindle::ProcessRequest->new(
<         context          => $robot_id,
<         action           => 'move_list',
<         current_list     => $current_list,
<         listname         => $listname,
<         mode		 => 'copy',
<         sender           => Sympa::get_address($robot_id, 'listmaster'),
<         scenario_context => {skip => 1},
<     );
<     unless ($spindle and $spindle->spin and _report($spindle)) {
<         printf STDERR "Could not copy list %s to %s\@%s\n",
<             $current_list->get_id, $listname, $robot_id;
<         exit 1;
<     }
<     exit 0;
< 
1409,1413d1366
< 
< =item C<--copy_list=>I<listname>@I<robot>
< C<--new_listname=>I<newlistname> C<--new_listrobot=>I<newrobot>
< 
< Copy a list.

@ikedas
Copy link
Member

ikedas commented Nov 9, 2018

@bmarchal54, thanks for contributing!

However, if possible, could you please submit a new pull request to propose changes & additions? It will make works accurate. If you have difficulty to submit pr, we will work with your patch above.

@bmarchal54
Copy link
Contributor Author

bmarchal54 commented Nov 9, 2018 via email

@racke
Copy link
Contributor

racke commented Nov 9, 2018

@bmarchal54 I think the following is a good example how to do such a PR: https://www.javahelps.com/2017/04/git-pull-request-complete-guide-for.html

@ikedas
Copy link
Member

ikedas commented Nov 17, 2018

@bmarchal54, I merged your PR. Thanks for improving Sympa!

@ikedas ikedas closed this as completed Nov 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants