Commit cd18079 1 parent 5b5d79b commit cd18079 Copy full SHA for cd18079
File tree 7 files changed +26
-11
lines changed
7 files changed +26
-11
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ use Sympa::Template;
41
41
use Sympa::Tools::Data;
42
42
43
43
my $language = Sympa::Language-> instance;
44
+ my $noout ;
44
45
45
46
sub run {
46
47
my $class = shift ;
@@ -113,7 +114,7 @@ sub run {
113
114
} elsif (
114
115
not Getopt::Long::GetOptionsFromArray(
115
116
\@argv , \%options ,
116
- qw( config|f=s debug|d lang|l=s log_level=s mail|m) ,
117
+ qw( config|f=s debug|d lang|l=s log_level=s mail|m noout ) ,
117
118
$class -> _options
118
119
)
119
120
) {
@@ -124,6 +125,8 @@ sub run {
124
125
return undef ;
125
126
}
126
127
128
+ $noout = $options {noout };
129
+
127
130
# Get privileges and load config if necessary.
128
131
# Otherwise only setup language if specified.
129
132
$language -> set_lang($options {lang }) if $options {lang };
@@ -406,7 +409,9 @@ sub _translate_warn {
406
409
return $output ;
407
410
}
408
411
409
- $SIG {__WARN__ } = sub { warn _translate_warn(shift ) };
412
+ $SIG {__WARN__ } = sub {
413
+ warn _translate_warn(shift ) unless $noout ;
414
+ };
410
415
411
416
my $arg_labels = {
412
417
list => {gettext_id => ' list' },
Original file line number Diff line number Diff line change @@ -55,7 +55,8 @@ sub _run {
55
55
) {
56
56
$users ++;
57
57
} else {
58
- printf STDERR " Unable to cancel bounce error for %s .\n " , $i -> {email };
58
+ warn sprintf " Unable to cancel bounce error for %s .\n " ,
59
+ $i -> {email };
59
60
}
60
61
$errors ++;
61
62
}
Original file line number Diff line number Diff line change @@ -65,7 +65,10 @@ sub _run {
65
65
only_changed => 1,
66
66
filter => ([@{$options -> {output } // []}, qw( explicit mandatory) ])
67
67
);
68
- return 1 unless defined $out ;
68
+ unless (defined $out ) {
69
+ warn " Not changed.\n " ;
70
+ return 1;
71
+ }
69
72
70
73
my $sympa_conf = Sympa::Constants::CONFIG();
71
74
my $date = POSIX::strftime(' %Y%m%d%H%M%S' , localtime time );
Original file line number Diff line number Diff line change @@ -65,10 +65,10 @@ sub _run {
65
65
}
66
66
foreach my $role (@roles ) {
67
67
unless ($list -> dump_users($role )) {
68
- printf STDERR " %s : Could not dump list users (%s )\n " ,
68
+ warn sprintf " %s : Could not dump list users (%s )\n " ,
69
69
$list -> get_id, $role ;
70
70
} else {
71
- printf STDERR " %s : Dumped list users (%s )\n " ,
71
+ warn sprintf " %s : Dumped list users (%s )\n " ,
72
72
$list -> get_id, $role ;
73
73
}
74
74
}
Original file line number Diff line number Diff line change @@ -40,11 +40,11 @@ sub _run {
40
40
my $class = shift ;
41
41
my $options = shift ;
42
42
43
- print STDERR " Working on user_table...\n " ;
43
+ warn " Working on user_table...\n " ;
44
44
my $total = _lowercase_field(' user_table' , ' email_user' );
45
45
46
46
if (defined $total ) {
47
- print STDERR " Working on subscriber_table...\n " ;
47
+ warn " Working on subscriber_table...\n " ;
48
48
my $total_sub =
49
49
_lowercase_field(' subscriber_table' , ' user_subscriber' );
50
50
if (defined $total_sub ) {
@@ -57,7 +57,7 @@ sub _run {
57
57
exit 1;
58
58
}
59
59
60
- printf STDERR " Total lowercased rows: %d \n " , $total ;
60
+ warn sprintf " Total lowercased rows: %d \n " , $total ;
61
61
62
62
exit 0;
63
63
}
Original file line number Diff line number Diff line change @@ -65,10 +65,10 @@ sub _run {
65
65
}
66
66
foreach my $role (@roles ) {
67
67
unless ($list -> restore_users($role )) {
68
- printf STDERR " %s : Could not restore list users (%s )\n " ,
68
+ warn sprintf " %s : Could not restore list users (%s )\n " ,
69
69
$list -> get_id, $role ;
70
70
} else {
71
- printf STDERR " %s : Restored list users (%s )\n " ,
71
+ warn sprintf " %s : Restored list users (%s )\n " ,
72
72
$list -> get_id, $role ;
73
73
}
74
74
}
Original file line number Diff line number Diff line change @@ -281,6 +281,10 @@ Sets Sympa log level.
281
281
282
282
Enable SMTP logging.
283
283
284
+ =item C<--noout >
285
+
286
+ Skip output to the console except for fatal error messages.
287
+
284
288
=back
285
289
286
290
=head1 COMMANDS
@@ -921,4 +925,6 @@ F<sympa_msg.pl> daemon.
921
925
As of Sympa 6.2.68, F<sympa.pl> was renamed to F<sympa>
922
926
and the new form of command line arguments was introduced.
923
927
928
+ The C<--noout > option was introduced on Sympa 6.2.71b.
929
+
924
930
=cut
You can’t perform that action at this time.
0 commit comments