version 1.545.2.1, 2004/09/22 18:31:12
|
version 1.545.2.3, 2004/10/12 20:37:04
|
Line 1012 EVALBLOCK
|
Line 1012 EVALBLOCK
|
sub devalidate_cache_new { |
sub devalidate_cache_new { |
my ($cache,$name,$id) = @_; |
my ($cache,$name,$id) = @_; |
if (0) { &Apache::lonnet::logthis("deleting $name:$id"); } |
if (0) { &Apache::lonnet::logthis("deleting $name:$id"); } |
$cache->delete($name.':'.$id); |
$cache->delete(&escape($name.':'.$id)); |
} |
} |
|
|
my $lastone; |
my $lastone; |
Line 1020 my $lastname;
|
Line 1020 my $lastname;
|
sub is_cached_new { |
sub is_cached_new { |
my ($cache,$name,$id,$debug) = @_; |
my ($cache,$name,$id,$debug) = @_; |
$debug=0; |
$debug=0; |
$id=$name.':'.$id; |
$id=&escape($name.':'.$id); |
if ($lastname eq $id) { |
if ($lastname eq $id) { |
if ($debug) { &Apache::lonnet::logthis("Earyl return $id of $lastone <= $lastname "); } |
if ($debug) { &Apache::lonnet::logthis("Earyl return $id of $lastone <= $lastname "); } |
return ($lastone,1); |
return ($lastone,1); |
Line 1045 sub is_cached_new {
|
Line 1045 sub is_cached_new {
|
sub do_cache_new { |
sub do_cache_new { |
my ($cache,$name,$id,$value,$time,$debug) = @_; |
my ($cache,$name,$id,$value,$time,$debug) = @_; |
$debug=0; |
$debug=0; |
$id=$name.':'.$id; |
$id=&escape($name.':'.$id); |
my $setvalue=$value; |
my $setvalue=$value; |
if (!defined($setvalue)) { |
if (!defined($setvalue)) { |
$setvalue='__undef__'; |
$setvalue='__undef__'; |
Line 2253 sub tmprestore {
|
Line 2253 sub tmprestore {
|
} |
} |
|
|
# ----------------------------------------------------------------------- Store |
# ----------------------------------------------------------------------- Store |
my $memcache_store=0; |
|
sub store { |
sub store { |
my ($storehash,$symb,$namespace,$domain,$stuname) = @_; |
my ($storehash,$symb,$namespace,$domain,$stuname) = @_; |
my $home=''; |
my $home=''; |
Line 2268 sub store {
|
Line 2267 sub store {
|
|
|
&devalidate($symb,$stuname,$domain); |
&devalidate($symb,$stuname,$domain); |
$symb=escape($symb); |
$symb=escape($symb); |
$memcache_store && |
|
$metacache->delete("store:".$symb.":".$stuname.":".$domain.':'.$namespace); |
|
if (!$namespace) { |
if (!$namespace) { |
unless ($namespace=$ENV{'request.course.id'}) { |
unless ($namespace=$ENV{'request.course.id'}) { |
return ''; |
return ''; |
Line 2305 sub cstore {
|
Line 2302 sub cstore {
|
|
|
&devalidate($symb,$stuname,$domain); |
&devalidate($symb,$stuname,$domain); |
$symb=escape($symb); |
$symb=escape($symb); |
$memcache_store && |
|
$metacache->delete("store:".$symb.":".$stuname.":".$domain.':'.$namespace); |
|
if (!$namespace) { |
if (!$namespace) { |
unless ($namespace=$ENV{'request.course.id'}) { |
unless ($namespace=$ENV{'request.course.id'}) { |
return ''; |
return ''; |
Line 2348 sub restore {
|
Line 2343 sub restore {
|
if (!$domain) { $domain=$ENV{'user.domain'}; } |
if (!$domain) { $domain=$ENV{'user.domain'}; } |
if (!$stuname) { $stuname=$ENV{'user.name'}; } |
if (!$stuname) { $stuname=$ENV{'user.name'}; } |
if (!$home) { $home=$ENV{'user.home'}; } |
if (!$home) { $home=$ENV{'user.home'}; } |
if ($memcache_store) { |
|
my $rethash=$metacache->get("store:".$symb.":".$stuname.":". |
|
$domain.':'.$namespace); |
|
if ($rethash) { return %{$rethash}; } |
|
} |
|
my $answer=&reply("restore:$domain:$stuname:$namespace:$symb","$home"); |
my $answer=&reply("restore:$domain:$stuname:$namespace:$symb","$home"); |
|
|
my %returnhash=(); |
my %returnhash=(); |
Line 2366 sub restore {
|
Line 2357 sub restore {
|
$returnhash{$_}=$returnhash{$version.':'.$_}; |
$returnhash{$_}=$returnhash{$version.':'.$_}; |
} |
} |
} |
} |
if ($memcache_store) { |
|
$metacache->set("store:".$symb.":".$stuname.":".$domain.':'.$namespace, |
|
\%returnhash); |
|
} |
|
return %returnhash; |
return %returnhash; |
} |
} |
|
|
Line 2849 sub allowed {
|
Line 2836 sub allowed {
|
} |
} |
|
|
# Free bre to public access |
# Free bre to public access |
|
|
if ($priv eq 'bre') { |
if ($priv eq 'bre') { |
my $copyright=&metadata($uri,'copyright'); |
my $copyright=&metadata($uri,'copyright'); |
if (($copyright eq 'public') && (!$ENV{'request.course.id'})) { |
if (($copyright eq 'public') && (!$ENV{'request.course.id'})) { |