diff options
| author | fukachan <fukachan> | 2003-09-13 09:16:59 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2003-09-13 09:16:59 +0000 |
| commit | 6516e5bd0eddd74001051ff507e15e4e58330932 (patch) | |
| tree | 501256c72ce619c06a670bf87ae731c2a67bfb3b /fml/lib | |
| parent | 580caed90c994e9b81e6408b4ac04e57d1f4a15d (diff) | |
| download | fml8-6516e5bd0eddd74001051ff507e15e4e58330932.tar.gz fml8-6516e5bd0eddd74001051ff507e15e4e58330932.tar.bz2 fml8-6516e5bd0eddd74001051ff507e15e4e58330932.zip | |
use $curproc->ui_message() instead of "print STDERR ...".
Diffstat (limited to 'fml/lib')
| -rw-r--r-- | fml/lib/FML/Command/Admin/edit.pm | 4 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/mailq.pm | 4 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/newml.pm | 35 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/rmml.pm | 10 | ||||
| -rw-r--r-- | fml/lib/FML/MTAControl.pm | 10 | ||||
| -rw-r--r-- | fml/lib/FML/MTAControl/Postfix.pm | 36 | ||||
| -rw-r--r-- | fml/lib/FML/MTAControl/Procmail.pm | 14 | ||||
| -rw-r--r-- | fml/lib/FML/MTAControl/Qmail.pm | 19 | ||||
| -rw-r--r-- | fml/lib/FML/MTAControl/Sendmail.pm | 8 |
9 files changed, 77 insertions, 63 deletions
diff --git a/fml/lib/FML/Command/Admin/edit.pm b/fml/lib/FML/Command/Admin/edit.pm index 2c44101b..889be5aa 100644 --- a/fml/lib/FML/Command/Admin/edit.pm +++ b/fml/lib/FML/Command/Admin/edit.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: edit.pm,v 1.15 2003/03/18 10:35:13 fukachan Exp $ +# $FML: edit.pm,v 1.16 2003/08/23 04:35:30 fukachan Exp $ # package FML::Command::Admin::edit; @@ -75,7 +75,7 @@ sub process my $editor = $ENV{ 'EDITOR' } || 'vi'; if (-f $config_cf) { - print STDERR "$editor $config_cf\n"; + $curproc->ui_message("$editor $config_cf"); system $editor, $config_cf; } else { diff --git a/fml/lib/FML/Command/Admin/mailq.pm b/fml/lib/FML/Command/Admin/mailq.pm index e12b0a97..95fab67d 100644 --- a/fml/lib/FML/Command/Admin/mailq.pm +++ b/fml/lib/FML/Command/Admin/mailq.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: mailq.pm,v 1.4 2003/04/29 11:29:29 fukachan Exp $ +# $FML: mailq.pm,v 1.5 2003/08/23 04:35:31 fukachan Exp $ # package FML::Command::Admin::mailq; @@ -94,7 +94,7 @@ sub _queue } unless ($count) { - print STDERR "Mail queue is empty\n"; + $curproc->ui_message("Mail queue is empty"); } } diff --git a/fml/lib/FML/Command/Admin/newml.pm b/fml/lib/FML/Command/Admin/newml.pm index a3fa60d0..254b5a55 100644 --- a/fml/lib/FML/Command/Admin/newml.pm +++ b/fml/lib/FML/Command/Admin/newml.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: newml.pm,v 1.67 2003/09/04 12:27:53 fukachan Exp $ +# $FML: newml.pm,v 1.68 2003/09/12 00:01:09 fukachan Exp $ # package FML::Command::Admin::newml; @@ -202,7 +202,7 @@ sub _init_ml_home_dir my $dirlist = $config->get_as_array_ref('newml_command_init_public_dirs'); for my $_dir (@$dirlist) { unless (-d $_dir) { - print STDERR "creating ", $_dir, "\n"; + $curproc->ui_message("creating $_dir"); $curproc->mkdir( $_dir, "mode=public"); } } @@ -210,7 +210,7 @@ sub _init_ml_home_dir $dirlist = $config->get_as_array_ref('newml_command_init_private_dirs'); for my $_dir (@$dirlist) { unless (-d $_dir) { - print STDERR "creating ", $_dir, "\n"; + $curproc->ui_message("creating $_dir"); $curproc->mkdir( $_dir, "mode=private"); } } @@ -239,7 +239,7 @@ sub _install_template_files my $src = File::Spec->catfile($template_dir, $file); my $dst = File::Spec->catfile($ml_home_dir, $file); - print STDERR "creating ", $dst, "\n"; + $curproc->ui_message("creating $dst"); _install($src, $dst, $params); } @@ -274,8 +274,9 @@ sub _update_aliases # append if ($self->_is_mta_alias_maps_has_ml_entry($curproc, $params, $ml_name)) { - print STDERR "warning: $ml_name already defined!\n"; - print STDERR " ignore aliases updating.\n"; + $curproc->ui_message("warning: $ml_name already defined!"); + $curproc->ui_message(" ignore aliases updating"); + $curproc->logwarn("$ml_name ml already defined"); } else { my $list = $config->get_as_array_ref('newml_command_mta_config_list'); @@ -298,7 +299,7 @@ sub _update_aliases } if ($found) { - print STDERR "skipping alias update for $mta\n"; + $curproc->ui_message("skipping alias update for $mta"); } else { $obj->install_alias($curproc, $params, $optargs); @@ -329,7 +330,9 @@ sub _is_mta_alias_maps_has_ml_entry my $obj = new FML::MTAControl; if ($obj->is_user_entry_exist_in_passwd($ml_name)) { - print STDERR "error: $ml_name is found in passwd\n"; + my $s = "ml_name=$ml_name is found in passwd"; + $curproc->ui_message("error: $s"); + $curproc->logerror($s); $found = 1; } @@ -343,7 +346,9 @@ sub _is_mta_alias_maps_has_ml_entry }); if ($found) { - print STDERR "error: $ml_name is found in $mta aliases\n"; + my $s = "ml_name=$ml_name is found in $mta aliases"; + $curproc->ui_message("error: $s"); + $curproc->logerror($s); last MTA; } } @@ -369,7 +374,7 @@ sub _setup_mail_archive_dir my $dir = $config->{ html_archive_dir }; unless (-d $dir) { - print STDERR "creating ", $dir, "\n"; + $curproc->ui_message("creating $dir"); $curproc->mkdir($dir, "mode=public"); } } @@ -398,7 +403,7 @@ sub _setup_cgi_interface my $ml_admin_cgi_dir = $config->{ ml_admin_cgi_base_dir }; for my $dir ($cgi_base_dir, $admin_cgi_dir, $ml_admin_cgi_dir) { unless (-d $dir) { - print STDERR "creating ", $dir, "\n"; + $curproc->ui_message("creating $dir"); $is_dir_exists{ $dir } = 0; $curproc->mkdir($dir, "mode=public"); } @@ -416,8 +421,8 @@ sub _setup_cgi_interface my $src = File::Spec->catfile($template_dir, 'dot_htaccess'); my $dst = File::Spec->catfile($cgi_base_dir, '.htaccess'); - print STDERR "creating ", $dst, "\n"; - print STDERR " (a dummy to disable cgi by default)\n"; + $curproc->ui_message("creating $dst"); + $curproc->ui_message(" (a dummy to disable cgi by default)"); _install($src, $dst, $params); } @@ -446,7 +451,7 @@ sub _setup_cgi_interface File::Spec->catfile($admin_cgi_dir, 'config.cgi'), File::Spec->catfile($admin_cgi_dir, 'thread.cgi') ) { - print STDERR "creating ", $dst, "\n"; + $curproc->ui_message("creating $dst"); _install($src, $dst, $params); chmod 0755, $dst; } @@ -507,7 +512,7 @@ sub _setup_listinfo my $src = File::Spec->catfile($template_dir, $file); my $dst = File::Spec->catfile($listinfo_dir, $file); - print STDERR "creating ", $dst, "\n"; + $curproc->ui_message("creating $dst"); _install($src, $dst, $params); } } diff --git a/fml/lib/FML/Command/Admin/rmml.pm b/fml/lib/FML/Command/Admin/rmml.pm index e2d1faf0..a6cddf23 100644 --- a/fml/lib/FML/Command/Admin/rmml.pm +++ b/fml/lib/FML/Command/Admin/rmml.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: rmml.pm,v 1.17 2003/09/04 12:27:53 fukachan Exp $ +# $FML: rmml.pm,v 1.18 2003/09/06 03:34:04 fukachan Exp $ # package FML::Command::Admin::rmml; @@ -115,7 +115,7 @@ sub _remove_ml_home_dir my $ml_home_prefix = $params->{ ml_home_prefix }; my $ml_home_dir = $params->{ ml_home_dir }; - print STDERR "removing ml_home_dir for $ml_name\n"; + $curproc->ui_message("removing ml_home_dir for $ml_name"); # /var/spool/ml/elena -> /var/spool/ml/@elena my $removed_dir = @@ -123,10 +123,12 @@ sub _remove_ml_home_dir rename($ml_home_dir, $removed_dir); if (-d $removed_dir && (! -d $ml_home_dir)) { - print STDERR "\tremoved.\n"; + $curproc->ui_message("removed"); } else { - print STDERR "\tfailed.\n"; + my $s = "failed to remove ml_home_dir"; + $curproc->ui_message("error: $s"); + $curproc->logerror($s); } } diff --git a/fml/lib/FML/MTAControl.pm b/fml/lib/FML/MTAControl.pm index 9f523ada..f70c9dc0 100644 --- a/fml/lib/FML/MTAControl.pm +++ b/fml/lib/FML/MTAControl.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: MTAControl.pm,v 1.19 2003/02/11 11:04:43 fukachan Exp $ +# $FML: MTAControl.pm,v 1.20 2003/02/20 04:32:49 fukachan Exp $ # package FML::MTAControl; @@ -297,7 +297,7 @@ sub _remove_postfix_style_virtual my $virtual_new = $virtual . 'new'. $$; if (-f $virtual) { - print STDERR "removing $key in $virtual\n"; + $curproc->ui_message("removing $key in $virtual"); } else { return; @@ -325,10 +325,12 @@ sub _remove_postfix_style_virtual if ($removed > 3) { if (rename($virtual_new, $virtual)) { - print STDERR "\tremoved.\n"; + $curproc->ui_message("removed"); } else { - print STDERR "\twarning: fail to rename virtual files.\n"; + my $s = "fail to rename virtual files"; + $curproc->ui_message("error: $s"); + $curproc->logerror($s); } } } diff --git a/fml/lib/FML/MTAControl/Postfix.pm b/fml/lib/FML/MTAControl/Postfix.pm index 752256a5..c933c33e 100644 --- a/fml/lib/FML/MTAControl/Postfix.pm +++ b/fml/lib/FML/MTAControl/Postfix.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Postfix.pm,v 1.21 2003/08/29 15:34:05 fukachan Exp $ +# $FML: Postfix.pm,v 1.22 2003/09/12 00:02:09 fukachan Exp $ # package FML::MTAControl::Postfix; @@ -52,7 +52,7 @@ sub postfix_install_alias $self->_postfix_rewrite_virtual_params($curproc, $xparams); $self->_install($src, $dst, $xparams); - print STDERR "updating $alias\n"; + $curproc->ui_message("updating $alias"); # XXX-TODO: we should prepare methods such as $curproc->util->append() ? use File::Utils qw(append); @@ -83,7 +83,7 @@ sub postfix_remove_alias my $key = $xparams->{ ml_name }; - print STDERR "removing $key in $alias\n"; + $curproc->ui_message("removing $key in $alias"); use FileHandle; my $rh = new FileHandle $alias; @@ -107,10 +107,12 @@ sub postfix_remove_alias if ($removed > 3) { if (rename($alias_new, $alias)) { - print STDERR "\tremoved.\n"; + $curproc->ui_message("removed"); } else { - print STDERR "\twarning: fail to rename alias files.\n"; + my $s = "fail to rename alias files"; + $curproc->ui_message("error: $s"); + $curproc->logerror($s); } } } @@ -133,7 +135,7 @@ sub postfix_update_alias my $prog = $config->{ path_postalias }; my $alias = $config->{ mail_aliases_file }; - print STDERR "updating $alias database\n"; + $curproc->ui_message("updating $alias database"); if (-x $prog) { system "$prog $alias"; } @@ -167,23 +169,25 @@ sub postfix_find_key_in_alias_maps # search for my $map (@$maps, $map) { - print STDERR "scan key = $key/$key_virtual, map = $map\n" if $debug; + if ($debug) { + $curproc->ui_message("scan key = $key/$key_virtual, map = $map"); + } # default domain case if ($curproc->is_default_domain($domain)) { - print STDERR " search $key (default domain).\n" if $debug; + $curproc->ui_message("search $key (default domain)") if $debug; if ($self->_find_key_in_file($map, $key)) { - print STDERR "\tkey=$key found\n" if $debug; + $curproc->ui_message("\tkey=$key found") if $debug; return 1; } } # virtual domain case else { if ($debug) { - print STDERR " search $key_virtual (virtual domain).\n"; + $curproc->ui_message("search $key_virtual (virtual domain)"); } if ($self->_find_key_in_file($map, $key_virtual)) { - print STDERR "\tkey=$key_virtual found\n" if $debug; + $curproc->ui_message("key=$key_virtual found") if $debug; return 1; } } @@ -250,10 +254,10 @@ sub postfix_get_aliases_as_hash_ref MAP: for my $map (@$maps) { - print STDERR "scan key = $key, map = $map\n" if $debug; + $curproc->ui_message("scan key = $key, map = $map") if $debug; if ($map =~ /^\w+:/) { - print STDERR "* ignored $map\n"; + $curproc->ui_message("* ignored $map"); next MAP; } @@ -334,7 +338,7 @@ sub postfix_setup my $src = File::Spec->catfile($template_dir, $file); my $dst = File::Spec->catfile($ml_home_dir, $file); - print STDERR "creating $dst\n"; + $curproc->ui_message("creating $dst"); $self->_install($src, $dst, $params); } } @@ -376,7 +380,7 @@ sub postfix_install_virtual_map my $virtual = $config->{ postfix_virtual_map_file }; my $src = File::Spec->catfile($template_dir, 'postfix_virtual'); my $dst = $virtual . "." . $$; - print STDERR "updating $virtual\n"; + $curproc->ui_message("updating $virtual"); # at the first time unless( -f $virtual) { @@ -431,7 +435,7 @@ sub postfix_update_virtual_map my $virtual = $config->{ postfix_virtual_map_file }; if (-f $virtual) { - print STDERR "updating $virtual database\n"; + $curproc->ui_message("updating $virtual database"); if (-x $postmap) { system "$postmap $virtual"; } diff --git a/fml/lib/FML/MTAControl/Procmail.pm b/fml/lib/FML/MTAControl/Procmail.pm index 0645bdca..4093ab2a 100644 --- a/fml/lib/FML/MTAControl/Procmail.pm +++ b/fml/lib/FML/MTAControl/Procmail.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Procmail.pm,v 1.12 2003/08/29 15:34:05 fukachan Exp $ +# $FML: Procmail.pm,v 1.13 2003/09/12 04:37:15 fukachan Exp $ # package FML::MTAControl::Procmail; @@ -48,7 +48,7 @@ sub procmail_install_alias $self->_install($src, $dst, $params); - print STDERR "updating $alias\n"; + $curproc->ui_message( "updating $alias\n"); use File::Utils qw(append); append($dst, $alias); @@ -73,7 +73,7 @@ sub procmail_remove_alias my $key = $params->{ ml_name }; - print STDERR "removing $key in $alias\n"; + $curproc->ui_message( "removing $key in $alias\n"); use FileHandle; my $rh = new FileHandle $alias; @@ -97,10 +97,10 @@ sub procmail_remove_alias if ($removed > 3) { if (rename($alias_new, $alias)) { - print STDERR "\tremoved.\n"; + $curproc->ui_message( "\tremoved.\n"); } else { - print STDERR "\twarning: fail to rename alias files.\n"; + $curproc->ui_message( "\twarning: fail to rename alias files.\n"); } } } @@ -136,7 +136,7 @@ sub procmail_find_key_in_alias_maps my $addr = sprintf("%s\@%s", $params->{ ml_name }, $params->{ ml_domain }); for my $map (@$maps) { - print STDERR "scan key = $key, map = $map\n" if $debug; + $curproc->ui_message( "scan key = $key, map = $map\n" if $debug); if (-f $map) { use FileHandle; @@ -179,7 +179,7 @@ sub procmail_get_aliases_as_hash_ref } for my $map (@$maps) { - print STDERR "scan key = $key, map = $map\n" if $debug; + $curproc->ui_message( "scan key = $key, map = $map\n" if $debug); use FileHandle; my $fh = new FileHandle $map; diff --git a/fml/lib/FML/MTAControl/Qmail.pm b/fml/lib/FML/MTAControl/Qmail.pm index d2817aad..17b933d9 100644 --- a/fml/lib/FML/MTAControl/Qmail.pm +++ b/fml/lib/FML/MTAControl/Qmail.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Qmail.pm,v 1.16 2003/01/27 03:23:17 fukachan Exp $ +# $FML: Qmail.pm,v 1.17 2003/08/29 15:34:05 fukachan Exp $ # package FML::MTAControl::Qmail; @@ -70,9 +70,11 @@ sub qmail_remove_alias my $dst = File::Spec->catfile($fml_owner_home_dir, $xfile); if (-f $dst) { - print STDERR "removing $dst\n"; + $curproc->ui_message("removing $dst"); unlink $dst || do { - print STDERR " failed to remove $dst !!!\n"; + my $s = "failed to remove $dst"; + $curproc->ui_message("error: $s"); + $curproc->logerror($s); }; } } @@ -158,16 +160,15 @@ sub qmail_setup my $src = File::Spec->catfile($template_dir, $file); my $dst = File::Spec->catfile($fml_owner_home_dir, $xfile); - print STDERR "creating $dst\n"; + $curproc->ui_message("creating $dst"); $self->_install($src, $dst, $params); } my $virtual_domain_conf = $config->{ qmail_virtualdomains_file }; unless (-f $virtual_domain_conf) { if (0) { - print STDERR " XXX We assume $ml_domain:fml-$ml_domain\n"; - print STDERR " XXX in $virtual_domain_conf\n"; - print STDERR " XXX\n"; + $curproc->ui_message(" XXX We assume $ml_domain:fml-$ml_domain"); + $curproc->ui_message(" XXX in $virtual_domain_conf"); } } @@ -204,7 +205,7 @@ sub qmail_install_virtual_map # 2. if not found unless ($found) { - print STDERR "updating $virtual\n"; + $curproc->ui_message("updating $virtual"); my $fh = new FileHandle ">> $virtual"; if (defined $fh) { @@ -213,7 +214,7 @@ sub qmail_install_virtual_map } } else { - print STDERR "skip updating $virtual\n"; + $curproc->ui_message("skip updating $virtual"); } } diff --git a/fml/lib/FML/MTAControl/Sendmail.pm b/fml/lib/FML/MTAControl/Sendmail.pm index 63bac2bb..9a3a80f2 100644 --- a/fml/lib/FML/MTAControl/Sendmail.pm +++ b/fml/lib/FML/MTAControl/Sendmail.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Sendmail.pm,v 1.5 2003/05/13 09:30:09 fukachan Exp $ +# $FML: Sendmail.pm,v 1.6 2003/08/29 15:34:06 fukachan Exp $ # package FML::MTAControl::Sendmail; @@ -69,7 +69,7 @@ sub sendmail_update_alias my $prog = $config->{ path_sendmail }; my $alias = $config->{ mail_aliases_file }; - print STDERR "updating $alias database\n"; + $curproc->ui_message("updating $alias database"); if (-x $prog) { system "$prog -bi -oA$alias"; } @@ -160,7 +160,7 @@ sub sendmail_install_virtual_map my $virtual = $config->{ sendmail_virtual_map_file }; my $src = File::Spec->catfile($template_dir, 'postfix_virtual'); my $dst = $virtual . "." . $$; - print STDERR "updating $virtual\n"; + $curproc->ui_message("updating $virtual"); # at the first time unless( -f $virtual) { @@ -217,7 +217,7 @@ sub sendmail_update_virtual_map # XXX-TODO: NOT IMPLEMENTED if (-f $virtual) { - print STDERR "updating $virtual database\n"; + $curproc->ui_message("updating $virtual database"); if (-x $makemap) { system "$makemap hash $virtual < $virtual"; } |
