- Timestamp:
- 2013-04-18T16:05:33+12:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/cgiactions/metadataaction.pm
r27180 r27222 2769 2769 my $doc_rec = &dbutil::read_infodb_entry($infodbtype, $infodb_file_path, $docid); 2770 2770 2771 # Basically loop through and unescape_html the values2772 foreach my $k (keys %$doc_rec) {2773 my @escaped_v = ();2774 foreach my $v (@{$doc_rec->{$k}}) {2775 if ($k eq "contains") {2776 # protect quotes in ".2;".3 etc2777 $v =~ s/\"/\\\"/g;2778 push(@escaped_v, $v);2779 }2780 else {2781 my $ev = &ghtml::unescape_html($v);2782 $ev =~ s/\"/\\\"/g;2783 push(@escaped_v, $ev);2784 }2785 }2786 $doc_rec->{$k} = \@escaped_v;2787 }2788 2789 2771 # Check to make sure the key does exist 2790 2772 if (!defined ($doc_rec->{$metaname})) { … … 2817 2799 $doc_rec->{$metaname} = $filtered_metadata; 2818 2800 2819 ## The following code assumes gdbm2820 # Turn the record back to string2821 #my $serialized_doc_rec = &dbutil::convert_infodb_hash_to_string($doc_rec);2822 # Store it back to the database2823 #my $cmd = "gdbmset \"$infodb_file_path\" \"$docid\" \"$serialized_doc_rec\"";2824 #my $status = system($cmd);2825 2826 2801 ## Use the dbutil set_entry method instead of assuming the database is gdbm 2827 2802 my $status = &dbutil::set_infodb_entry($infodbtype, $infodb_file_path, $docid, $doc_rec); … … 2831 2806 2832 2807 $mess .= "PATH: $ENV{'PATH'}\n"; 2833 #$mess .= "cmd = $cmd\n";2834 2808 $mess .= "Exit status: $status\n"; 2835 2809 $mess .= "System Error Message: $!\n"; … … 2990 2964 # Read the docid entry 2991 2965 my $doc_rec = &dbutil::read_infodb_entry($infodbtype, $infodb_file_path, $docid); 2992 2993 foreach my $k (keys %$doc_rec) {2994 my @escaped_v = ();2995 foreach my $v (@{$doc_rec->{$k}}) {2996 if ($k eq "contains") {2997 # protect quotes in ".2;".3 etc2998 $v =~ s/\"/\\\"/g;2999 push(@escaped_v, $v);3000 }3001 else {3002 my $ev = &ghtml::unescape_html($v);3003 $ev =~ s/\"/\\\"/g;3004 push(@escaped_v, $ev);3005 }3006 }3007 $doc_rec->{$k} = \@escaped_v;3008 }3009 2966 3010 2967 # Protect the quotes … … 3023 2980 } 3024 2981 3025 ## The following code assumes gdbm3026 # Generate the record string3027 #my $serialized_doc_rec = &dbutil::convert_infodb_hash_to_string($doc_rec);3028 # Store it into GDBM3029 #my $cmd = "gdbmset \"$infodb_file_path\" \"$docid\" \"$serialized_doc_rec\"";3030 #my $status = system($cmd);3031 3032 2982 ## Use the dbutil set_entry method instead of assuming the database is gdbm 3033 2983 my $status = &dbutil::set_infodb_entry($infodbtype, $infodb_file_path, $docid, $doc_rec); … … 3038 2988 3039 2989 $mess .= "PATH: $ENV{'PATH'}\n"; 3040 #$mess .= "cmd = $cmd\n";3041 2990 $mess .= "Exit status: $status\n"; 3042 2991 $mess .= "System Error Message: $!\n";
Note:
See TracChangeset
for help on using the changeset viewer.