summaryrefslogtreecommitdiff
path: root/fml/lib/FML
diff options
context:
space:
mode:
authorfukachan <fukachan>2008-09-14 11:44:14 +0000
committerfukachan <fukachan>2008-09-14 11:44:14 +0000
commit46da968537d84fcdccd856ea5627e2da094d6fb3 (patch)
tree46260a33b400f975e80801feb7e386867792a7f9 /fml/lib/FML
parent9573cee3e00835d1cfdd5907e0489806505d5617 (diff)
downloadfml8-46da968537d84fcdccd856ea5627e2da094d6fb3.tar.gz
fml8-46da968537d84fcdccd856ea5627e2da094d6fb3.tar.bz2
fml8-46da968537d84fcdccd856ea5627e2da094d6fb3.zip
define ml_name_list(), which returns the list of valid ml in the
specified domain. fix documents and todo.
Diffstat (limited to 'fml/lib/FML')
-rw-r--r--fml/lib/FML/Process/Utils.pm51
1 files changed, 45 insertions, 6 deletions
diff --git a/fml/lib/FML/Process/Utils.pm b/fml/lib/FML/Process/Utils.pm
index b8547e57..5058d1e4 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.152 2008/07/20 00:38:53 fukachan Exp $
+# $FML: Utils.pm,v 1.153 2008/09/09 09:47:57 fukachan Exp $
#
package FML::Process::Utils;
@@ -846,14 +846,15 @@ sub unique
=head2 ml_home_dir_deleted_path($ml_home_prefix, $ml_name)
-return ml_home_dir to be removed.
+return ml_home_dir to be removed. If mupltiple directories are
+matched, return the latest removed one by using
+ml_home_dir_find_latest_deleted_path().
-=cut
+=head2 ml_home_dir_find_latest_deleted_path($ml_home_prefix, $ml_name)
+find the latest removed ml_home_dir and return it.
-#
-# XXX-TODO: when we remove twice a day ?
-#
+=cut
# Descriptions: return ml_home_dir to be removed.
@@ -998,6 +999,44 @@ sub _mtime
}
+# Descriptions: return the list of valid ml_name(s) in the specified domain.
+# Arguments: OBJ($curproc) STR($ml_domain)
+# Side Effects: none
+# Return Value: ARRAY_REF
+sub ml_name_list
+{
+ my ($curproc, $ml_domain) = @_;
+ my ($ml_domain_base_dir) = $curproc->ml_home_prefix($ml_domain);
+ my (@r_list) = ();
+
+ use DirHandle;
+ my $dh = new DirHandle $ml_domain_base_dir;
+ if (defined $dh) {
+ my $entry;
+
+ ENTRY:
+ while ($entry = $dh->read()) {
+ next ENTRY if $entry =~ /^\./;
+ next ENTRY if $entry =~ /^\@/;
+
+ my $config_cf = File::Spec->catfile($ml_domain_base_dir,
+ $entry,
+ "config.cf");
+ if (-f $config_cf) {
+ push(@r_list, $entry);
+ }
+ }
+
+ $dh->close();
+ }
+ else {
+ $curproc->logerror("cannot opendir $ml_domain_base_dir");
+ }
+
+ return(\@r_list);
+}
+
+
=head1 METHODS for convenience
=head2 fml_version()