version 1.209, 2004/07/23 14:10:47
|
version 1.210, 2004/07/23 15:24:57
|
Line 956 sub EditFile {
|
Line 956 sub EditFile {
|
# if the tie failed. |
# if the tie failed. |
# |
# |
sub tie_domain_hash { |
sub tie_domain_hash { |
my ($domain, |
my ($domain,$namespace,$how,$loghead,$logtail) = @_; |
$namespace, |
|
$how) = @_; |
|
|
|
# Filter out any whitespace in the domain name: |
# Filter out any whitespace in the domain name: |
|
|
Line 972 sub tie_domain_hash {
|
Line 970 sub tie_domain_hash {
|
my %hash; |
my %hash; |
if(tie(%hash, 'GDBM_File', $resource_file, $how, 0640)) { |
if(tie(%hash, 'GDBM_File', $resource_file, $how, 0640)) { |
if (scalar @_) { # Need to log the operation. |
if (scalar @_) { # Need to log the operation. |
my $logFh = IO::File->new(">>domain_dir/$namespace.hist"); |
my $logFh = IO::File->new(">>$domain_dir/$namespace.hist"); |
if($logFh) { |
if($logFh) { |
my $timestamp = time; |
my $timestamp = time; |
my ($loghead, $logtail) = @_; |
|
print $logFh "$loghead:$timestamp:$logtail\n"; |
print $logFh "$loghead:$timestamp:$logtail\n"; |
} |
} |
|
$logFh->close; |
} |
} |
return \%hash; # Return the tied hash. |
return \%hash; # Return the tied hash. |
} |
} else { |
else { |
|
return undef; # Tie failed. |
return undef; # Tie failed. |
} |
} |
} |
} |
Line 1005 sub tie_domain_hash {
|
Line 1002 sub tie_domain_hash {
|
# hash to which the database is tied. It's up to the caller to untie. |
# hash to which the database is tied. It's up to the caller to untie. |
# undef if the has could not be tied. |
# undef if the has could not be tied. |
# |
# |
sub TieUserHash { |
sub tie_user_hash { |
my ($domain, |
my ($domain,$user,$namespace,$how,$loghead,$what) = @_; |
$user, |
|
$namespace, |
|
$how) = @_; |
|
|
|
|
|
$namespace=~s/\//\_/g; # / -> _ |
$namespace=~s/\//\_/g; # / -> _ |
$namespace=~s/\W//g; # whitespace eliminated. |
$namespace=~s/\W//g; # whitespace eliminated. |
my $proname = propath($domain, $user); |
my $proname = propath($domain, $user); |
Line 1029 sub TieUserHash {
|
Line 1022 sub TieUserHash {
|
my $hfh = IO::File->new(">>$proname/$namespace.hist"); |
my $hfh = IO::File->new(">>$proname/$namespace.hist"); |
if($hfh) { |
if($hfh) { |
my $now = time; |
my $now = time; |
my $loghead = shift; |
|
my $what = shift; |
|
print $hfh "$loghead:$now:$what\n"; |
print $hfh "$loghead:$now:$what\n"; |
} |
} |
|
$hfh->close; |
} |
} |
return \%hash; |
return \%hash; |
} else { |
} else { |