[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm

matthew lon-capa-cvs@mail.lon-capa.org
Wed, 12 Nov 2003 21:37:33 -0000


matthew		Wed Nov 12 16:37:33 2003 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  Fixes to nohist_accesscount storage.  Now stores with the url as the key,
  not all the extra stuff.
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.449 loncom/lonnet/perl/lonnet.pm:1.450
--- loncom/lonnet/perl/lonnet.pm:1.449	Wed Nov 12 15:32:04 2003
+++ loncom/lonnet/perl/lonnet.pm	Wed Nov 12 16:37:33 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.449 2003/11/12 20:32:04 matthew Exp $
+# $Id: lonnet.pm,v 1.450 2003/11/12 21:37:33 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1336,19 +1336,22 @@
 #
     foreach my $entry (keys(%accesshash)) {
         my ($dom,$name,undef,$type)=($entry=~m:___(\w+)/(\w+)/(.*)___(\w+)$:);
-        my %temphash=($entry => $accesshash{$entry});
         if ($type eq 'count'){
+            my $value = $accesshash{$entry};
+            my (undef,$url,undef) = ($entry =~ /^(.*)___(.*)___count$/);
+            my %temphash=($url => $value);
             my $result = &inc('nohist_accesscount',\%temphash,$dom,$name);
             if ($result eq 'ok') {
                 delete $accesshash{$entry};
             } elsif ($result eq 'unknown_cmd') {
                 # Target server has old code running on it.
+                my %temphash=($entry => $value);
                 if (&put('nohist_resevaldata',\%temphash,$dom,$name) eq 'ok') {
                     delete $accesshash{$entry};
                 }
             }
- &logthis('incrementing '.$entry.' by '.$accesshash{$entry}.' result is '.$result);
         } else {
+            my %temphash=($entry => $accesshash{$entry});
             if (&put('nohist_resevaldata',\%temphash,$dom,$name) eq 'ok') {
                 delete $accesshash{$entry};
             }
@@ -1388,7 +1391,8 @@
     } else {
 	$courselogs{$ENV{'request.course.id'}}.=$what;
     }
-    if (length($courselogs{$ENV{'request.course.id'}})>4048) {
+#    if (length($courselogs{$ENV{'request.course.id'}})>4048) {
+    if (length($courselogs{$ENV{'request.course.id'}})>48) {
 	&flushcourselogs();
     }
 }
@@ -1413,11 +1417,7 @@
     unless ($ENV{'request.course.id'}) { return ''; }
     $accesshash{$ENV{'request.course.id'}.'___'.$url.'___course'}=1;
     my $key=$$.$processmarker.'_'.$dumpcount.'___'.$url.'___count';
-    if (defined($accesshash{$key})) {
-	$accesshash{$key}++;
-    } else {
-        $accesshash{$key}=1;
-    }
+    $accesshash{$key}++;
 }
 
 sub linklog {