--- loncom/metadata_database/parse_activity_log.pl 2004/08/25 15:55:17 1.4 +++ loncom/metadata_database/parse_activity_log.pl 2004/09/15 21:11:06 1.5 @@ -2,7 +2,7 @@ # # The LearningOnline Network # -# $Id: parse_activity_log.pl,v 1.4 2004/08/25 15:55:17 matthew Exp $ +# $Id: parse_activity_log.pl,v 1.5 2004/09/15 21:11:06 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -44,12 +44,13 @@ use lonmysql(); use Time::HiRes(); use Getopt::Long(); use IO::File; - +use File::Copy; # # Determine parameters -my ($help,$course,$domain,$drop,$file,$time_run,$nocleanup,$log); +my ($help,$course,$domain,$drop,$file,$time_run,$nocleanup,$log,$backup); &Getopt::Long::GetOptions( "course=s" => \$course, "domain=s" => \$domain, + "backup" => \$backup, "help" => \$help, "logfile=s" => \$file, "timerun" => \$time_run, @@ -64,6 +65,8 @@ Process a lon-capa activity log into a d Parameters: course Required domain Optional + backup optional if present, backup the activity log file + before processing it drop optional if present, drop all course specific activity log tables. file optional Specify the file to parse, including path @@ -140,6 +143,7 @@ if (-e $newfilename) { if (-e $sourcefilename) { $logthis->('renaming '.$sourcefilename.' to '.$newfilename); rename($sourcefilename,$newfilename); + Copy($newfilename,$newfilename.'.'.time) if ($backup); $logthis->("renamed $sourcefilename to $newfilename"); } else { my $command = 'touch '.$newfilename;