Diff for /loncom/metadata_database/parse_activity_log.pl between versions 1.19 and 1.23

version 1.19, 2005/09/20 17:49:51 version 1.23, 2006/03/30 06:57:50
Line 48 Line 48
 # parameter is not set $logthis is set to &nothing, which does what you  # parameter is not set $logthis is set to &nothing, which does what you
 # would expect.  # would expect.
 #  #
   BEGIN {
       eval "use Apache2::compat();";
   };
 use strict;  use strict;
 use DBI;  use DBI;
 use lib '/home/httpd/lib/perl/Apache';  use lib '/home/httpd/lib/perl/Apache';
Line 184  if (! defined($xmlfile)) { Line 186  if (! defined($xmlfile)) {
     if (!flock(LOCKFILE,LOCK_EX|LOCK_NB)) {      if (!flock(LOCKFILE,LOCK_EX|LOCK_NB)) {
         warn("Unable to lock $lockfilename.  Aborting".$/);          warn("Unable to lock $lockfilename.  Aborting".$/);
         # don't call clean_up_and_exit another instance is running and          # don't call clean_up_and_exit another instance is running and
         # we don't want to 'cleanup' there files          # we don't want to 'cleanup' their files
         exit 6;          exit 6;
     }      }
   
Line 492  sub process_courselog { Line 494  sub process_courselog {
             if (length($chunk) > 20000) {              if (length($chunk) > 20000) {
                 # avoid putting too much data into the database                  # avoid putting too much data into the database
                 # (usually an uploaded file or something similar)                  # (usually an uploaded file or something similar)
                 $chunk = &escape($chunk);                  if (! &savechunk(\$chunk,$timestamp,$host)) {
                 if (! open(CHUNKFILE,">>$chunk_filename") ||  
                     ! print CHUNKFILE $timestamp.':'.$host.':'.$chunk.$/) {  
                     # abort  
                     close(CHUNKFILE);  
                     close(IN);                      close(IN);
                     return undef;                      return undef;
                 }                  }
                 close(CHUNKFILE);  
                 next;                  next;
             }              }
             my $warningflag = '';              my $warningflag = '';
Line 519  sub process_courselog { Line 516  sub process_courselog {
             if ($action !~ /^(LOGIN|VIEW|POST|CSTORE|STORE)$/) {              if ($action !~ /^(LOGIN|VIEW|POST|CSTORE|STORE)$/) {
                 $warningflag .= 'action';                  $warningflag .= 'action';
                 print $error_fh 'full log entry:'.$log.$/;                  print $error_fh 'full log entry:'.$log.$/;
                 print $error_fh 'error on chunk:'.$chunk.$/;                  print $error_fh 'error on chunk (saving)'.$/;
                 $logthis->('(action) Unable to parse '.$/.$chunk.$/.                  if (! &savechunk(\$chunk,$timestamp,$host)) {
                       close(IN);
                       return undef;
                   }
                   $logthis->('(action) Unable to parse chunk'.$/.
                          'got '.                           'got '.
                          'time = '.$time.$/.                           'time = '.$time.$/.
                          'res  = '.$res.$/.                           'res  = '.$res.$/.
Line 557  sub process_courselog { Line 558  sub process_courselog {
     }      }
     close IN;      close IN;
     return $linecount;      return $linecount;
       ##
       ##
       sub savechunk {
           my ($chunkref,$timestamp,$host) = @_;
           my $chunk = &escape(${$chunkref});
           if (! open(CHUNKFILE,">>$chunk_filename") ||
               ! print CHUNKFILE $timestamp.':'.$host.':'.$chunk.$/) {
               # abort
               close(CHUNKFILE);
               return 0;
           }
           close(CHUNKFILE);
           return 1;
       }
 }  }
   
   
Line 930  sub xml_store_id_table { Line 945  sub xml_store_id_table {
 #######################################################################  #######################################################################
 {  {
     my @rows;      my @rows;
     my $max_row_count = 100;  
   
 sub store_entry {  sub store_entry {
       my $max_row_count = 100;
     if (! @_) {      if (! @_) {
         undef(@rows);          undef(@rows);
         return '';          return '';

Removed from v.1.19  
changed lines
  Added in v.1.23


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>