diff options
| author | fukachan <fukachan> | 2002-05-25 06:58:23 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2002-05-25 06:58:23 +0000 |
| commit | 29d6f9b0c94c114263381aec4de30671d439da21 (patch) | |
| tree | 4e5890321c3b010f43b8d03293884d78c4cce406 | |
| parent | e4c62a1cb534447101cb9d9e91af4b2f076db662 (diff) | |
| download | fml8-29d6f9b0c94c114263381aec4de30671d439da21.tar.gz fml8-29d6f9b0c94c114263381aec4de30671d439da21.tar.bz2 fml8-29d6f9b0c94c114263381aec4de30671d439da21.zip | |
at the first stage of makefml, care $config and rewrite it, if needed,
when we handle virtual domain.
implement $curproc->rewrite_config_if_needed() for it.
| -rw-r--r-- | fml/lib/FML/Command/Admin/newml.pm | 53 | ||||
| -rw-r--r-- | fml/lib/FML/Process/Configure.pm | 9 | ||||
| -rw-r--r-- | fml/lib/FML/Process/Utils.pm | 45 |
3 files changed, 60 insertions, 47 deletions
diff --git a/fml/lib/FML/Command/Admin/newml.pm b/fml/lib/FML/Command/Admin/newml.pm index 16ece25a..ee4aa73d 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.32 2002/05/24 06:39:39 fukachan Exp $ +# $FML: newml.pm,v 1.33 2002/05/25 04:25:38 fukachan Exp $ # package FML::Command::Admin::newml; @@ -68,8 +68,10 @@ sub process my ($self, $curproc, $command_args) = @_; my $options = $curproc->command_line_options(); my $config = $curproc->{ 'config' }; - my ($ml_name, $ml_domain, $ml_home_prefix, $ml_home_dir) = - $self->_get_domain_info($curproc, $command_args); + my $ml_name = $config->{ ml_name }; + my $ml_domain = $config->{ ml_domain }; + my $ml_home_prefix = $config->{ ml_home_prefix }; + my $ml_home_dir = $config->{ ml_home_dir }; my $params = { fml_owner => $curproc->fml_owner(), executable_prefix => $curproc->executable_prefix(), @@ -117,10 +119,6 @@ sub process mkdirhier( $mailconfdir, $config->{ default_dir_mode } || 0755 ); } - # update $config name space. - $config->set('ml_name', $self->{ _ml_name }); - $config->set('ml_domain', $self->{ _ml_domain }); - # 1. install $ml_home_dir/{config.cf,include,include-ctl} # 2. set up aliases # 3. prepare mail archive at ~fml/public_html/$domain/$ml/ ? @@ -185,7 +183,7 @@ sub _update_aliases my ($self, $curproc, $command_args, $params) = @_; my $template_dir = $curproc->template_files_dir_for_newml(); my $config = $curproc->{ config }; - my $ml_name = $self->{ _ml_name }; + my $ml_name = $config->{ ml_name }; use File::Spec; my $alias = $config->{ mail_aliases_file }; @@ -351,8 +349,8 @@ sub _setup_cgi_interface my $src = File::Spec->catfile($libexec_dir, 'loader'); # hints - my $ml_name = $self->{ _ml_name }; - my $ml_domain = $self->{ _ml_domain }; + my $ml_name = $config->{ ml_name }; + my $ml_domain = $config->{ ml_domain }; $params->{ __hints_for_fml_process__ } = qq{ \$hints = { cgi_mode => 'admin', @@ -378,41 +376,6 @@ sub _setup_cgi_interface } -# Descriptions: check argument and prepare virtual domain information -# if needed. -# Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) -# Side Effects: none -# Return Value: ARRAY -sub _get_domain_info -{ - my ($self, $curproc, $command_args) = @_; - my $ml_name = $command_args->{ 'ml_name' }; - my $ml_domain = $curproc->default_domain(); - my $ml_home_prefix = ''; - my $ml_home_dir = ''; - - # virtual domain support e.g. "makefml newml elena@nuinui.net" - if ($ml_name =~ /\@/o) { - # overwrite $ml_name - ($ml_name, $ml_domain) = split(/\@/, $ml_name); - $ml_home_prefix = $curproc->ml_home_prefix($ml_domain); - } - # default domain: e.g. "makefml newml elena" - else { - $ml_home_prefix = $curproc->ml_home_prefix(); - } - - eval q{ use File::Spec;}; - $ml_home_dir = File::Spec->catfile($ml_home_prefix, $ml_name); - - # save for convenience - $self->{ _ml_name } = $ml_name; - $self->{ _ml_domain } = $ml_domain; - - return ($ml_name, $ml_domain, $ml_home_prefix, $ml_home_dir); -} - - # Descriptions: install $dst with variable expansion of $src # Arguments: STR($src) STR($dst) HASH_REF($config) # Side Effects: create $dst diff --git a/fml/lib/FML/Process/Configure.pm b/fml/lib/FML/Process/Configure.pm index f4811bc4..e0c5e888 100644 --- a/fml/lib/FML/Process/Configure.pm +++ b/fml/lib/FML/Process/Configure.pm @@ -3,7 +3,7 @@ # Copyright (C) 2001,2002 Ken'ichi Fukamachi # All rights reserved. # -# $FML: Configure.pm,v 1.38 2002/04/10 04:24:15 fukachan Exp $ +# $FML: Configure.pm,v 1.39 2002/04/20 05:40:02 fukachan Exp $ # package FML::Process::Configure; @@ -225,6 +225,13 @@ sub _makefml args => $args, }; + # update $config to rewrite $ml_* variable for the virtual domain. + # XXX irrespctive of virtual domains or not, we call this method + # XXX to update $config->{ ml_name } et. al. + # XXX since $config->{ ml_name } is not set here. + $curproc->rewrite_config_if_needed($args, $command_args); + $command_args->{ ml_name } = $config->{ ml_name }; + my $eval = $config->get_hook( 'makefml_run_start_hook' ); if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } diff --git a/fml/lib/FML/Process/Utils.pm b/fml/lib/FML/Process/Utils.pm index 85d6fbf0..2b080e72 100644 --- a/fml/lib/FML/Process/Utils.pm +++ b/fml/lib/FML/Process/Utils.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: Utils.pm,v 1.19 2002/04/15 10:29:44 fukachan Exp $ +# $FML: Utils.pm,v 1.20 2002/05/13 14:22:53 fukachan Exp $ # package FML::Process::Utils; @@ -475,6 +475,49 @@ sub __get_virtual_maps } +=head2 rewrite_config_if_needed($args, $command_args) + +rewrite $ml_* information for virtual domain. + +=cut + + +# Descriptions: check argument and prepare virtual domain information +# if needed. +# Arguments: OBJ($curproc) HASH_REF($args) HASH_REF($command_args) +# Side Effects: none +# Return Value: HASH_REF +sub rewrite_config_if_needed +{ + my ($curproc, $args, $command_args) = @_; + my $config = $curproc->{ config }; + my $ml_name = $command_args->{ 'ml_name' }; + my $ml_domain = $curproc->default_domain(); + my $ml_home_prefix = ''; + my $ml_home_dir = ''; + + # virtual domain support e.g. "makefml newml elena@nuinui.net" + if ($ml_name =~ /\@/o) { + # overwrite $ml_name + ($ml_name, $ml_domain) = split(/\@/, $ml_name); + $ml_home_prefix = $curproc->ml_home_prefix($ml_domain); + } + # default domain: e.g. "makefml newml elena" + else { + $ml_home_prefix = $curproc->ml_home_prefix(); + } + + eval q{ use File::Spec;}; + $ml_home_dir = File::Spec->catfile($ml_home_prefix, $ml_name); + + # rewrite $curproc->{ config }; + $config->set('ml_name', $ml_name); + $config->set('ml_domain', $ml_domain); + $config->set('ml_home_prefix', $ml_home_prefix); + $config->set('ml_home_dir', $ml_home_dir); +} + + =head2 article_id_max() return the current article number (sequence number). |
