version 1.156, 2001/08/23 22:44:51
|
version 1.157, 2001/09/20 16:09:07
|
Line 127
|
Line 127
|
# 5/30 H. K. Ng |
# 5/30 H. K. Ng |
# 6/1 Gerd Kortemeyer |
# 6/1 Gerd Kortemeyer |
# July Guy Albertelli |
# July Guy Albertelli |
# 8/4,8/7,8/8,8/9,8/11,8/16,8/17,8/18,8/20,8/23 Gerd Kortemeyer |
# 8/4,8/7,8/8,8/9,8/11,8/16,8/17,8/18,8/20,8/23,9/20 Gerd Kortemeyer |
|
|
package Apache::lonnet; |
package Apache::lonnet; |
|
|
Line 136 use Apache::File;
|
Line 136 use Apache::File;
|
use LWP::UserAgent(); |
use LWP::UserAgent(); |
use HTTP::Headers; |
use HTTP::Headers; |
use vars |
use vars |
qw(%perlvar %hostname %homecache %hostip %spareid %hostdom %libserv %pr %prp %fe %fd $readit %metacache %packagetab); |
qw(%perlvar %hostname %homecache %hostip %spareid %hostdom %libserv %pr %prp %fe %fd $readit %metacache %packagetab %courselogs); |
use IO::Socket; |
use IO::Socket; |
use GDBM_File; |
use GDBM_File; |
use Apache::Constants qw(:common :http); |
use Apache::Constants qw(:common :http); |
Line 665 sub log {
|
Line 665 sub log {
|
return critical("log:$dom:$nam:$what",$hom); |
return critical("log:$dom:$nam:$what",$hom); |
} |
} |
|
|
|
# ------------------------------------------------------------------ Course Log |
|
|
|
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') { |
|
delete $courselogs{$crsid}; |
|
} else { |
|
&logthis('Failed to flush log buffer for '.$crsid); |
|
if (length($courselogs{$crsid})>40000) { |
|
&logthis("<font color=blue>WARNING: Buffer for ".$crsid. |
|
" exceeded maximum size, deleting.</font>"); |
|
delete $courselogs{$crsid}; |
|
} |
|
} |
|
} keys %courselogs; |
|
} |
|
|
|
sub courselog { |
|
my $what=shift; |
|
unless ($ENV{'request.course.id'}) { return ''; } |
|
if (defined $courselogs{$ENV{'request.course.id'}}) { |
|
$courselogs{$ENV{'request.course.id'}}.='&'.$what; |
|
} else { |
|
$courselogs{$ENV{'request.course.id'}}.=$what; |
|
} |
|
if (length($courselogs{$ENV{'request.course.id'}})>4048) { |
|
&flushcourselogs(); |
|
} |
|
} |
|
|
# ----------------------------------------------------------- Check out an item |
# ----------------------------------------------------------- Check out an item |
|
|
sub checkout { |
sub checkout { |