version 1.351, 2003/03/25 19:18:40
|
version 1.352, 2003/03/25 22:03:23
|
Line 75 use vars
|
Line 75 use vars
|
qw(%perlvar %hostname %homecache %badServerCache %hostip %iphost %spareid %hostdom |
qw(%perlvar %hostname %homecache %badServerCache %hostip %iphost %spareid %hostdom |
%libserv %pr %prp %metacache %packagetab %titlecache |
%libserv %pr %prp %metacache %packagetab %titlecache |
%courselogs %accesshash %userrolehash $processmarker $dumpcount |
%courselogs %accesshash %userrolehash $processmarker $dumpcount |
%coursedombuf %coursehombuf %courseresdatacache |
%coursedombuf %coursenumbuf %coursehombuf %coursedescrbuf %courseresdatacache |
%domaindescription %domain_auth_def %domain_auth_arg_def $tmpdir); |
%domaindescription %domain_auth_def %domain_auth_arg_def $tmpdir); |
use IO::Socket; |
use IO::Socket; |
use GDBM_File; |
use GDBM_File; |
Line 1027 sub log {
|
Line 1027 sub log {
|
} |
} |
|
|
# ------------------------------------------------------------------ Course Log |
# ------------------------------------------------------------------ Course Log |
|
# |
|
# This routine flushes several buffers of non-mission-critical nature |
|
# |
|
|
sub flushcourselogs { |
sub flushcourselogs { |
&logthis('Flushing course log buffers'); |
&logthis('Flushing log buffers'); |
|
# |
|
# course logs |
|
# This is a log of all transactions in a course, which can be used |
|
# for data mining purposes |
|
# |
|
# It also collects the courseid database, which lists last transaction |
|
# times and course titles for all courseids |
|
# |
|
my %courseidbuffer=(); |
foreach (keys %courselogs) { |
foreach (keys %courselogs) { |
my $crsid=$_; |
my $crsid=$_; |
if (&reply('log:'.$coursedombuf{$crsid}.':'. |
if (&reply('log:'.$coursedombuf{$crsid}.':'.$coursenumbuf{$crsid}.':'. |
&escape($courselogs{$crsid}), |
&escape($courselogs{$crsid}), |
$coursehombuf{$crsid}) eq 'ok') { |
$coursehombuf{$crsid}) eq 'ok') { |
delete $courselogs{$crsid}; |
delete $courselogs{$crsid}; |
Line 1043 sub flushcourselogs {
|
Line 1055 sub flushcourselogs {
|
" exceeded maximum size, deleting.</font>"); |
" exceeded maximum size, deleting.</font>"); |
delete $courselogs{$crsid}; |
delete $courselogs{$crsid}; |
} |
} |
} |
} |
|
if ($courseidbuffer{$coursehombuf{$crsid}}) { |
|
$courseidbuffer{$coursehombuf{$crsid}}.='&'. |
|
&escape($crsid).'='.&escape($coursedescrbuf{$crsid}); |
|
} else { |
|
$courseidbuffer{$coursehombuf{$crsid}}= |
|
&escape($crsid).'='.&escape($coursedescrbuf{$crsid}); |
|
} |
} |
} |
&logthis('Flushing access logs'); |
# |
|
# Write course id database (reverse lookup) to homeserver of courses |
|
# Is used in pickcourse |
|
# |
|
foreach (keys %courseidbuffer) { |
|
&reply('courseidput:'.$hostdom{$_}.':'.$courseidbuffer{$_},$_); |
|
} |
|
# |
|
# File accesses |
|
# Writes to the dynamic metadata of resources to get hit counts, etc. |
|
# |
foreach (keys %accesshash) { |
foreach (keys %accesshash) { |
my $entry=$_; |
my $entry=$_; |
$entry=~/\_\_\_(\w+)\/(\w+)\/(.*)\_\_\_(\w+)$/; |
$entry=~/\_\_\_(\w+)\/(\w+)\/(.*)\_\_\_(\w+)$/; |
Line 1054 sub flushcourselogs {
|
Line 1083 sub flushcourselogs {
|
delete $accesshash{$entry}; |
delete $accesshash{$entry}; |
} |
} |
} |
} |
&logthis('Flushing role logs'); |
# |
|
# Roles |
|
# Reverse lookup of user roles for course faculty/staff and co-authorship |
|
# |
foreach (keys %userrolehash) { |
foreach (keys %userrolehash) { |
my $entry=$_; |
my $entry=$_; |
my ($role,$uname,$udom,$runame,$rudom,$rsec)= |
my ($role,$uname,$udom,$runame,$rudom,$rsec)= |
Line 1073 sub courselog {
|
Line 1105 sub courselog {
|
$what=time.':'.$what; |
$what=time.':'.$what; |
unless ($ENV{'request.course.id'}) { return ''; } |
unless ($ENV{'request.course.id'}) { return ''; } |
$coursedombuf{$ENV{'request.course.id'}}= |
$coursedombuf{$ENV{'request.course.id'}}= |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}.':'. |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}; |
|
$coursenumbuf{$ENV{'request.course.id'}}= |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}; |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}; |
$coursehombuf{$ENV{'request.course.id'}}= |
$coursehombuf{$ENV{'request.course.id'}}= |
$ENV{'course.'.$ENV{'request.course.id'}.'.home'}; |
$ENV{'course.'.$ENV{'request.course.id'}.'.home'}; |
|
$coursedescrbuf{$ENV{'request.course.id'}}= |
|
$ENV{'course.'.$ENV{'request.course.id'}.'.description'}; |
if (defined $courselogs{$ENV{'request.course.id'}}) { |
if (defined $courselogs{$ENV{'request.course.id'}}) { |
$courselogs{$ENV{'request.course.id'}}.='&'.$what; |
$courselogs{$ENV{'request.course.id'}}.='&'.$what; |
} else { |
} else { |