[LON-CAPA-cvs] cvs: loncom /debugging_tools rebuild_db_from_hist.pl

matthew lon-capa-cvs@mail.lon-capa.org
Thu, 09 Dec 2004 20:01:48 -0000


matthew		Thu Dec  9 15:01:48 2004 EDT

  Modified files:              
    /loncom/debugging_tools	rebuild_db_from_hist.pl 
  Log:
  roles.hist has a different format, so detect when we are given a filename
  of roles.hist and take care of the special case.
  
  
Index: loncom/debugging_tools/rebuild_db_from_hist.pl
diff -u loncom/debugging_tools/rebuild_db_from_hist.pl:1.2 loncom/debugging_tools/rebuild_db_from_hist.pl:1.3
--- loncom/debugging_tools/rebuild_db_from_hist.pl:1.2	Wed Dec  8 17:34:30 2004
+++ loncom/debugging_tools/rebuild_db_from_hist.pl	Thu Dec  9 15:01:48 2004
@@ -4,7 +4,7 @@
 #
 # rebuild_db_from_hist.pl Rebuild a *.db file from a *.hist file
 #
-# $Id: rebuild_db_from_hist.pl,v 1.2 2004/12/08 22:34:30 matthew Exp $
+# $Id: rebuild_db_from_hist.pl,v 1.3 2004/12/09 20:01:48 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -69,7 +69,7 @@
         print STDERR "Aborting: The target file $db_filename exists.".$/;
         next;
     }
-    my ($error,$constructed_hash) = &process_file($fname,$db_filename);
+    my ($error,$constructed_hash) = &process_file($fname,$db_filename,$debug);
     if (! defined($error) || ! $test) {
         $error = &write_hash($db_filename,$constructed_hash);
     }
@@ -104,6 +104,9 @@
         #  P:put
         #  D:delete
         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);
         foreach my $k_v_pair (@data) {
             my ($key,$value) = split('=',$k_v_pair,2);