Diff for /loncom/debugging_tools/rebuild_db_from_hist.pl between versions 1.1 and 1.3

version 1.1, 2004/12/08 22:06:48 version 1.3, 2004/12/09 20:01:48
Line 50  if ($help) { Line 50  if ($help) {
 rebuild_db_from_hist.pl - recreate a db file from a hist file.  rebuild_db_from_hist.pl - recreate a db file from a hist file.
 Options:  Options:
    -help     Display this help.     -help     Display this help.
    -debug    Output debugging code     -debug    Output debugging code (not much is output yet)
    -sort     Sort the entries by time     -test     Verify the given *.hist file will reconstruct the current db file
    -test     Do not write the data but verify it was created properly               Sends error messages to STDERR.
 Examples:   Examples: 
     rebuild_db_from_hist.pl $file.hist       rebuild_db_from_hist.pl -t $file.hist  # Perform a test rebuild
       rebuild_db_from_hist.pl $file.hist       
 END  END
     exit;      exit;
 }  }
Line 68  while (my $fname = shift) { Line 69  while (my $fname = shift) {
         print STDERR "Aborting: The target file $db_filename exists.".$/;          print STDERR "Aborting: The target file $db_filename exists.".$/;
         next;          next;
     }      }
     my ($error,$constructed_hash) = &process_file($fname,$db_filename);      my ($error,$constructed_hash) = &process_file($fname,$db_filename,$debug);
     if (! defined($error) || ! $test) {      if (! defined($error) || ! $test) {
         $error = &write_hash($db_filename,$constructed_hash);          $error = &write_hash($db_filename,$constructed_hash);
     }      }
Line 103  sub process_file { Line 104  sub process_file {
         #  P:put          #  P:put
         #  D:delete          #  D:delete
         my ($action,$time,$concatenated_data) = split(':',$command,3);          my ($action,$time,$concatenated_data) = split(':',$command,3);
           if ($fname eq 'roles.hist' && $concatenated_data =~ /^.*:.*:/) {
               (undef,undef,$concatenated_data) = split(':',$concatenated_data,3);
           }
         my @data = split('&',$concatenated_data);          my @data = split('&',$concatenated_data);
         foreach my $k_v_pair (@data) {          foreach my $k_v_pair (@data) {
             my ($key,$value) = split('=',$k_v_pair,2);              my ($key,$value) = split('=',$k_v_pair,2);

Removed from v.1.1  
changed lines
  Added in v.1.3


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