Changeset 28021 for main/trunk/greenstone2
- Timestamp:
- 2013-08-12T10:47:22+12:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/plugouts/BasePlugout.pm
r27880 r28021 93 93 'type' => "flag", 94 94 'reqd' => "no", 95 'deft' => " false",95 'deft' => "0", 96 96 'hiddengli' => "no"}, 97 97 { 'name' => 'no_rss', … … 158 158 } 159 159 160 $self->{'gs_count'} = 0; 161 162 $self->{'keep_import_structure'} = 0; 160 $self->{'gs_count'} = 0; 161 162 $self->{'keep_import_structure'} = 0; 163 163 164 164 return bless $self, $class; … … 171 171 my $header = shift(@_); 172 172 my $high_level_information_only = shift(@_); 173 173 174 174 # XML output is always in UTF-8 175 175 gsprintf::output_strings_in_UTF8; … … 670 670 # Once a doc object is ready to write to disk (and hence has a nice OID), 671 671 # generate a unique subdirectory to write the information to. 672 # 672 673 # - create the directory as part of this call, to try and avoid race conditions 673 674 # found in parallel processing [jmt12] 675 # 676 # @todo figure out what the rule regarding $work_info->size() is meant to do 677 # 678 # @todo determine what $self->{'group'} is, and whether it should affect 679 # directory creation 674 680 # 675 681 sub get_new_doc_dir … … 704 710 $doc_dir .= '/'; 705 711 } 712 706 713 # the default matching pattern grabs the next 'subdir_split_length' 707 714 # characters of the OID to act as the next subdirectory 708 715 my $pattern = '^(.{1,' . $self->{'subdir_split_length'} . '})'; 716 709 717 # Do we count any "HASH" prefix against the split length limit? 718 print "[DEBUG] SubDir Hash Prefix: |" . $self->{'subdir_hash_prefix'} . "|\n"; 710 719 if ($self->{'subdir_hash_prefix'} && $doc_dir_num == 0) 711 720 { 712 721 $pattern = '^((HASH)?.{1,' . $self->{'subdir_split_length'} . '})'; 713 722 } 723 724 print "[DEBUG] Pattern: |" . $pattern . "|\n"; 725 726 714 727 # Note the use of 's' to both capture the next chuck of OID and to remove 715 728 # it from OID at the same time … … 718 731 $doc_dir .= $1; 719 732 $doc_dir_num++; 720 my $full_doc_dir = &FileUtils::filenameConcatenate($working_dir, $doc_dir . '.dir'); 721 if(!FileUtils::directoryExists($full_doc_dir)) { 722 &FileUtils::makeAllDirectories($full_doc_dir); 723 $created_directory = 1; 724 } 725 } 726 ###my $new_dir = &FileUtils::filenameConcatenate($working_dir, $doc_dir . '.dir'); 727 ###rint STDERR "[DEBUG] BasePlugout::get_new_doc_dir(<working_info>, $working_dir, $oid)\n"; 728 ###rint STDERR " - create directory: $new_dir => $created_directory\n"; 729 ###rint STDERR " - rest: $doc_dir_rest\n"; 730 ###rint STDERR " - working_info->size(): " . $working_info->size() . " [ < 1024 ?]\n"; 731 ###rint STDERR " - doc_dir_num: " . $doc_dir_num . "\n"; 733 734 my $full_doc_dir = &FileUtils::filenameConcatenate($working_dir, $doc_dir . '.dir'); 735 if(!FileUtils::directoryExists($full_doc_dir)) 736 { 737 &FileUtils::makeAllDirectories($full_doc_dir); 738 $created_directory = 1; 739 } 740 741 ###rint STDERR "[DEBUG] BasePlugout::get_new_doc_dir(<working_info>, $working_dir, $oid)\n"; 742 ###rint STDERR " - create directory: $full_doc_dir => $created_directory\n"; 743 ###rint STDERR " - rest: $doc_dir_rest\n"; 744 ###rint STDERR " - working_info->size(): " . $working_info->size() . " [ < 1024 ?]\n"; 745 ###rint STDERR " - doc_dir_num: " . $doc_dir_num . "\n"; 746 } 732 747 } 733 748 while ($doc_dir_rest ne '' && ($created_directory == 0 || ($working_info->size() >= 1024 && $doc_dir_num < 2))); … … 940 955 } 941 956 942 my $rss_filename = &FileUtils::filenameConcatenate($output_dir,"rss-items.rdf"); 943 my $rss_fh; 944 if (&FileUtils::openFileHandle($rss_filename, '>>', \$rss_fh)) { 945 print $rss_fh "<item>\n"; 946 print $rss_fh " <title>$dc_title</title>\n"; 947 print $rss_fh " <link>_httpdomain__httpcollection_/document/$oid</link>\n"; 948 print $rss_fh "</item>\n"; 957 my $rss_entry = "<item>\n"; 958 $rss_entry .= " <title>$dc_title</title>\n"; 959 $rss_entry .= " <link>_httpdomain__httpcollection_/document/$oid</link>\n"; 960 $rss_entry .= "</item>"; 961 962 if (defined(&dbutil::supportsRSS) && &dbutil::supportsRSS($infodbtype)) 963 { 964 my $rss_db = &dbutil::get_infodb_file_path($infodbtype, 'rss-items', $output_dir); 965 my $rss_db_fh = &dbutil::open_infodb_write_handle($infodbtype, $rss_db, 'append'); 966 &dbutil::write_infodb_rawentry($infodbtype, $rss_db_fh, $oid, $rss_entry); 967 &dbutil::close_infodb_write_handle($infodbtype, $rss_db_fh); 968 } 969 else 970 { 971 my $rss_filename = &FileUtils::filenameConcatenate($output_dir,"rss-items.rdf"); 972 my $rss_fh; 973 if (&FileUtils::openFileHandle($rss_filename, '>>', \$rss_fh)) 974 { 975 print $rss_fh $rss_entry . "\n"; 949 976 &FileUtils::closeFileHandle($rss_filename, \$rss_fh); 950 } 951 else { 977 } 978 else 979 { 952 980 print STDERR "**** Failed to open $rss_filename\n$!\n"; 953 } 981 } 982 } 954 983 } 955 984 }
Note:
See TracChangeset
for help on using the changeset viewer.