[LON-CAPA-cvs] cvs: loncom / lond
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 23 Jul 2004 15:24:58 -0000
albertel Fri Jul 23 11:24:58 2004 EDT
Modified files:
/loncom lond
Log:
- bug in tie_domain_hash,
- style enforcement
Index: loncom/lond
diff -u loncom/lond:1.209 loncom/lond:1.210
--- loncom/lond:1.209 Fri Jul 23 10:10:47 2004
+++ loncom/lond Fri Jul 23 11:24:57 2004
@@ -2,7 +2,7 @@
# The LearningOnline Network
# lond "LON Daemon" Server (port "LOND" 5663)
#
-# $Id: lond,v 1.209 2004/07/23 14:10:47 albertel Exp $
+# $Id: lond,v 1.210 2004/07/23 15:24:57 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -56,7 +56,7 @@
my $status='';
my $lastlog='';
-my $VERSION='$Revision: 1.209 $'; #' stupid emacs
+my $VERSION='$Revision: 1.210 $'; #' stupid emacs
my $remoteVERSION;
my $currenthostid;
my $currentdomainid;
@@ -956,9 +956,7 @@
# if the tie failed.
#
sub tie_domain_hash {
- my ($domain,
- $namespace,
- $how) = @_;
+ my ($domain,$namespace,$how,$loghead,$logtail) = @_;
# Filter out any whitespace in the domain name:
@@ -972,16 +970,15 @@
my %hash;
if(tie(%hash, 'GDBM_File', $resource_file, $how, 0640)) {
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) {
my $timestamp = time;
- my ($loghead, $logtail) = @_;
print $logFh "$loghead:$timestamp:$logtail\n";
}
+ $logFh->close;
}
return \%hash; # Return the tied hash.
- }
- else {
+ } else {
return undef; # Tie failed.
}
}
@@ -1005,13 +1002,9 @@
# hash to which the database is tied. It's up to the caller to untie.
# undef if the has could not be tied.
#
-sub TieUserHash {
- my ($domain,
- $user,
- $namespace,
- $how) = @_;
+sub tie_user_hash {
+ my ($domain,$user,$namespace,$how,$loghead,$what) = @_;
-
$namespace=~s/\//\_/g; # / -> _
$namespace=~s/\W//g; # whitespace eliminated.
my $proname = propath($domain, $user);
@@ -1029,10 +1022,9 @@
my $hfh = IO::File->new(">>$proname/$namespace.hist");
if($hfh) {
my $now = time;
- my $loghead = shift;
- my $what = shift;
print $hfh "$loghead:$now:$what\n";
}
+ $hfh->close;
}
return \%hash;
} else {