--- loncom/debugging_tools/db_copy.pl 2006/08/24 22:46:30 1.1 +++ loncom/debugging_tools/db_copy.pl 2006/09/20 19:23:24 1.2 @@ -11,7 +11,8 @@ use LONCAPA::Configuration; use Cwd; my $dump_db = './dump_db'; -my $dir = './test'; +my $create_db = './create_db'; +my $dir = './annarbor'; my %perlvar=%{&LONCAPA::Configuration::read_conf('loncapa.conf')}; @@ -47,23 +48,11 @@ sub process_db { return if ($_!~m/\.db$/); my $file = $_; my $dbref =&lock_db($file); - print("attempting $dbref\n"); + print("attempting $file\n"); my %newdb; my $new_file = $file.'.new'; - if (!tie(%newdb,'GDBM_File',$new_file,&GDBM_WRCREAT(),0640)) { - die("unable to create new db $new_file $! $@"); - } - open(my $fh,"$dump_db -f $file|"); - while (my $entry = <$fh>) { - chomp($entry); - if ($entry =~/^ERROR:/) { - die($entry); - } - my ($key,$value) = split(' -> ',$entry,2); - $newdb{&unescape($key)} = &unescape($value); - } - print("finishing $dbref\n"); - untie(%newdb); + system("$dump_db -f $file|$create_db -f $new_file"); +# print("finishing $dbref\n"); untie($dbref); system("/bin/mv $file $file.old"); system("/bin/mv $file.new $file");