Changeset 23363 for main/trunk/greenstone2/perllib/plugins/BasePlugin.pm
- Timestamp:
- 2010-12-01T11:42:27+13:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/plugins/BasePlugin.pm
r23352 r23363 414 414 my ($filename_full_path, $block_hash) = @_; 415 415 416 $filename_full_path = &util::upgrade_if_dos_filename($filename_full_path); 417 416 418 if ($self->{'block_exp'} ne "" && $filename_full_path =~ /$self->{'block_exp'}/) { 417 419 $block_hash->{'file_blocks'}->{$filename_full_path} = 1; … … 426 428 my ($filename, $block_hash) = @_; 427 429 430 $filename = &util::upgrade_if_dos_filename($filename); 431 428 432 if ($self->{'cover_image'}) { 429 433 my $coverfile = $filename; 430 434 $coverfile =~ s/\.[^\\\/\.]+$/\.jpg/; 431 if (! -e $coverfile) {435 if (!&util::fd_exists($coverfile)) { 432 436 $coverfile =~ s/jpg$/JPG/; 433 437 } 434 if ( -e $coverfile) {438 if (&util::fd_exists($coverfile)) { 435 439 $block_hash->{'file_blocks'}->{$coverfile} = 1; 436 440 } … … 915 919 # UTF-8 version of filename 916 920 if ((defined $ENV{"DEBUG_UNICODE"}) && ($ENV{"DEBUG_UNICODE"})) { 917 print STDERR "**** **Setting Source Metadata given: $octet_file\n";921 print STDERR "**** Setting Source Metadata given: $octet_file\n"; 918 922 } 919 923 … … 950 954 951 955 if ((defined $ENV{"DEBUG_UNICODE"}) && ($ENV{"DEBUG_UNICODE"})) { 952 print STDERR "***** saving Source as: $url_encoded_filename\n";956 print STDERR "****** saving Source as: $url_encoded_filename\n"; 953 957 } 954 958 … … 966 970 967 971 if ((defined $ENV{"DEBUG_UNICODE"}) && ($ENV{"DEBUG_UNICODE"})) { 968 print STDERR "***** saving SourceFile as: $renamed_raw_url\n";972 print STDERR "****** saving SourceFile as: $renamed_raw_url\n"; 969 973 } 970 974 } … … 1014 1018 # should we move this to read? What about secondary plugins? 1015 1019 print STDERR "<Processing n='$file' p='$self->{'plugin_type'}'>\n" if ($gli); 1016 print $outhandle "$self->{'plugin_type'} processing $file\n" 1020 my $pp_file = &util::prettyprint_file($base_dir,$file); 1021 print $outhandle "$self->{'plugin_type'} processing $pp_file\n" 1017 1022 if $self->{'verbosity'} > 1; 1018 1023 … … 1296 1301 my $zip_filename = $metadata->{$field}; 1297 1302 # overwrite the source_path 1298 $doc_obj-> {'source_path'} = $zip_filename;1303 $doc_obj->set_source_path($zip_filename); 1299 1304 # and set the metadata 1300 1305 $zip_filename = &util::filename_within_collection($zip_filename); … … 1337 1342 my ($doc_obj, $filename) = @_; 1338 1343 1344 my $upgraded_filename = &util::upgrade_if_dos_filename($filename); 1345 1339 1346 $filename =~ s/\.[^\\\/\.]+$/\.jpg/; 1340 if (exists $self->{'covers_missing_cache'}->{$filename}) { 1341 # don't stat() for existence eg for multiple document input files 1347 $upgraded_filename =~ s/\.[^\\\/\.]+$/\.jpg/; 1348 1349 if (exists $self->{'covers_missing_cache'}->{$upgraded_filename}) { 1350 # don't stat() for existence e.g. for multiple document input files 1342 1351 # (eg SplitPlug) 1343 1352 return; … … 1346 1355 my $top_section=$doc_obj->get_top_section(); 1347 1356 1348 if ( -e $filename) {1357 if (&util::fd_exists($upgraded_filename)) { 1349 1358 $doc_obj->associate_source_file($filename); 1350 1359 $doc_obj->associate_file($filename, "cover.jpg", "image/jpeg"); … … 1352 1361 } else { 1353 1362 my $upper_filename = $filename; 1363 my $upgraded_upper_filename = $upgraded_filename; 1364 1354 1365 $upper_filename =~ s/jpg$/JPG/; 1355 if (-e $upper_filename) { 1366 $upgraded_upper_filename =~ s/jpg$/JPG/; 1367 1368 if (&util::fd_exists($upgraded_upper_filename)) { 1356 1369 $doc_obj->associate_source_file($upper_filename); 1357 1370 $doc_obj->associate_file($upper_filename, "cover.jpg", … … 1361 1374 # file doesn't exist, so record the fact that it's missing so 1362 1375 # we don't stat() again (stat is slow) 1363 $self->{'covers_missing_cache'}->{$ filename} = 1;1376 $self->{'covers_missing_cache'}->{$upgraded_filename} = 1; 1364 1377 } 1365 1378 }
Note:
See TracChangeset
for help on using the changeset viewer.