--- loncom/lonnet/perl/lonnet.pm 2000/12/06 19:58:31 1.76 +++ loncom/lonnet/perl/lonnet.pm 2000/12/12 21:32:46 1.78 @@ -81,7 +81,7 @@ # 10/06,10/09,10/10,10/11,10/14,10/20,10/23,10/25,10/26,10/27,10/28,10/29, # 10/30,10/31, # 11/2,11/14,11/15,11/16,11/20,11/21,11/22,11/25,11/27, -# 12/02 Gerd Kortemeyer +# 12/02,12/12 Gerd Kortemeyer package Apache::lonnet; @@ -90,7 +90,7 @@ use Apache::File; use LWP::UserAgent(); use HTTP::Headers; use vars -qw(%perlvar %hostname %homecache %spareid %hostdom %libserv %pr %prp %fe %fd $readit %metacache $unique); +qw(%perlvar %hostname %homecache %spareid %hostdom %libserv %pr %prp %fe %fd $readit %metacache); use IO::Socket; use GDBM_File; use Apache::Constants qw(:common :http); @@ -1461,8 +1461,12 @@ sub EXT { # --------------------------------------------- last, look in resource metadata + $spacequalifierrest=~s/\./\_/; my $metadata=&metadata($ENV{'request.filename'},$spacequalifierrest); if ($metadata) { return $metadata; } + $metadata=&metadata($ENV{'request.filename'}, + 'parameter_'.$spacequalifierrest); + if ($metadata) { return $metadata; } # ---------------------------------------------------- Any other user namespace } elsif ($realm eq 'environment') { @@ -1481,6 +1485,7 @@ sub EXT { sub metadata { my ($uri,$what)=@_; + $uri=&declutter($uri); my $filename=$uri; $uri=~s/\.meta$//; @@ -1507,7 +1512,11 @@ sub metadata { map { $metacache{$uri.':'.$unikey.'.'.$_}=$token->[2]->{$_}; } @{$token->[3]}; - $metacache{$uri.':'.$unikey}=$parser->get_text('/'.$entry); + unless ( + $metacache{$uri.':'.$unikey}=$parser->get_text('/'.$entry) + ) { $metacache{$uri.':'.$unikey}= + $metacache{$uri.':'.$unikey.'.default'}; + } } } } @@ -1639,7 +1648,7 @@ sub ireceipt { my $cudom=unpack("%32C*",$fudom); my $cucourseid=unpack("%32C*",$fucourseid); my $cusymb=unpack("%32C*",$fusymb); - my $cunique=unpack("%32C*",$unique); + my $cunique=unpack("%32C*",$perlvar{'lonReceipt'}); return unpack("%32C*",$perlvar{'lonHostID'}).'-'. ($cunique%$cuname+ $cunique%$cudom+ @@ -1800,24 +1809,6 @@ if ($readit ne 'done') { } } -# --------------------------------------------------- Get CPU data as unique ID -{ - my @contents; - { - my $fh=Apache::File->new('/proc/cpuinfo'); - @contents=<$fh>; - } - $unique=''; - map { - my ($name,$value)=split(/\s*\:\s*/,$_); - if (($name eq 'vendor_id') || ($name=~/^model/) || - ($name=~/^cpu/) || ($name eq 'stepping')) { - $unique.=$value; - } - } @contents; - $unique=~s/\W//g; -} - %metacache=(); $readit='done';