Changeset 26964
- Timestamp:
- 2013-02-26T11:45:53+13:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gs2-extensions/parallel-building/trunk/src/perllib/plugouts/BasePlugout.pm
r25120 r26964 508 508 # only if opening new file 509 509 my $output_dir = $self->get_output_dir(); 510 &util::mk_all_dir ($output_dir) unless -e $output_dir;510 &util::mk_all_dir ($output_dir) unless &util::dir_exists($output_dir); 511 511 my $doc_file = &util::filename_cat ($output_dir, $doc_dir, "doc.xml"); 512 512 my $short_doc_file = &util::filename_cat ($doc_dir, "doc.xml"); … … 614 614 do { 615 615 $doc_dir .= "/" if $doc_dir_num > 0; 616 # if ($doc_dir_rest =~ s/^( .{1,8})//) {617 if ($doc_dir_rest =~ s/^(.{1, 4})//) {616 # if ($doc_dir_rest =~ s/^((HASH)?.{1,3})//i) { 617 if ($doc_dir_rest =~ s/^(.{1,3})//) { 618 618 $doc_dir .= $1; 619 619 $doc_dir_num++; 620 620 } 621 } while ($doc_dir_rest ne "" && 622 ((-d &util::filename_cat ($working_dir, "$doc_dir.dir")) || 623 ($working_info->size() >= 1024 && $doc_dir_num < 2))); 621 } while ($doc_dir_rest ne "" && ((&util::dir_exists(&util::filename_cat($working_dir, "$doc_dir.dir"))) || ($working_info->size() >= 1024 && $doc_dir_num < 2))); 624 622 my $i = 1; 625 623 my $doc_dir_base = $doc_dir; 626 while (-d &util::filename_cat ($working_dir, "$doc_dir.dir")) { 624 #rint "!! - ensure path is unique by adding numeric suffix if necessary\n"; 625 while (&util::dir_exists(&util::filename_cat($working_dir, "$doc_dir.dir"))) { 627 626 $doc_dir = "$doc_dir_base-$i"; 628 627 $i++; 629 628 } 630 629 631 630 return "$doc_dir.dir"; 632 631 } … … 641 640 return if (!defined $output_dir); 642 641 643 &util::mk_all_dir ($output_dir) unless -e $output_dir;642 &util::mk_all_dir ($output_dir) unless &util::dir_exists($output_dir); 644 643 645 644 my $working_dir = &util::filename_cat($output_dir, $doc_dir); 646 &util::mk_all_dir ($working_dir) unless -e $working_dir;645 &util::mk_all_dir ($working_dir) unless &util::dir_exists($working_dir); 647 646 648 647 my @assoc_files = (); … … 685 684 $real_filename = &util::downgrade_if_dos_filename($real_filename); 686 685 687 if ( -e $real_filename) {686 if (&util::file_exists($real_filename)) { 688 687 689 688 $filename = &util::filename_cat($working_dir, $afile); … … 732 731 my $raw_filename = &util::downgrade_if_dos_filename($real_filename); 733 732 734 if ( -e $raw_filename) {733 if (&util::file_exists($raw_filename)) { 735 734 736 735 # if (defined $collect_dir) { 737 736 # my $collect_dir_re_safe = $collect_dir; 738 # $collect_dir_re_safe =~ s/\\/\\\\/g; 737 # $collect_dir_re_safe =~ s/\\/\\\\/g; # use &util::filename_to_regex() 739 738 # $collect_dir_re_safe =~ s/\./\\./g;## 740 739 … … 805 804 806 805 ##print STDERR "*** To set in db: \n\t$doc_db\n\t$oid\n\t$doc_db_text\n"; 806 if (($oid_files->{'index-status'} eq "I") || ($oid_files->{'index-status'} eq "R")) 807 { 808 my $top_section = $doc_obj->get_top_section(); 809 my $dc_titles = $doc_obj->get_metadata($top_section, 'dls.Title'); 810 my $dc_title = join("; ", @$dc_titles); 811 # if we still don't have a title, use a feature I added into a doc_obj ages 812 # ago to find *any* title (regardless of namespace) [jmt12] 813 if ($dc_title eq '') 814 { 815 $dc_title = $doc_obj->get_metadata_element($top_section, 'Title', 1); 816 } 817 if ($oid_files->{'index-status'} eq "R") 818 { 819 $dc_title .= " (Updated)"; 820 } 821 my $rss_filename = &util::filename_cat($output_dir,"rss-items.rdf"); 822 if (open(RSSOUT, &util::file_openfdcommand($rss_filename, '>>'))) 823 { 824 print RSSOUT "<item>\n"; 825 print RSSOUT " <title>" . $dc_title . "</title>\n"; 826 print RSSOUT " <link>_httpdomain__httpcollection_/document/" . $doc_obj->get_OID() . "</link>\n"; 827 print RSSOUT "</item>\n"; 828 close(RSSOUT); 829 } 830 else 831 { 832 print STDERR "**** Failed to open " . $rss_filename . "\n"; 833 print STDERR $! . "\n"; 834 } 835 } 807 836 808 837 $oid_files->{'doc-file'} = [ $oid_files->{'doc-file'} ]; … … 828 857 } 829 858 859 # /** @function append_to_rss_file() 860 # */ 861 sub append_to_rss_file 862 { 863 my $self = shift(@_); 864 my ($doc_obj, $index_status, $output_dir) = @_; 865 866 } 867 # /** append_to_rss_file() **/ 830 868 831 869 sub set_sortmeta { … … 849 887 my ($output_file_name, $xslt_file)=@_; 850 888 851 return unless defined $xslt_file and $xslt_file ne "" and -e $xslt_file;889 return unless defined $xslt_file and $xslt_file ne "" and &util::file_exists($xslt_file); 852 890 853 891 my $java_class_path = &util::filename_cat ($ENV{'GSDLHOME'},"bin","java","ApplyXSLT.jar"); … … 923 961 $doc_file .= ".gz"; 924 962 $short_doc_file .= ".gz"; 925 if (! -e $doc_file) {963 if (!&util::file_exists($doc_file)) { 926 964 my $outhandle = $self->{'output_handle'}; 927 965 print $outhandle "error while gzipping: $doc_file doesn't exist\n";
Note:
See TracChangeset
for help on using the changeset viewer.