--- loncom/lonnet/perl/lonnet.pm 2001/12/06 21:03:02 1.185 +++ loncom/lonnet/perl/lonnet.pm 2001/12/12 23:34:14 1.190 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.185 2001/12/06 21:03:02 www Exp $ +# $Id: lonnet.pm,v 1.190 2001/12/12 23:34:14 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -62,9 +62,7 @@ # 11/17,11/20,11/22,11/29 Gerd Kortemeyer # 12/5 Matthew Hall # 12/5 Guy Albertelli -# 12/6 Gerd Kortemeyer -# -# $Id: lonnet.pm,v 1.185 2001/12/06 21:03:02 www Exp $ +# 12/6,12/7,12/12 Gerd Kortemeyer # ### @@ -172,7 +170,10 @@ use Apache::File; use LWP::UserAgent(); use HTTP::Headers; use vars -qw(%perlvar %hostname %homecache %hostip %spareid %hostdom %libserv %pr %prp %fe %fd %metacache %packagetab %courselogs %accesshash $processmarker); +qw(%perlvar %hostname %homecache %hostip %spareid %hostdom + %libserv %pr %prp %fe %fd %metacache %packagetab + %courselogs %accesshash $processmarker $dumpcount + %coursedombuf %coursehombuf); use IO::Socket; use GDBM_File; use Apache::Constants qw(:common :http); @@ -755,10 +756,9 @@ sub flushcourselogs { &logthis('Flushing course log buffers'); map { my $crsid=$_; - if (&reply('log:'.$ENV{'course.'.$crsid.'.domain'}.':'. - $ENV{'course.'.$crsid.'.num'}.':'. - &escape($courselogs{$crsid}), - $ENV{'course.'.$crsid.'.home'}) eq 'ok') { + if (&reply('log:'.$coursedombuf{$crsid}.':'. + &escape($courselogs{$crsid}), + $coursehombuf{$crsid}) eq 'ok') { delete $courselogs{$crsid}; } else { &logthis('Failed to flush log buffer for '.$crsid); @@ -778,12 +778,18 @@ sub flushcourselogs { delete $accesshash{$entry}; } } keys %accesshash; + $dumpcount++; } sub courselog { my $what=shift; $what=time.':'.$what; unless ($ENV{'request.course.id'}) { return ''; } + $coursedombuf{$ENV{'request.course.id'}}= + $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}.':'. + $ENV{'course.'.$ENV{'request.course.id'}.'.num'}; + $coursehombuf{$ENV{'request.course.id'}}= + $ENV{'course.'.$ENV{'request.course.id'}.'.home'}; if (defined $courselogs{$ENV{'request.course.id'}}) { $courselogs{$ENV{'request.course.id'}}.='&'.$what; } else { @@ -799,6 +805,7 @@ sub courseacclog { unless ($ENV{'request.course.id'}) { return ''; } my $what=$fnsymb.':'.$ENV{'user.name'}.':'.$ENV{'user.domain'}; if ($what=~/(problem|exam|quiz|assess|survey|form)$/) { + $what.=':POST'; map { if ($_=~/^form\.(.*)/) { $what.=':'.$1.'='.$ENV{$_}; @@ -812,7 +819,7 @@ sub countacc { my $url=&declutter(shift); unless ($ENV{'request.course.id'}) { return ''; } $accesshash{$ENV{'request.course.id'}.'___'.$url.'___course'}=1; - my $key=$processmarker.'___'.$url.'___count'; + my $key=$processmarker.'_'.$dumpcount.'___'.$url.'___count'; if (defined($accesshash{$key})) { $accesshash{$key}++; } else { @@ -1101,7 +1108,11 @@ sub store { &devalidate($symb); $symb=escape($symb); - if (!$namespace) { unless ($namespace=$ENV{'request.course.id'}) { return ''; } } + 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'}; } @@ -1110,6 +1121,7 @@ sub store { $namevalue.=escape($_).'='.escape($$storehash{$_}).'&'; } keys %$storehash; $namevalue=~s/\&$//; + &courselog($symb.':'.$stuname.':'.$domain.':STORE:'.$namevalue); return reply("store:$domain:$stuname:$namespace:$symb:$namevalue","$home"); } @@ -1126,7 +1138,11 @@ sub cstore { &devalidate($symb); $symb=escape($symb); - if (!$namespace) { unless ($namespace=$ENV{'request.course.id'}) { return ''; } } + 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'}; } @@ -1136,7 +1152,9 @@ sub cstore { $namevalue.=escape($_).'='.escape($$storehash{$_}).'&'; } keys %$storehash; $namevalue=~s/\&$//; - return critical("store:$domain:$stuname:$namespace:$symb:$namevalue","$home"); + &courselog($symb.':'.$stuname.':'.$domain.':CSTORE:'.$namevalue); + return critical + ("store:$domain:$stuname:$namespace:$symb:$namevalue","$home"); } # --------------------------------------------------------------------- Restore @@ -1152,7 +1170,11 @@ sub restore { } else { $symb=&escape($symb); } - if (!$namespace) { unless ($namespace=$ENV{'request.course.id'}) { return ''; } } + 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'}; } @@ -1733,7 +1755,7 @@ sub plaintext { return $prp{$short}; } -# ------------------------------------------------------------------ Plain Text +# ------------------------------------------------------------- Embedding Style sub fileembstyle { my $ending=lc(shift); @@ -2733,6 +2755,7 @@ BEGIN { %metacache=(); $processmarker=$$.'_'.time.'_'.$perlvar{'lonHostID'}; +$dumpcount=0; &logtouch(); &logthis('INFO: Read configuration');