summaryrefslogtreecommitdiff
path: root/fml/lib
diff options
context:
space:
mode:
authorfukachan <fukachan>2002-09-28 09:27:42 +0000
committerfukachan <fukachan>2002-09-28 09:27:42 +0000
commit853270e800f3733cbbb31bf6d74b052eef6a2127 (patch)
tree8bdcf5bcd76b828498f42e62071e60a77900d61d /fml/lib
parentee8f7c907631f76052fff6ff8563327df04df160 (diff)
downloadfml8-853270e800f3733cbbb31bf6d74b052eef6a2127.tar.gz
fml8-853270e800f3733cbbb31bf6d74b052eef6a2127.tar.bz2
fml8-853270e800f3733cbbb31bf6d74b052eef6a2127.zip
we should not use hard-coded file/dir mode
Diffstat (limited to 'fml/lib')
-rw-r--r--fml/lib/FML/Confirm.pm5
-rw-r--r--fml/lib/FML/Header/MessageID.pm8
-rw-r--r--fml/lib/File/CacheDir.pm6
-rw-r--r--fml/lib/Mail/Delivery/Queue.pm12
-rw-r--r--fml/lib/Mail/Message/ToHTML.pm14
-rwxr-xr-xfml/lib/Mail/ThreadTrack.pm12
-rw-r--r--fml/lib/Mail/ThreadTrack/DB.pm11
7 files changed, 44 insertions, 24 deletions
diff --git a/fml/lib/FML/Confirm.pm b/fml/lib/FML/Confirm.pm
index 5cd48482..8156fdfe 100644
--- a/fml/lib/FML/Confirm.pm
+++ b/fml/lib/FML/Confirm.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: Confirm.pm,v 1.6 2002/09/15 00:08:54 fukachan Exp $
+# $FML: Confirm.pm,v 1.7 2002/09/22 14:56:40 fukachan Exp $
#
package FML::Confirm;
@@ -117,6 +117,7 @@ sub _open_db
{
my ($self, $id, $comment) = @_;
my (%db) = ();
+ my $mode = $self->{ _dir_mode } || 0700;
use File::Spec;
my $cache_dir = $self->{ _cache_dir };
@@ -125,7 +126,7 @@ sub _open_db
unless (-d $dir) {
use File::Path;
- mkpath( [ $dir ], 0, 0700 );
+ mkpath( [ $dir ], 0, $mode );
}
use Tie::JournaledDir;
diff --git a/fml/lib/FML/Header/MessageID.pm b/fml/lib/FML/Header/MessageID.pm
index fad54515..e183bc20 100644
--- a/fml/lib/FML/Header/MessageID.pm
+++ b/fml/lib/FML/Header/MessageID.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: MessageID.pm,v 1.7 2002/09/11 23:18:12 fukachan Exp $
+# $FML: MessageID.pm,v 1.8 2002/09/22 14:56:50 fukachan Exp $
#
package FML::Header::MessageID;
@@ -77,8 +77,10 @@ sub db_open
if ($dir) {
unless (-d $dir) {
- eval q{ use File::Utils qw(mkdirhier);};
- mkdirhier($dir, 0700);
+ my $dir_mode = $self->{ _dir_mode } || 0700;
+
+ use File::Path;
+ mkpath( [ $dir ], 0, $dir_mode );
}
my %db = ();
diff --git a/fml/lib/File/CacheDir.pm b/fml/lib/File/CacheDir.pm
index add5dbc8..98a2483b 100644
--- a/fml/lib/File/CacheDir.pm
+++ b/fml/lib/File/CacheDir.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: CacheDir.pm,v 1.19 2002/09/15 00:07:53 fukachan Exp $
+# $FML: CacheDir.pm,v 1.20 2002/09/22 14:56:57 fukachan Exp $
#
package File::CacheDir;
@@ -128,14 +128,14 @@ sub _take_file_name
my $sequence_file_name = $args->{ sequence_file_name } || '.seq';
my $modulus = $args->{ modulus } || 128;
my $cache_type = $args->{ cache_type } || 'cyclic';
+ my $dir_mode = $args->{ dir_mode } || 0755;
my $file;
eval q{ use File::Spec;};
unless (-d $directory) {
use File::Path;
- my $mode = $args->{ directory_mode } || 0755;
- mkpath( [ $directory ], 0, $mode);
+ mkpath( [ $directory ], 0, $dir_mode);
}
if ($cache_type eq 'temporal') {
diff --git a/fml/lib/Mail/Delivery/Queue.pm b/fml/lib/Mail/Delivery/Queue.pm
index 0ee1a4bc..8129981a 100644
--- a/fml/lib/Mail/Delivery/Queue.pm
+++ b/fml/lib/Mail/Delivery/Queue.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: Queue.pm,v 1.17 2002/09/11 23:18:23 fukachan Exp $
+# $FML: Queue.pm,v 1.18 2002/09/22 14:57:02 fukachan Exp $
#
package Mail::Delivery::Queue;
@@ -73,6 +73,9 @@ C<new()> assigns them but do no actual works.
=cut
+my $dir_mode = 0755;
+
+
# Descriptions: constructor.
# Arguments: OBJ($self) HASH_REF($args)
# Side Effects: initialize object
@@ -91,6 +94,11 @@ sub new
$me->{ _new_qf } = File::Spec->catfile($dir, "new", $id);
$me->{ _active_qf } = File::Spec->catfile($dir, "active", $id);
+ # queue directory mode
+ if (defined $args->{ directory_mode }) {
+ $dir_mode = $args->{ directory_mode };
+ }
+
# infomation for delivery
$me->{ _info }->{ sender } =
File::Spec->catfile($dir, "info", "sender", $id);
@@ -121,7 +129,7 @@ sub _mkdirhier
eval q{
use File::Path;
- mkpath( [ $dir ], 0, 0755);
+ mkpath( [ $dir ], 0, $dir_mode);
};
warn($@) if $@;
}
diff --git a/fml/lib/Mail/Message/ToHTML.pm b/fml/lib/Mail/Message/ToHTML.pm
index 734fb9e7..9f42646a 100644
--- a/fml/lib/Mail/Message/ToHTML.pm
+++ b/fml/lib/Mail/Message/ToHTML.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: ToHTML.pm,v 1.22 2002/09/11 23:18:27 fukachan Exp $
+# $FML: ToHTML.pm,v 1.23 2002/09/22 14:57:04 fukachan Exp $
#
package Mail::Message::ToHTML;
@@ -17,7 +17,7 @@ my $debug = 0;
my $URL =
"<A HREF=\"http://www.fml.org/software/\">Mail::Message::ToHTML</A>";
-my $version = q$FML: ToHTML.pm,v 1.22 2002/09/11 23:18:27 fukachan Exp $;
+my $version = q$FML: ToHTML.pm,v 1.23 2002/09/22 14:57:04 fukachan Exp $;
if ($version =~ /,v\s+([\d\.]+)\s+/) {
$version = "$URL $1";
}
@@ -357,6 +357,7 @@ sub _html_file_subdir_name
my $month_db = $self->{ _db }->{ _month };
my $subdir_db = $self->{ _db }->{ _subdir };
my $curid = $self->{ _current_id };
+ my $dir_mode = $self->{ _dir_mode } || 0755;
if ($subdir_style eq 'yyyymm') {
if (defined $subdir_db->{ $id } && $subdir_db->{ $id }) {
@@ -374,7 +375,7 @@ sub _html_file_subdir_name
use File::Spec;
my $xsubdir = File::Spec->catfile($html_base_dir, $subdir);
unless (-d $xsubdir) {
- mkdir($xsubdir, 0755);
+ mkdir($xsubdir, $dir_mode);
}
}
}
@@ -1573,8 +1574,9 @@ my @kind_of_databases = qw(from date subject message_id references
sub _db_open
{
my ($self, $args) = @_;
- my $db_type = $args->{ db_type } || $self->{ _db_type } || 'AnyDBM_File';
- my $db_dir = $self->{ _html_base_directory };
+ my $db_type = $args->{ db_type } || $self->{ _db_type } || 'AnyDBM_File';
+ my $db_dir = $self->{ _html_base_directory };
+ my $file_mode = $self->{ _file_mode } || 0644;
_PRINT_DEBUG("_db_open( type = $db_type )");
@@ -1584,7 +1586,7 @@ sub _db_open
my $file = "$db_dir/.htdb_${db}";
my $str = qq{
my \%$db = ();
- tie \%$db, \$db_type, \$file, O_RDWR|O_CREAT, 0644;
+ tie \%$db, \$db_type, \$file, O_RDWR|O_CREAT, $file_mode;
\$self->{ _db }->{ _$db } = \\\%$db;
};
eval $str;
diff --git a/fml/lib/Mail/ThreadTrack.pm b/fml/lib/Mail/ThreadTrack.pm
index 5750759c..c2dc369d 100755
--- a/fml/lib/Mail/ThreadTrack.pm
+++ b/fml/lib/Mail/ThreadTrack.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: ThreadTrack.pm,v 1.28 2002/09/11 23:18:22 fukachan Exp $
+# $FML: ThreadTrack.pm,v 1.29 2002/09/22 14:57:00 fukachan Exp $
#
package Mail::ThreadTrack;
@@ -67,6 +67,9 @@ C<$id> is sequential number for input data (article).
=cut
+my $dir_mode = 0755;
+
+
# Descriptions: constructor
# Arguments: OBJ($self)
# Side Effects: none
@@ -80,6 +83,10 @@ sub new
db_type => 'AnyDBM_File',
};
+ if (defined $args->{ dir_mode }) {
+ $dir_mode = $args->{ dir_mode };
+ }
+
my @keys = qw(myname ml_name spool_dir article_id db_base_dir
reverse_order
rewrite_header
@@ -153,12 +160,11 @@ sub DESTROY {}
sub _mkdirhier
{
my ($dir, $mode) = @_;
- $mode = defined $mode ? $mode : 0700;
# XXX $mode (e.g. 0755) should be a numeric not a string
eval q{
use File::Path;
- mkpath($dir, 0, $mode);
+ mkpath($dir, 0, $dir_mode);
};
return ($@ ? undef : 1);
diff --git a/fml/lib/Mail/ThreadTrack/DB.pm b/fml/lib/Mail/ThreadTrack/DB.pm
index 5e934f27..ccd883cc 100644
--- a/fml/lib/Mail/ThreadTrack/DB.pm
+++ b/fml/lib/Mail/ThreadTrack/DB.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: DB.pm,v 1.27 2002/09/11 23:18:29 fukachan Exp $
+# $FML: DB.pm,v 1.28 2002/09/22 14:57:06 fukachan Exp $
#
package Mail::ThreadTrack::DB;
@@ -57,8 +57,9 @@ my @kind_of_databases = qw(thread_id date status sender articles
sub db_open
{
my ($self) = @_;
- my $db_type = $self->{ config }->{ db_type } || 'AnyDBM_File';
- my $db_dir = $self->{ _db_dir };
+ my $db_type = $self->{ config }->{ db_type } || 'AnyDBM_File';
+ my $db_dir = $self->{ _db_dir };
+ my $file_mode = $self->{ _file_mode } || 0644;
use File::Spec;
eval qq{ use $db_type; use Fcntl;};
@@ -67,7 +68,7 @@ sub db_open
my $file = File::Spec->catfile($db_dir, $db);
my $str = qq{
my \%$db = ();
- tie \%$db, \$db_type, \$file, O_RDWR|O_CREAT, 0644;
+ tie \%$db, \$db_type, \$file, O_RDWR|O_CREAT, $file_mode;
\$self->{ _hash_table }->{ _$db } = \\\%$db;
};
eval $str;
@@ -77,7 +78,7 @@ sub db_open
my %index = ();
my $index_file = $self->{ _index_db };
eval q{
- tie %index, $db_type, $index_file, O_RDWR|O_CREAT, 0644;
+ tie %index, $db_type, $index_file, O_RDWR|O_CREAT, $file_mode;
$self->{ _hash_table }->{ _index } = \%index;
};
croak($@) if $@;