Parent Directory
|
Revision Log
++ swe/lib/SWE/DB/ChangeLog 9 Nov 2008 06:46:33 -0000 2008-11-09 Wakaba <wakaba@suika.fam.cx> * Lock.pm, HashedProps.pm, IDDOM.pm, IDGenerator.pm, IDProps.pm, IDText.pm, SuikaWiki3PageList.pm: New modules. * SuikaWiki3.pm, SuikaWiki3LastModified.pm: Changed to use plain base 16 encoded file name string as key, rather than array reference as in SuikaWiki3. * SuikaWiki3LastModified.pm (save_data, set_data): Removed. (load_data): Renamed as |_load_data|. (get_data): Invoke |_load_data| if and only if necessary. * SuikaWiki3Props.pm: Don't treat "%" as a part of hash key.
1 | wakaba | 1.1 | package SWE::DB::HashedProps; |
2 | use strict; | ||
3 | |||
4 | require SWE::DB::IDProps; | ||
5 | push our @ISA, 'SWE::DB::IDProps'; | ||
6 | |||
7 | require Digest::MD5; | ||
8 | require Encode; | ||
9 | |||
10 | sub _get_file_name ($$$) { | ||
11 | my $self = shift; | ||
12 | my $hash = Digest::MD5::md5_hex (Encode::encode ('utf8', $_[0])); | ||
13 | my $mkdir = $_[1]; | ||
14 | |||
15 | my $dir1 = $self->{root_directory_name} . substr ($hash, 0, 2); | ||
16 | my $dir2 = $dir1 . '/' . substr ($hash, 2, 2); | ||
17 | substr ($hash, 0, 4) = ''; | ||
18 | |||
19 | my $file_name = $dir2 . '/' . $hash . $self->{leaf_suffix}; | ||
20 | |||
21 | unless ($mkdir) { | ||
22 | return $file_name; | ||
23 | } | ||
24 | |||
25 | unless (-d $dir1) { | ||
26 | mkdir $dir1 or die "$0: $dir1: $!"; | ||
27 | } | ||
28 | |||
29 | unless (-d $dir1 . '/CVS') { | ||
30 | ## TODO: ... | ||
31 | } | ||
32 | |||
33 | unless (-d $dir2) { | ||
34 | mkdir $dir2 or die "$0: $dir2: $!"; | ||
35 | } | ||
36 | |||
37 | unless (-d $dir2 . '/CVS') { | ||
38 | ## TODO: ... | ||
39 | } | ||
40 | |||
41 | return $file_name; | ||
42 | } # _get_file_name | ||
43 | |||
44 | 1; |
admin@suikawiki.org | ViewVC Help |
Powered by ViewVC 1.1.24 |