diff options
| author | fukachan <fukachan> | 2006-12-03 13:58:11 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2006-12-03 13:58:11 +0000 |
| commit | de3e1a02411dea65507f43b1d7f8c83b13956ad7 (patch) | |
| tree | 3c84fa93e8b08ff235476cf6253db0a382f56070 /fml/lib/FML/Command | |
| parent | 1e59c918be25122979edb22ea89f5dc7f63dcc48 (diff) | |
| download | fml8-de3e1a02411dea65507f43b1d7f8c83b13956ad7.tar.gz fml8-de3e1a02411dea65507f43b1d7f8c83b13956ad7.tar.bz2 fml8-de3e1a02411dea65507f43b1d7f8c83b13956ad7.zip | |
fix comments.
ensure initial value.
add assert.
show more error messages.
Diffstat (limited to 'fml/lib/FML/Command')
| -rw-r--r-- | fml/lib/FML/Command/Admin/reviveml.pm | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/fml/lib/FML/Command/Admin/reviveml.pm b/fml/lib/FML/Command/Admin/reviveml.pm index 5a49ba4f..f488667f 100644 --- a/fml/lib/FML/Command/Admin/reviveml.pm +++ b/fml/lib/FML/Command/Admin/reviveml.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: reviveml.pm,v 1.3 2006/02/15 13:44:03 fukachan Exp $ +# $FML: reviveml.pm,v 1.4 2006/03/04 13:48:29 fukachan Exp $ # package FML::Command::Admin::reviveml; @@ -18,7 +18,7 @@ use FML::Command::Admin::newml; =head1 NAME -FML::Command::Admin::reviveml - set up a new mailing list. +FML::Command::Admin::reviveml - revive the specified mailing list. =head1 SYNOPSIS @@ -30,18 +30,23 @@ See C<FML::Command> for more details. =head1 DESCRIPTION -set up a new mailing list. -create mailing list directory, -install config.cf, include, include-ctl et. al. +revive the specified mailing list. +restore the mailing list directory and +re-setup the ML by running "makefml newml" process. =head1 METHODS =head2 process($curproc, $command_context) +main dispatcher to revive the specified mailing list. + +This routine restores the mailing list directory and +upcalls "makefml newml" programs to re-setup the ML. + =cut -# Descriptions: set up a new mailing list. +# Descriptions: revive the specified mailing list. # Arguments: OBJ($self) OBJ($curproc) OBJ($command_context) # Side Effects: create mailing list directory, # install config.cf, include, include-ctl et. al. @@ -49,8 +54,8 @@ install config.cf, include, include-ctl et. al. sub process { my ($self, $curproc, $command_context) = @_; - my $ml_name = $curproc->ml_name(); - my $ml_domain = $curproc->ml_domain(); + my $ml_name = $curproc->ml_name() || ''; + my $ml_domain = $curproc->ml_domain() || ''; my $ml_home_dir = $curproc->ml_home_dir($ml_name, $ml_domain); my $ml_home_dir_prev = @@ -59,14 +64,29 @@ sub process $curproc->logdebug("ml_name=$ml_name ml_domain=$ml_domain"); $curproc->logdebug("dir=$ml_home_dir_prev -> $ml_home_dir"); + # ASSERT + unless ($ml_name) { croak("ml_name unspecified");} + unless ($ml_domain) { croak("ml_domain unspecified");} + unless ($ml_home_dir) { croak("ml_home_dir unspecified");} + unless ($ml_home_dir_prev) { croak("ml_home_dir_prev unspecified");} + + # 1. restore the ml_home_dir if (-d $ml_home_dir_prev && ! -d $ml_home_dir) { - rename($ml_home_dir_prev, $ml_home_dir); + if (rename($ml_home_dir_prev, $ml_home_dir)) { + use File::Basename; + my $prev = basename($ml_home_dir_prev); + $curproc->log("revived ml_home_dir from $prev"); + } + else { + $curproc->logerror("cannot rename $ml_home_dir_prev"); + } } if (!-d $ml_home_dir_prev && -d $ml_home_dir) { - $curproc->log("revived ml_home_dir from $ml_home_dir_prev"); + $curproc->log("use ml_home_dir as itself"); } + # 2. re-setup the ML. $self->SUPER::set_force_mode($curproc, $command_context); $self->SUPER::process($curproc, $command_context); } |
