--- loncom/lonnet/perl/lonnet.pm 2005/04/18 21:19:53 1.626 +++ loncom/lonnet/perl/lonnet.pm 2005/04/22 21:01:25 1.628 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.626 2005/04/18 21:19:53 albertel Exp $ +# $Id: lonnet.pm,v 1.628 2005/04/22 21:01:25 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -258,6 +258,7 @@ sub critical { sub transfer_profile_to_env { my ($lonidsdir,$handle)=@_; + undef(%env); my @profile; { open(my $idf,"$lonidsdir/$handle.id"); @@ -827,8 +828,11 @@ sub getsection { } sub save_cache { + my ($r)=@_; + if (! $r->is_initial_req()) { return DECLINED; } &purge_remembered(); undef(%env); + return OK; } my $to_remember=-1; @@ -2561,10 +2565,16 @@ sub convert_dump_to_currentdump{ return \%returnhash; } +# ------------------------------------------------------ critical inc interface + +sub cinc { + return &inc(@_,'critical'); +} + # --------------------------------------------------------------- inc interface sub inc { - my ($namespace,$store,$udomain,$uname) = @_; + my ($namespace,$store,$udomain,$uname,$critical) = @_; if (!$udomain) { $udomain=$env{'user.domain'}; } if (!$uname) { $uname=$env{'user.name'}; } my $uhome=&homeserver($uname,$udomain); @@ -2582,7 +2592,11 @@ sub inc { } } $items=~s/\&$//; - return &reply("inc:$udomain:$uname:$namespace:$items",$uhome); + if ($critical) { + return &critical("inc:$udomain:$uname:$namespace:$items",$uhome); + } else { + return &reply("inc:$udomain:$uname:$namespace:$items",$uhome); + } } # --------------------------------------------------------------- put interface @@ -2639,21 +2653,6 @@ sub cput { return &critical("put:$udomain:$uname:$namespace:$items",$uhome); } -# ------------------------------------------------------ critical inc interface - -sub cinc { - my ($namespace,$storehash,$udomain,$uname)=@_; - if (!$udomain) { $udomain=$env{'user.domain'}; } - if (!$uname) { $uname=$env{'user.name'}; } - my $uhome=&homeserver($uname,$udomain); - my $items=''; - foreach (keys %$storehash) { - $items.=escape($_).'='.&freeze_escape($$storehash{$_}).'&'; - } - $items=~s/\&$//; - return &critical("inc:$udomain:$uname:$namespace:$items",$uhome); -} - # -------------------------------------------------------------- eget interface sub eget {