--- loncom/lonnet/perl/lonnet.pm 2001/10/05 17:54:36 1.161 +++ loncom/lonnet/perl/lonnet.pm 2001/10/30 19:19:09 1.167 @@ -130,7 +130,7 @@ # July Guy Albertelli # 8/4,8/7,8/8,8/9,8/11,8/16,8/17,8/18,8/20,8/23,9/20,9/21,9/26, # 10/2 Gerd Kortemeyer -# 10/5 Scott Harrison +# 10/5,10/10 Scott Harrison package Apache::lonnet; @@ -148,14 +148,23 @@ use Fcntl qw(:flock); # --------------------------------------------------------------------- Logging +sub logtouch { + my $execdir=$perlvar{'lonDaemons'}; + unless (-e "$execdir/logs/lonnet.log") { + my $fh=Apache::File->new(">>$execdir/logs/lonnet.log"); + close $fh; + } + my ($wwwuid,$wwwgid)=(getpwnam('www'))[2,3]; + chown($wwwuid,$wwwgid,$execdir.'/logs/lonnet.log'); +} + sub logthis { my $message=shift; my $execdir=$perlvar{'lonDaemons'}; my $now=time; my $local=localtime($now); - my $fh; - $fh=Apache::File->new(">>$execdir/logs/lonnet.log") and - print $fh "$local ($$): $message\n"; + my $fh=Apache::File->new(">>$execdir/logs/lonnet.log"); + print $fh "$local ($$): $message\n"; return 1; } @@ -164,9 +173,8 @@ sub logperm { my $execdir=$perlvar{'lonDaemons'}; my $now=time; my $local=localtime($now); - my $fh; - $fh=Apache::File->new(">>$execdir/logs/lonnet.perm.log") and - print $fh "$now:$message:$local\n"; + my $fh=Apache::File->new(">>$execdir/logs/lonnet.perm.log"); + print $fh "$now:$message:$local\n"; return 1; } @@ -846,6 +854,37 @@ sub devalidate { } } +# -------------------------------------------------------------------Temp Store + +sub tmpstore { + my ($storehash,$symb,$namespace,$domain,$stuname) = @_; + my $home=''; + + if ($stuname) { + $home=&homeserver($stuname,$domain); + + } + + if (!$symb) { + $symb=&symbread(); + if (!$symb) { + $symb= $ENV{'request.url'}; + } + } + + $symb=escape($symb); + if (!$namespace) { unless ($namespace=$ENV{'request.course.id'}) { return ''; } } + if (!$domain) { $domain=$ENV{'user.domain'}; } + if (!$stuname) { $stuname=$ENV{'user.name'}; } + if (!$home) { $home=$ENV{'user.home'}; } + my $namevalue=''; + map { + $namevalue.=escape($_).'='.escape($$storehash{$_}).'&'; + } keys %$storehash; + $namevalue=~s/\&$//; + +} + # ----------------------------------------------------------------------- Store sub store { @@ -1233,7 +1272,7 @@ sub allowed { # If this is generating or modifying users, exit with special codes - if (':csu:cdc:ccc:cin:cta:cep:ccr:cst:cad:cli:cau:cdg:'=~/\:$priv\:/) { + if (':csu:cdc:ccc:cin:cta:cep:ccr:cst:cad:cli:cau:cdg:cca:'=~/\:$priv\:/) { return $thisallowed; } # @@ -2425,6 +2464,7 @@ unless ($readit) { %metacache=(); $readit='done'; +&logtouch(); &logthis('INFO: Read configuration'); } }