Changeset 31409 for main/trunk/greenstone2/perllib/oaiinfo.pm
- Timestamp:
- 2017-02-14T17:43:28+13:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/oaiinfo.pm
r31218 r31409 28 28 sub new { 29 29 my $class = shift(@_); 30 my ($config_filename, $infodbtype ) = @_;30 my ($config_filename, $infodbtype, $verbosity) = @_; 31 31 32 32 my $self = { 33 'verbosity' => $verbosity || 0, 34 'verbosity_threshold' => 5, # start printing debugging info from verbosity >= threshold 33 35 'info'=>{} # map of {OID, array[deletion-status,timestamp,datestamp]} pairs 34 36 }; … … 47 49 $self->{'oaidb_tmp_filepath'} = &dbutil::get_infodb_file_path($infodbtype, "oai-inf-tmp", $etc_dir, $perform_firsttime_init); 48 50 $self->{'etc_dir'} = $etc_dir; 49 # print STDERR "############ LIVE DB: $self->{'oaidb_live_filepath'}\n" ;50 # print STDERR "############ TMP DB: $self->{'oaidb_tmp_filepath'}\n" ;51 # print STDERR "############ LIVE DB: $self->{'oaidb_live_filepath'}\n" if $self->{'verbosity'} >= $self->{'verbosity_threshold'}; 52 # print STDERR "############ TMP DB: $self->{'oaidb_tmp_filepath'}\n" if $self->{'verbosity'} >= $self->{'verbosity_threshold'}; 51 53 52 54 $self->{'oaidb_file_path'} = $self->{'oaidb_tmp_filepath'}; # db file we're working with … … 184 186 # final param follows jmt's $perform_firsttime_init in inexport.pm 185 187 186 # print STDERR "@@@@@ oaidb: $self->{'oaidb_file_path'}\n" ;188 # print STDERR "@@@@@ oaidb: $self->{'oaidb_file_path'}\n" if $self->{'verbosity'} >= $self->{'verbosity_threshold'}; 187 189 188 190 return $do_pd_step; … … 197 199 my $self = shift (@_); 198 200 my ($removeold, $have_manifest) = @_; 199 201 200 202 my $do_pd_step = $self->init_tmpdb($removeold, $have_manifest); 201 203 # returns 1 if the step to mark oaidb entries as PD is required … … 244 246 # see http://perldoc.perl.org/constant.html 245 247 246 print STDERR "######## OID: $OID - status: $indexing_status\n" ;248 print STDERR "######## OID: $OID - status: $indexing_status\n" if $self->{'verbosity'} >= $self->{'verbosity_threshold'}; 247 249 248 250 if($indexing_status eq "I") { … … 257 259 # an oaicollection. But what if we always maintain an oaidb? Still call $self->index() here. 258 260 } else { 259 print STDERR "### oaiinfo::building_stage_before_indexing(): Unrecognised indexing status $indexing_status\n"; 261 if ($self->{'verbosity'} >= $self->{'verbosity_threshold'}) { 262 print STDERR "### oaiinfo::building_stage_before_indexing(): Unrecognised indexing status $indexing_status\n"; 263 } 260 264 } 261 265 } … … 288 292 &dbutil::rename_db_file_to($self->{'infodbtype'}, $oaidb_tmp_filepath, $oaidb_live_filepath); # rename the db file and any assoc files 289 293 290 print STDERR "#### Should now have MOVED $self->{'oaidb_tmp_filepath'} to $self->{'oaidb_live_filepath'}\n"; 294 if ($self->{'verbosity'} >= $self->{'verbosity_threshold'}) { 295 print STDERR "#### Should now have MOVED $self->{'oaidb_tmp_filepath'} to $self->{'oaidb_live_filepath'}\n"; 296 } 291 297 292 298 } else { 293 print STDERR "@@@@@ In oaiinfo::activate_collection():\n"; 294 print STDERR "@@@@@ No tmpdb at $self->{'oaidb_tmp_filepath'}\n"; 295 print STDERR "@@@@@ to make 'live' by moving to $self->{'oaidb_live_filepath'}.\n"; 299 if ($self->{'verbosity'} >= $self->{'verbosity_threshold'}) { 300 print STDERR "@@@@@ In oaiinfo::activate_collection():\n"; 301 print STDERR "@@@@@ No tmpdb at $self->{'oaidb_tmp_filepath'}\n"; 302 print STDERR "@@@@@ to make 'live' by moving to $self->{'oaidb_live_filepath'}.\n"; 303 } 296 304 } 297 305 } … … 306 314 my $self = shift (@_); 307 315 308 print STDERR "@@@@@ oaiinfo::mark_all_E_as_PD(): Marking the E entries as PD\n" ;316 print STDERR "@@@@@ oaiinfo::mark_all_E_as_PD(): Marking the E entries as PD\n" if $self->{'verbosity'} >= $self->{'verbosity_threshold'}; 309 317 310 318 my $infomap = $self->{'info'}; … … 324 332 my $self = shift (@_); 325 333 326 print STDERR "@@@@@ oaiinfo::mark_all_PD_as_D(): Marking the PD entries as D\n" ;334 print STDERR "@@@@@ oaiinfo::mark_all_PD_as_D(): Marking the PD entries as D\n" if $self->{'verbosity'} >= $self->{'verbosity_threshold'}; 327 335 328 336 my $infomap = $self->{'info'}; … … 343 351 my $self = shift (@_); 344 352 353 if ($self->{'verbosity'} < $self->{'verbosity_threshold'}) { 354 return; 355 } 356 345 357 print STDERR "###########################################################\n"; 346 358 print STDERR "@@@@@ oaiinfo::print_info(): oaidb in memory contains: \n";
Note:
See TracChangeset
for help on using the changeset viewer.