Diff for /loncom/metadata_database/parse_activity_log.pl between versions 1.8 and 1.11

version 1.8, 2004/12/20 19:53:36 version 1.11, 2004/12/22 20:42:39
Line 34 Line 34
 #   2     Activity log does not exist  #   2     Activity log does not exist
 #   3     Unable to connect to database  #   3     Unable to connect to database
 #   4     Unable to create database tables  #   4     Unable to create database tables
 #   5     Unspecified error?  #   5     Unable to open log file
   #   6     Unable to get lock on activity log
 #  #
   
 #  #
Line 50 Line 51
   
 use strict;  use strict;
 use DBI;  use DBI;
   use lib '/home/httpd/lib/perl/Apache';
 use lib '/home/httpd/lib/perl/';  use lib '/home/httpd/lib/perl/';
 use LONCAPA::Configuration();  use LONCAPA::Configuration();
 use Apache::lonmysql();  use Apache::lonmysql();
Line 120  if ($log) { Line 122  if ($log) {
     my $logfile = $perlvar{'lonDaemons'}.'/tmp/parse_activity_log.log.'.time;      my $logfile = $perlvar{'lonDaemons'}.'/tmp/parse_activity_log.log.'.time;
     print STDERR "$0: logging to $logfile".$/;      print STDERR "$0: logging to $logfile".$/;
     if (! open(LOGFILE,">$logfile")) {      if (! open(LOGFILE,">$logfile")) {
         die "Unable to open $logfile for writing.  Run aborted.";          warn("Unable to open $logfile for writing.  Run aborted.");
           exit 5;
     } else {      } else {
         $logthis = \&log_to_file;          $logthis = \&log_to_file;
     }      }
Line 151  $logthis->('Beginning logging '.time); Line 154  $logthis->('Beginning logging '.time);
 # Wait for a lock on the lockfile to avoid collisions  # Wait for a lock on the lockfile to avoid collisions
 my $lockfilename = $sourcefilename.'.lock';  my $lockfilename = $sourcefilename.'.lock';
 open(LOCKFILE,'>'.$lockfilename);  open(LOCKFILE,'>'.$lockfilename);
 flock(LOCKFILE,LOCK_EX) || die("Unable to lock $lockfilename.  Aborting".$/);  if (!flock(LOCKFILE,LOCK_EX)) {
       warn("Unable to lock $lockfilename.  Aborting".$/);
       exit 6;
   }
   
 ##  ##
 ## There will only be a $newfilename file if a copy of this program is already  ## There will only be a $newfilename file if a copy of this program is already
Line 474  sub process_courselog { Line 480  sub process_courselog {
                          'uname= '.$uname.$/.                           'uname= '.$uname.$/.
                          'udom = '.$udom.$/.                           'udom = '.$udom.$/.
                          'action='.$action.$/.                           'action='.$action.$/.
                          '@values = '.join(':',@values));                           '@values = '.join('&',@values));
                 next; #skip it if we cannot understand what is happening.                  next; #skip it if we cannot understand what is happening.
             }              }
             if (! defined($student) || $student eq ':') {              if (! defined($student) || $student eq ':') {
Line 518  sub process_courselog { Line 524  sub process_courselog {
                 next; # skip this chunk                  next; # skip this chunk
             }              }
             #              #
             my $values = $dbh->quote(join('',@values));              my $store_values;
               if ($action eq 'POST') {
                   $store_values = 
                       $dbh->quote(join('&',map { &escape($_); } @values));
               } else {
                   $store_values = $dbh->quote(join('&',@values));
               }
             $time_this->('get_ids');              $time_this->('get_ids');
             #              #
             my $row = [$res_id,              my $row = [$res_id,
Line 528  sub process_courselog { Line 540  sub process_courselog {
 #                       $action_id,  #                       $action_id,
                        qq{''},        # idx                         qq{''},        # idx
                        $machine_id,                         $machine_id,
                        $values];                         $store_values];
             push(@RowData,$row);              push(@RowData,$row);
             $time_this->('push_row');              $time_this->('push_row');
             $prevchunk = $chunk;              $prevchunk = $chunk;

Removed from v.1.8  
changed lines
  Added in v.1.11


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