Changeset 32543 for main/trunk/greenstone2/perllib/plugouts
- Timestamp:
- 2018-10-26T15:10:47+13:00 (6 years ago)
- Location:
- main/trunk/greenstone2/perllib/plugouts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/plugouts/GreenstoneSQLPlugout.pm
r32542 r32543 40 40 41 41 # TODO: SIGTERM rollback and disconnect? 42 # TODO Q: what about verbosity for debugging 42 # TODO Q: what about verbosity for debugging, instead of current situation of printing out upon debug set at the expense of writing to db 43 43 # TODO Q: introduced site_name param to plugins and plugouts. Did I do it right? And should they have hiddengli = "yes" 44 44 45 # this plugout does not output xml to a file, but outputs rows into a mysql table 45 # this plugout does not output the metadata and/or fulltxt xml to a file, 46 # but outputs rows into a mysql table for metadata and/or a table for fulltxt 46 47 sub BEGIN { 47 48 @GreenstoneSQLPlugout::ISA = ('GreenstoneXMLPlugout'); … … 56 57 57 58 # TODO Q: what is "group" in GreenstoneXMLPlugout? 58 # TODO Q: site_name only exists for GS3. What about GS2?59 60 59 61 60 my $process_mode_list = … … 141 140 #print STDERR "@@@@ proc_mode: " . $self->{'process_mode'} . "\n"; 142 141 143 ########### TODO: these should be set from cmdline/GLI options to plugout#########142 ########### TODO: deal with build mode ######### 144 143 145 144 $self->{'build_mode'} = "removeold"; … … 236 235 } 237 236 238 # TODO: check arc-inf.db for whether each entry is to be deleted/indexed/reindexed/been indexed 237 # TODO: check arc-inf.db for whether each entry is to be deleted/indexed/reindexed/been indexed? 238 # That's only for indexing, not for this step which only generates the content in archives dir 239 239 sub saveas { 240 240 my $self = shift (@_); … … 253 253 254 254 # TODO: also set debugging in begin()? Then stmts creating db and tables also sent to debug out and not executed 255 256 # TODO: remove unused old_unused_saveas from GreenstoneXMLPlugout 257 258 259 # 2. overriding saving behaviour to do what the superclass does PLUS saving to sql db 260 261 #NOTE: if proc_mode == all, then "breadcrumbs" go into both meta and txt elements of doc.xml: 262 # statements pointing viewer to the sql db for contents 255 256 257 # 2. overriding saving behaviour to do what the superclass does (writing out doc.xml files, 258 # under new name of docsql.xml, with breadcrumbs pointing to sql db) PLUS saving to sql db 259 260 # NOTE: if proc_mode == all, then "breadcrumbs" (statements pointing viewer to the sql db 261 # for contents) go into both meta and txt elements of doc.xml (docsql.xml specifically): 263 262 264 # write the INVERSE into doc.xml as to what is written to the db263 # write the INVERSE into doc.xml as to what is written to the SQL db 265 264 my $docxml_output_options = { 'output' => docprint::OUTPUT_NONE }; 266 265 if($proc_mode eq "meta_only" ) { # since only meta to go into MySQL db, text will go into docxml … … 272 271 # now we've prepared to write out whatever is meant to go into docxml 273 272 # and can do actual the steps superclass GreenstoneXMLPlugout carries out to write out docxml 274 # So: write out the doc xml file for the current document273 # So: write out the doc xml file, "docsql.xml", for the current document 275 274 my $section_text = &docprint::get_section_xml($doc_obj, $docxml_output_options); 276 275 print $docxml_outhandler $section_text; -
main/trunk/greenstone2/perllib/plugouts/GreenstoneXMLPlugout.pm
r32542 r32543 76 76 } 77 77 78 sub old_unused_saveas {79 my $self = shift (@_);80 my ($doc_obj, $doc_dir) = @_;81 my $outhandler;82 my $output_file;83 if ($self->{'debug'}) {84 $outhandler = STDOUT;85 }86 else {87 88 $self->process_assoc_files($doc_obj, $doc_dir, '');89 $self->process_metafiles_metadata ($doc_obj);90 91 # open up the outhandler92 if ($self->is_group() && !$self->{'new_doc_dir'}) {93 # we already have a handle open ??94 $outhandler = $self->{'group_outhandler'};95 } else {96 $output_file = &FileUtils::filenameConcatenate(97 $self->{'output_dir'}, $doc_dir, $self->get_doc_xml_filename($doc_obj));98 # open the new handle99 $self->open_xslt_pipe($output_file, $self->{'xslt_file'});100 101 if (defined $self->{'xslt_writer'}){102 $outhandler = $self->{'xslt_writer'};103 }104 else{105 $outhandler = $self->get_output_handler($output_file);106 }107 108 if ($self->is_group()) {109 $self->{'group_outhandler'} = $outhandler;110 }111 }112 } # else not debug113 binmode($outhandler,":utf8");114 115 # only output the header if we have started a new doc116 if (!$self->is_group() || $self->{'new_doc_dir'}) {117 $self->output_xml_header($outhandler);118 }119 120 my $section_text = &docprint::get_section_xml($doc_obj);121 print $outhandler $section_text;122 123 # only output the footer if we are not doing group stuff. The group file will be finished in close_group_output124 if (!$self->is_group()) {125 $self->output_xml_footer($outhandler);126 }127 128 # close off the output - in a group process situation, this will be done by close_group_output129 if (!$self->is_group() && !$self->{'debug'}) {130 if (defined $self->{'xslt_writer'}){131 $self->close_xslt_pipe();132 }133 else {134 &FileUtils::closeFileHandle($output_file, \$outhandler) if defined $output_file;135 }136 }137 $self->{'short_doc_file'} = &FileUtils::filenameConcatenate(138 $doc_dir, $self->get_doc_xml_filename($doc_obj));139 140 $self->store_output_info_reference($doc_obj);141 142 }143 144 78 # can be overridden in subclasses, for instance by GreenstoneSQLPlugout, to produce a different filename 145 79 # like docsql.xml
Note:
See TracChangeset
for help on using the changeset viewer.