Changeset 23485 for main/trunk/greenstone2
- Timestamp:
- 2010-12-14T16:16:48+13:00 (13 years ago)
- Location:
- main/trunk/greenstone2/perllib
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/ClassifyTreeModel.pm
r22749 r23485 157 157 my $index_text_directory_path = &util::filename_cat($ENV{'GSDLHOME'}, "collect", $self->getCollection(), "index", "text"); 158 158 my $infodb_file_path = &dbutil::get_infodb_file_path($self->{'infodbtype'}, $self->getCollection(), $index_text_directory_path); 159 if (&dbutil::read_infodb_ entry($self->{'infodbtype'}, $infodb_file_path, $clid) =~ /\w+/)159 if (&dbutil::read_infodb_rawentry($self->{'infodbtype'}, $infodb_file_path, $clid) =~ /\w+/) 160 160 { 161 161 # Since the CLID can directly reference the correct entry in the info database we -
main/trunk/greenstone2/perllib/ClassifyTreeNode.pm
r22749 r23485 62 62 # Check if this node already exists in the database, and if not insert it 63 63 # now 64 my $text = &dbutil::read_infodb_ entry($self->{'infodbtype'}, $self->{'infodb_file_path'}, $clid);64 my $text = &dbutil::read_infodb_rawentry($self->{'infodbtype'}, $self->{'infodb_file_path'}, $clid); 65 65 if($text !~ /\w+/ && $force_new) 66 66 { … … 268 268 269 269 # Now determine if this node exists. 270 if (&dbutil::read_infodb_ entry($self->{'infodbtype'}, $self->{'infodb_file_path'}, $next_clid) =~ /\w+/)270 if (&dbutil::read_infodb_rawentry($self->{'infodbtype'}, $self->{'infodb_file_path'}, $next_clid) =~ /\w+/) 271 271 { 272 272 # And if so, create it. … … 658 658 659 659 # Load the text of this node 660 my $text = &dbutil::read_infodb_ entry($self->{'infodbtype'}, $self->{'infodb_file_path'}, $clid);660 my $text = &dbutil::read_infodb_rawentry($self->{'infodbtype'}, $self->{'infodb_file_path'}, $clid); 661 661 662 662 # Replace the contains … … 686 686 687 687 # Load the text of this node 688 my $text = &dbutil::read_infodb_ entry($self->{'infodbtype'}, $self->{'infodb_file_path'}, $clid);688 my $text = &dbutil::read_infodb_rawentry($self->{'infodbtype'}, $self->{'infodb_file_path'}, $clid); 689 689 # Replace the numleafdocs 690 690 $text =~ s/<numleafdocs>\d*?\n+/<numleafdocs>$numleafdocs\n/; … … 713 713 714 714 # Load the text of this node 715 my $text = &dbutil::read_infodb_ entry($self->{'infodbtype'}, $self->{'infodb_file_path'}, $clid);715 my $text = &dbutil::read_infodb_rawentry($self->{'infodbtype'}, $self->{'infodb_file_path'}, $clid); 716 716 # Replace the title 717 717 $text =~ s/<Title>.*?\n+/<Title>$title\n/; … … 736 736 my $clid = $self->{'clid'}; 737 737 738 my $text = &dbutil::read_infodb_ entry($self->{'infodbtype'}, $self->{'infodb_file_path'}, $clid);738 my $text = &dbutil::read_infodb_rawentry($self->{'infodbtype'}, $self->{'infodb_file_path'}, $clid); 739 739 return $text; 740 740 } -
main/trunk/greenstone2/perllib/IncrementalDocument.pm
r21645 r23485 154 154 my $index_text_directory_path = &util::filename_cat($ENV{'GSDLHOME'}, "collect", $collection, "index", "text"); 155 155 my $infodb_file_path = &dbutil::get_infodb_file_path($self->{'infodbtype'}, $collection, $index_text_directory_path); 156 my $text = &dbutil::read_infodb_ entry($self->{'infodbtype'}, $infodb_file_path, $self->{'oid'});156 my $text = &dbutil::read_infodb_rawentry($self->{'infodbtype'}, $infodb_file_path, $self->{'oid'}); 157 157 # For each line in the raw text, extract the key (enclosed in angle 158 158 # brackets) and the value … … 203 203 if($doc_num >= 0) 204 204 { 205 my $text = &dbutil::read_infodb_ entry($self->{'infodbtype'}, $infodb_file_path, $doc_num);205 my $text = &dbutil::read_infodb_rawentry($self->{'infodbtype'}, $infodb_file_path, $doc_num); 206 206 207 207 # If there is no reverse lookup, then add one now -
main/trunk/greenstone2/perllib/dbutil.pm
r23448 r23485 214 214 } 215 215 } 216 217 sub read_infodb_rawentry 218 { 219 my $infodb_type = shift(@_); 220 my $infodb_file_path = shift(@_); 221 my $infodb_key = shift(@_); 222 223 224 # !! TEMPORARY: Slow and naive implementation that just reads the entire file and picks out the one value 225 # !! This will soon be replaced with database-specific versions that will use dbget etc. 226 my $infodb_map = {}; 227 &read_infodb_file($infodb_type, $infodb_file_path, $infodb_map); 228 229 return $infodb_map->{$infodb_key}; 230 } 231 216 232 217 233 sub read_infodb_entry … … 248 264 249 265 250 251 # !! TEMPORARY: Slow and naive implementation that just reads the entire file and picks out the one value 252 # !! This will soon be replaced with database-specific versions that will use dbget etc. 253 my $infodb_map = {}; 254 &read_infodb_file($infodb_type, $infodb_file_path, $infodb_map); 255 256 my $infodb_rec = &dbutil::convert_infodb_string_to_hash($infodb_map->{$infodb_key}); 266 # rawentry above is currently naive implementation 267 my $raw_string = read_infodb_rawentry($infodb_type, $infodb_file_path, $infodb_key); 268 my $infodb_rec = &dbutil::convert_infodb_string_to_hash($raw_string); 257 269 258 270 return $infodb_rec; -
main/trunk/greenstone2/perllib/doc.pm
r23413 r23485 283 283 } 284 284 } 285 286 if (!&util::filename_is_absolute($filename)) { 287 $filename = &util::filename_cat($ENV{'GSDLCOLLECTDIR'},$filename); 288 } 289 285 290 return $filename; 286 291 } … … 410 415 411 416 if ($use_hash_oid) { 412 my $hash_on_file = 1;417 my $hash_on_file = 0; 413 418 if ($self->{'OIDtype'} eq "hash_on_ga_xml") { 414 419 $hash_on_file = 0; -
main/trunk/greenstone2/perllib/inexport.pm
r23402 r23485 944 944 # is it modified?? 945 945 if (-M $full_curr_file < $archiveinf_timestamp) { 946 print STDERR "*** Detected a modified metadata file: $full_curr_file\n" if $verbosity >2;946 print STDERR "*** Detected a *modified metadata* file: $full_curr_file\n" if $verbosity >= 2; 947 947 # its newer than last build 948 948 $block_hash->{'new_or_modified_metadata_files'}->{$full_curr_file} = 1; … … 974 974 # Greenstone to always be this) 975 975 976 print STDERR "*** ** Detected new metadata file: $full_curr_file\n" if $verbosity >2;976 print STDERR "*** Detected *new* metadata file: $full_curr_file\n" if $verbosity >= 2; 977 977 $block_hash->{'new_or_modified_metadata_files'}->{$full_curr_file} = 1; 978 978 } … … 1012 1012 1013 1013 if ($existing_f =~ m/^$situated_dir/) { 1014 1015 print STDERR "**** Existing file $existing_f\nis located within\n$situated_dir\n"; 1016 1014 1017 push(@$reindex_files,$existing_f); 1015 1018 $block_hash->{'reindex_files'}->{$existing_f} = 1; … … 1107 1110 # that this file is used in (note in most cases, it's just one OID) 1108 1111 1109 my $src_rec_string = &dbutil::read_infodb_entry($infodbtype, $arcinfo_src_filename, $file); 1110 my $src_rec = &dbutil::convert_infodb_string_to_hash($src_rec_string); 1112 my $src_rec = &dbutil::read_infodb_entry($infodbtype, $arcinfo_src_filename, $file); 1111 1113 my $oids = $src_rec->{'oid'}; 1112 1114 my $file_record_deleted = 0; … … 1121 1123 1122 1124 # find the source doc (the primary file that becomes this oid) 1123 my $doc_rec_string = &dbutil::read_infodb_entry($infodbtype, $arcinfo_doc_filename, $oid); 1124 my $doc_rec = &dbutil::convert_infodb_string_to_hash($doc_rec_string); 1125 my $doc_rec = &dbutil::read_infodb_entry($infodbtype, $arcinfo_doc_filename, $oid); 1125 1126 my $doc_source_file = $doc_rec->{'src-file'}->[0]; 1126 1127 if (!&util::filename_is_absolute($doc_source_file)) { … … 1142 1143 # mark oid for deletion (it will be deleted or reimported) 1143 1144 $archive_info->set_status_info($oid,"D"); 1144 my $val = &dbutil::read_infodb_ entry($infodbtype, $arcinfo_doc_filename, $oid);1145 my $val = &dbutil::read_infodb_rawentry($infodbtype, $arcinfo_doc_filename, $oid); 1145 1146 $val =~ s/^<index-status>(.*)$/<index-status>D/m; 1146 1147 -
main/trunk/greenstone2/perllib/manifest.pm
r22731 r23485 185 185 my $arcinfo_doc_filename = $self->{'_arcinfo-doc-filename'}; 186 186 187 my $doc_rec_string = &dbutil::read_infodb_entry($infodbtype, $arcinfo_doc_filename, $oid); 188 189 my $doc_rec = &dbutil::convert_infodb_string_to_hash($doc_rec_string); 187 my $doc_rec = &dbutil::read_infodb_entry($infodbtype, $arcinfo_doc_filename, $oid); 190 188 191 189 my $doc_source_file = $doc_rec->{'src-file'}->[0]; -
main/trunk/greenstone2/perllib/plugin.pm
r23212 r23485 232 232 # that this file is used in (note in most cases, it's just one OID) 233 233 234 my $src_rec_string = &dbutil::read_infodb_entry($infodbtype, $arcinfo_src_filename, $file); 235 my $src_rec = &dbutil::convert_infodb_string_to_hash($src_rec_string); 234 my $src_rec = &dbutil::read_infodb_entry($infodbtype, $arcinfo_src_filename, $file); 236 235 my $oids = $src_rec->{'oid'}; 237 236 my $rv;
Note:
See TracChangeset
for help on using the changeset viewer.