version 1.1124, 2011/08/02 03:11:42
|
version 1.1125, 2011/08/05 04:35:50
|
Line 308 sub get_server_homeID {
|
Line 308 sub get_server_homeID {
|
|
|
sub get_remote_globals { |
sub get_remote_globals { |
my ($lonhost,$whathash,$ignore_cache) = @_; |
my ($lonhost,$whathash,$ignore_cache) = @_; |
my (%returnhash,%whatneeded); |
my ($result,%returnhash,%whatneeded); |
if (ref($whathash) eq 'ARRAY') { |
if (ref($whathash) eq 'HASH') { |
foreach my $what (sort(keys(%{$whathash}))) { |
foreach my $what (sort(keys(%{$whathash}))) { |
my $type = $whathash->{$what}; |
|
my $hashid = $lonhost.'-'.$what; |
my $hashid = $lonhost.'-'.$what; |
my ($result,$cached); |
my ($response,$cached); |
unless ($ignore_cache) { |
unless ($ignore_cache) { |
($result,$cached)=&is_cached_new('lonnetglobal',$hashid); |
($response,$cached)=&is_cached_new('lonnetglobal',$hashid); |
$returnhash{$what} = $result; |
|
} |
} |
if (defined($cached)) { |
if (defined($cached)) { |
$returnhash{$what} = $result; |
$returnhash{$what} = $response; |
} else { |
} else { |
$whatneeded{$what} = $type; |
$whatneeded{$what} = 1; |
} |
} |
} |
} |
if (keys(%whatneeded) > 0) { |
if (keys(%whatneeded) == 0) { |
|
$result = 'ok'; |
|
} else { |
my $requested = &freeze_escape(\%whatneeded); |
my $requested = &freeze_escape(\%whatneeded); |
my $rep=&reply('readlonnetglobal:'.$requested,$lonhost); |
my $rep=&reply('readlonnetglobal:'.$requested,$lonhost); |
unless (($rep=~/^refused/) || ($rep=~/^rejected/) || ($rep eq 'con_lost')) { |
if (($rep=~/^(refused|rejected|error)/) || ($rep eq 'con_lost') || |
|
($rep eq 'unknown_cmd')) { |
|
$result = $rep; |
|
} else { |
|
$result = 'ok'; |
my @pairs=split(/\&/,$rep); |
my @pairs=split(/\&/,$rep); |
if ($rep !~ /^error/) { |
foreach my $item (@pairs) { |
foreach my $item (@pairs) { |
my ($key,$value)=split(/=/,$item,2); |
my ($key,$value)=split(/=/,$item,2); |
my $what = &unescape($key); |
my $what = &unescape($key); |
my $hashid = $lonhost.'-'.$what; |
my $hashid = $lonhost.'-'.$what; |
$returnhash{$what}=&thaw_unescape($value); |
$returnhash{$what}=&thaw_unescape($value); |
&do_cache_new('lonnetglobal',$hashid,$returnhash{$what},600); |
&do_cache_new('lonnetglobal',$hashid,$returnhash{$what},600); |
|
} |
|
} |
} |
} |
} |
} |
} |
} |
} |
return %returnhash; |
return ($result,\%returnhash); |
} |
} |
|
|
sub remote_devalidate_cache { |
sub remote_devalidate_cache { |