Changeset 24071
- Timestamp:
- 2011-05-20T16:34:22+12:00 (13 years ago)
- Location:
- main/trunk/greenstone2/perllib/cgiactions
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/cgiactions/buildaction.pm
r23469 r24071 28 28 use strict; 29 29 30 use JSON; 31 30 32 use cgiactions::baseaction; 31 33 … … 33 35 use ghtml; 34 36 37 use util; 35 38 36 39 BEGIN { … … 65 68 66 69 "incremental-rebuild" => { 'compulsory-args' => [], 67 'optional-args' => [] } 70 'optional-args' => [] }, 71 72 "build-by-manifest" => { 'compulsory-args' => [], 73 'optional-args' => ["index-files", "reindex-files", "delete-OIDs"] } 74 68 75 }; 69 76 … … 206 213 # Make sure the collection isn't locked by someone else 207 214 $self->lock_collection($username, $collect); 208 209 215 210 216 my $bin_script = &util::filename_cat($gsdl_home,"bin","script"); 211 217 my $cmd = "perl -S full-rebuild.pl \"$collect\""; … … 342 348 } 343 349 344 350 sub build_by_manifest 351 { 352 my $self = shift @_; 353 354 my $username = $self->{'username'}; 355 my $collect = $self->{'collect'}; 356 my $gsdl_cgi = $self->{'gsdl_cgi'}; 357 my $gsdl_home = $self->{'gsdlhome'}; 358 359 # Authenticate user if it is enabled 360 if ($baseaction::authentication_enabled) { 361 # Ensure the user is allowed to edit this collection 362 &authenticate_user($gsdl_cgi, $username, $collect); 363 } 364 365 # Obtain the collect dir 366 my $collect_dir = &util::filename_cat($gsdl_home, "collect"); 367 368 # Make sure the collection isn't locked by someone else 369 $self->lock_collection($username, $collect); 370 371 my $if_json_str = $self->{'index-files'}; 372 my $rf_json_str = $self->{'reindex-files'}; 373 my $df_json_str = $self->{'delete-OIDs'}; 374 375 376 my $index_files = (defined $if_json_str) ? decode_json $if_json_str : []; 377 my $reindex_files = (defined $rf_json_str) ? decode_json $rf_json_str : []; 378 my $delete_files = (defined $df_json_str) ? decode_json $df_json_str : []; 379 380 my $index_files_xml = join("\n", map { " <Filename>$_</Filename>" } @$index_files); 381 my $reindex_files_xml = join("\n", map { " <Filename>$_</Filename>" } @$reindex_files); 382 my $delete_files_xml = join("\n", map { " <OID>$_</OID>" } @$delete_files); 383 384 my $manifest_filename = &util::get_tmp_filename(".xml"); 385 my ($status,$report); 386 387 if (open(MOUT,">$manifest_filename")) { 388 binmode(MOUT,":utf8"); 389 print MOUT <<MOUTRAW; 390 <Manifest> 391 <Index> 392 $index_files_xml 393 </Index> 394 <Reindex> 395 $reindex_files_xml 396 </Reindex> 397 <Delete> 398 $delete_files_xml 399 </Delete> 400 </Manifest> 401 MOUTRAW 402 close(MOUT); 403 404 ## my $bin_script = &util::filename_cat($gsdl_home,"bin","script"); 405 my $cmd = "perl -S incremental-rebuild.pl -manifest \"$manifest_filename\" \"$collect\""; 406 407 ($status,$report) = $self->run_build_cmd($cmd); 408 409 if ($status==0) { 410 &util::rm($manifest_filename); 411 } 412 } 413 else { 414 $status = -1; 415 $report = "Failed to open '$manifest_filename' for output\n$!\n"; 416 } 417 418 419 # Release the lock once it is done 420 $self->unlock_collection($username, $collect); 421 422 if ($status==0) { 423 $gsdl_cgi->generate_ok_message($report); 424 } 425 else { 426 $gsdl_cgi->generate_error($report); 427 } 428 429 # incremental-rebuild.pl -manifest manifest.xml \"" + _greenstoneCollectionName + "\""; 430 } 345 431 346 432 -
main/trunk/greenstone2/perllib/cgiactions/explodeaction.pm
r23768 r24071 34 34 use util; 35 35 36 use JSON; 37 36 38 use File::Basename; 37 39 … … 50 52 my $action_table = 51 53 { 52 "explode" => { 'compulsory-args' => ["d"], 53 'optional-args' => [] } 54 "explode-document" => { 'compulsory-args' => ["d"], 55 'optional-args' => [] }, 56 "delete-document" => { 'compulsory-args' => ["d"], 57 'optional-args' => [ "onlyadd" ] }, 58 "delete-document-array" => { 'compulsory-args' => ["json"], 59 'optional-args' => [ "onlyadd" ] } 60 61 54 62 }; 55 63 … … 257 265 258 266 259 sub explode 267 sub remove_docoids 268 { 269 my $self = shift @_; 270 my ($docids) = @_; 271 272 my $collect = $self->{'collect'}; 273 my $gsdl_cgi = $self->{'gsdl_cgi'}; 274 my $infodb_type = $self->{'infodbtype'}; 275 276 # Derive the archives and import directories 277 my $site = $self->{'site'}; 278 my $collect_dir = $gsdl_cgi->get_collection_dir($site); 279 280 my $archive_dir = &util::filename_cat($collect_dir,$collect,"archives"); 281 282 # Obtain the doc.xml path for the specified docID 283 my $arcinfo_doc_filename 284 = &dbutil::get_infodb_file_path($infodb_type, "archiveinf-doc", 285 $archive_dir); 286 287 foreach my $docid (@$docids) { 288 289 my $doc_rec 290 = &dbutil::read_infodb_entry($infodb_type, $arcinfo_doc_filename, 291 $docid); 292 293 my $doc_xml_file = $doc_rec->{'doc-file'}->[0]; 294 295 # The $doc_xml_file is relative to the archives, so need to do 296 # a bit more work to make sure the right folder containing this 297 # is moved to the right place in the import folder 298 299 my $assoc_path = dirname($doc_xml_file); 300 my $archive_assoc_dir = &util::filename_cat($archive_dir,$assoc_path); 301 302 &util::rm_r($archive_assoc_dir) 303 } 304 } 305 306 307 sub explode_document 260 308 { 261 309 my $self = shift @_; … … 309 357 310 358 359 sub delete_document_entry 360 { 361 my $self = shift @_; 362 my ($docid_root,$opt_onlyadd) = @_; 363 364 my $docid_keys = []; 365 if ((defined $opt_onlyadd) && ($opt_onlyadd==1)) { 366 # delete docoid archive folder 367 push(@$docid_keys,$docid_root); 368 } 369 else { 370 print STDERR "**** Not currently implemented for the general case!!\nDeleting 'archive' version only."; 371 372 push(@$docid_keys,$docid_root); 373 374 #my $orig_import_filenames = $self->docid_to_import_filenames($docid_root); 375 #$docid_keys = $self->import_filenames_to_docids($orig_import_filenames); 376 #my $expanded_import_filenames = $self->docid_to_import_filenames(@$docid_keys); 377 378 # need to remove only the files that are not 379 380 #$self->remove_import_filenames($expanded_import_filenames); 381 } 382 383 $self->remove_docoids($docid_keys); 384 } 385 386 387 sub delete_document 388 { 389 my $self = shift @_; 390 391 my $username = $self->{'username'}; 392 my $collect = $self->{'collect'}; 393 my $gsdl_cgi = $self->{'gsdl_cgi'}; 394 my $gsdl_home = $self->{'gsdlhome'}; 395 396 # Authenticate user if it is enabled 397 if ($baseaction::authentication_enabled) { 398 # Ensure the user is allowed to edit this collection 399 &authenticate_user($gsdl_cgi, $username, $collect); 400 } 401 402 # Derive the archives dir 403 my $site = $self->{'site'}; 404 my $collect_dir = $gsdl_cgi->get_collection_dir($site); 405 406 my $archive_dir = &util::filename_cat($collect_dir,$collect,"archives"); 407 ##my $archive_dir = &util::filename_cat($ENV{'GSDLCOLLECTDIR'},"archives"); 408 409 # Make sure the collection isn't locked by someone else 410 $self->lock_collection($username, $collect); 411 412 # look up additional args 413 my $docid = $self->{'d'}; 414 if ((!defined $docid) || ($docid =~ m/^\s*$/)) { 415 $self->unlock_collection($username, $collect); 416 $gsdl_cgi->generate_error("No docid (d=...) specified."); 417 } 418 419 my ($docid_root,$docid_secnum) = ($docid =~ m/^(.*?)(\..*)?$/); 420 421 my $onlyadd = $self->{'onlyadd'}; 422 423 my $status = $self->delete_document_entry($docid_root,$onlyadd); 424 425 # Release the lock once it is done 426 $self->unlock_collection($username, $collect); 427 428 my $mess = "delete-document successful: Key[$docid_root]\n"; 429 $gsdl_cgi->generate_ok_message($mess); 430 431 } 432 433 434 sub delete_document_array 435 { 436 my $self = shift @_; 437 438 my $username = $self->{'username'}; 439 my $collect = $self->{'collect'}; 440 my $gsdl_cgi = $self->{'gsdl_cgi'}; 441 my $gsdlhome = $self->{'gsdlhome'}; 442 443 if ($baseaction::authentication_enabled) { 444 # Ensure the user is allowed to edit this collection 445 &authenticate_user($gsdl_cgi, $username, $collect); 446 } 447 448 my $site = $self->{'site'}; 449 my $collect_dir = $gsdl_cgi->get_collection_dir($site); 450 451 $gsdl_cgi->checked_chdir($collect_dir); 452 453 # Obtain the collect dir 454 ## my $collect_dir = &util::filename_cat($gsdlhome, "collect"); 455 456 # Make sure the collection isn't locked by someone else 457 $self->lock_collection($username, $collect); 458 459 # look up additional args 460 461 my $json_str = $self->{'json'}; 462 my $doc_array = decode_json $json_str; 463 464 my $onlyadd = $self->{'onlyadd'}; 465 466 467 my $global_status = 0; 468 my $global_mess = ""; 469 470 my @all_docids = (); 471 472 foreach my $doc_array_rec ( @$doc_array ) { 473 474 my $docid = $doc_array_rec->{'docid'}; 475 476 push(@all_docids,$docid); 477 478 my ($docid_root,$docid_secnum) = ($docid =~ m/^(.*?)(\..*)?$/); 479 480 my $status = $self->delete_document_entry($docid_root,$onlyadd); 481 482 if ($status != 0) { 483 # Catch error if set infodb entry failed 484 $global_status = $status; 485 $global_mess .= "Failed to delete document key: $docid\n"; 486 $global_mess .= "Exit status: $status\n"; 487 $global_mess .= "System Error Message: $!\n"; 488 $global_mess .= "-" x 20; 489 } 490 } 491 492 if ($global_status != 0) { 493 $global_mess .= "PATH: $ENV{'PATH'}\n"; 494 $gsdl_cgi->generate_error($global_mess); 495 } 496 else { 497 my $mess = "delete-document-array successful: Keys[ ".join(", ",@all_docids)."]\n"; 498 $gsdl_cgi->generate_ok_message($mess); 499 } 500 501 # Release the lock once it is done 502 $self->unlock_collection($username, $collect); 503 } 504 505 311 506 312 507 1; -
main/trunk/greenstone2/perllib/cgiactions/metadataaction.pm
r23766 r24071 33 33 use ghtml; 34 34 35 use JSON; 36 35 37 36 38 BEGIN { … … 57 59 'optional-args' => [ "metapos" ] }, 58 60 61 "set-metadata-array" => { 'compulsory-args' => [ "json" ], 62 'optional-args' => [ ] }, 63 59 64 "set-archives-metadata" => { 'compulsory-args' => [ "d", "metaname", "metavalue" ], 60 65 'optional-args' => [ "metapos", "metamode" ] … … 62 67 }, 63 68 69 "set-archives-metadata-array" => { 'compulsory-args' => [ "json" ], 70 'optional-args' => [ "metamode" ] 71 }, 72 64 73 "set-import-metadata" => { 'compulsory-args' => [ "metaname", "metavalue" ], 65 74 'optional-args' => [ "d", "f", "metamode" ] … … 292 301 } 293 302 303 sub set_metadata_entry 304 { 305 my $self = shift @_; 306 my ($collect_dir,$collect,$infodbtype,$docid,$metaname,$metapos,$metavalue) = @_; 307 308 # To people who know $collect_tail please add some comments 309 # Obtain path to the database 310 my $collect_tail = $collect; 311 $collect_tail =~ s/^.*[\/\\]//; 312 my $index_text_directory = &util::filename_cat($collect_dir,$collect,"index","text"); 313 my $infodb_file_path = &dbutil::get_infodb_file_path($infodbtype, $collect_tail, $index_text_directory); 314 315 # print STDERR "**** infodb file path = $infodb_file_path\n"; 316 # print STDERR "***** infodb type = $infodbtype\n"; 317 318 # Read the docid entry 319 my $doc_rec = &dbutil::read_infodb_entry($infodbtype, $infodb_file_path, $docid); 320 321 # Set the metadata value 322 if (defined $metapos) { 323 $doc_rec->{$metaname}->[$metapos] = $metavalue; 324 } 325 else { 326 $doc_rec->{$metaname} = [ $metavalue ]; 327 } 328 329 my $status = &dbutil::set_infodb_entry($infodbtype, $infodb_file_path,$docid,$doc_rec); 330 331 return $status; 332 333 } 294 334 295 335 sub set_metadata … … 325 365 my $infodbtype = $self->{'infodbtype'}; 326 366 327 # To people who know $collect_tail please add some comments 328 # Obtain path to the database 329 my $collect_tail = $collect; 330 $collect_tail =~ s/^.*[\/\\]//; 331 my $index_text_directory = &util::filename_cat($collect_dir,$collect,"index","text"); 332 my $infodb_file_path = &dbutil::get_infodb_file_path($infodbtype, $collect_tail, $index_text_directory); 333 334 print STDERR "**** infodb file path = $infodb_file_path\n"; 335 print STDERR "***** infodb type = $infodbtype\n"; 336 337 # Read the docid entry 338 my $doc_rec = &dbutil::read_infodb_entry($infodbtype, $infodb_file_path, $docid); 339 340 # Set the metadata value 341 if (defined $metapos) { 342 $doc_rec->{$metaname}->[$metapos] = $metavalue; 343 } 344 else { 345 $doc_rec->{$metaname} = [ $metavalue ]; 346 } 347 348 my $status = &dbutil::set_infodb_entry($infodbtype, $infodb_file_path,$docid,$doc_rec); 367 my $status = $self->set_metadata_entry($collect_dir,$collect,$infodbtype,$docid,$metaname,$metapos,$metavalue); 368 349 369 if ($status != 0) { 350 370 # Catch error if set infodb entry failed … … 358 378 } 359 379 else { 360 my $mess = "set- document-metadata successful: Key[$docid]\n";380 my $mess = "set-metadata successful: Key[$docid]\n"; 361 381 $mess .= " $metaname"; 362 382 $mess .= "->[$metapos]" if (defined $metapos); … … 369 389 $self->unlock_collection($username, $collect); 370 390 } 391 392 393 394 395 sub set_metadata_array 396 { 397 my $self = shift @_; 398 399 my $username = $self->{'username'}; 400 my $collect = $self->{'collect'}; 401 my $gsdl_cgi = $self->{'gsdl_cgi'}; 402 my $gsdlhome = $self->{'gsdlhome'}; 403 404 if ($baseaction::authentication_enabled) { 405 # Ensure the user is allowed to edit this collection 406 &authenticate_user($gsdl_cgi, $username, $collect); 407 } 408 409 my $site = $self->{'site'}; 410 my $collect_dir = $gsdl_cgi->get_collection_dir($site); 411 412 $gsdl_cgi->checked_chdir($collect_dir); 413 414 # Obtain the collect dir 415 ## my $collect_dir = &util::filename_cat($gsdlhome, "collect"); 416 417 # Make sure the collection isn't locked by someone else 418 $self->lock_collection($username, $collect); 419 420 # look up additional args 421 422 my $infodbtype = $self->{'infodbtype'}; 423 424 my $json_str = $self->{'json'}; 425 my $doc_array = decode_json $json_str; 426 427 428 my $global_status = 0; 429 my $global_mess = ""; 430 431 my @all_docids = (); 432 433 foreach my $doc_array_rec ( @$doc_array ) { 434 435 my $docid = $doc_array_rec->{'docid'}; 436 my $metaname = $doc_array_rec->{'metaname'}; 437 my $metapos = $doc_array_rec->{'metapos'}; 438 my $metavalue = $doc_array_rec->{'metavalue'}; 439 440 push(@all_docids,$docid); 441 442 my $status = $self->set_metadata_entry($collect_dir,$collect,$infodbtype,$docid,$metaname,$metapos,$metavalue); 443 444 if ($status != 0) { 445 # Catch error if set infodb entry failed 446 $global_status = $status; 447 $global_mess .= "Failed to set metadata key: $docid\n"; 448 $global_mess .= "Exit status: $status\n"; 449 $global_mess .= "System Error Message: $!\n"; 450 $global_mess .= "-" x 20; 451 } 452 } 453 454 if ($global_status != 0) { 455 $global_mess .= "PATH: $ENV{'PATH'}\n"; 456 $gsdl_cgi->generate_error($global_mess); 457 } 458 else { 459 my $mess = "set-metadata-array successful: Keys[ ".join(", ",@all_docids)."]\n"; 460 $gsdl_cgi->generate_ok_message($mess); 461 } 462 463 # Release the lock once it is done 464 $self->unlock_collection($username, $collect); 465 } 466 371 467 372 468 … … 554 650 } 555 651 652 sub set_archives_metadata_entry 653 { 654 my $self = shift @_; 655 my ($gsdl_cgi,$archive_dir, $collect_dir,$collect, $infodbtype,$docid,$metaname,$metapos,$metavalue,$metamode) = @_; 656 657 # Obtain the doc.xml path for the specified docID 658 my ($docid_root,$docid_secnum) = ($docid =~ m/^(.*?)(\..*)?$/); 659 660 my $arcinfo_doc_filename = &dbutil::get_infodb_file_path($infodbtype, "archiveinf-doc", $archive_dir); 661 my $doc_rec = &dbutil::read_infodb_entry($infodbtype, $arcinfo_doc_filename, $docid_root); 662 my $doc_xml_file = $doc_rec->{'doc-file'}->[0]; 663 664 # The $doc_xml_file is relative to the archives, and now let's get the full path 665 my $archives_dir = &util::filename_cat($collect_dir,$collect,"archives"); 666 my $doc_xml_filename = &util::filename_cat($archives_dir,$doc_xml_file); 667 668 # Edit the doc.xml file with the specified metadata name, value and position. 669 # TODO: there is a potential problem here as this edit_doc_xml function 670 # is assuming the simple doc.xml situation where there is only one Section and no SubSections. 671 # Running import.pl -groupsize will cause this to have multiple sections in one doc.xml 672 673 print STDERR "** away to call edit_doc_xml\n"; 674 675 $self->edit_doc_xml($gsdl_cgi,$doc_xml_filename, 676 $metaname,$metavalue,$metapos,$metamode,$docid_secnum); 677 678 print STDERR "*** finished edit_doc_xml\n"; 679 680 return 0; # return 0 for now to indicate no error 681 682 } 683 556 684 557 685 sub set_archives_metadata … … 565 693 my $infodbtype = $self->{'infodbtype'}; 566 694 695 696 567 697 if ($baseaction::authentication_enabled) { 568 # Ensure the user is allowed to edit this collection 569 $self->authenticate_user($username, $collect); 570 } 571 698 # Ensure the user is allowed to edit this collection 699 $self->authenticate_user($username, $collect); 700 } 701 702 my $site = $self->{'site'}; 703 572 704 # Obtain the collect and archive dir 573 my $site = $self->{'site'};574 705 my $collect_dir = $gsdl_cgi->get_collection_dir($site); 575 ## my $collect_dir = &util::filename_cat($gsdlhome, "collect");576 706 577 707 my $archive_dir = &util::filename_cat($collect_dir,$collect,"archives"); … … 593 723 # delete any existing values) 594 724 $metamode = "accumulate"; 595 } 596 597 # Obtain the doc.xml path for the specified docID 598 my ($docid_root,$docid_secnum) = ($docid =~ m/^(.*?)(\..*)?$/); 599 600 my $arcinfo_doc_filename = &dbutil::get_infodb_file_path($infodbtype, "archiveinf-doc", $archive_dir); 601 my $doc_rec = &dbutil::read_infodb_entry($infodbtype, $arcinfo_doc_filename, $docid_root); 602 my $doc_xml_file = $doc_rec->{'doc-file'}->[0]; 603 604 # The $doc_xml_file is relative to the archives, and now let's get the full path 605 my $archives_dir = &util::filename_cat($collect_dir,$collect,"archives"); 606 my $doc_xml_filename = &util::filename_cat($archives_dir,$doc_xml_file); 607 608 # Edit the doc.xml file with the specified metadata name, value and position. 609 # TODO: there is a potential problem here as this edit_doc_xml function 610 # is assuming the simple doc.xml situation where there is only one Section and no SubSections. 611 # Running import.pl -groupsize will cause this to have multiple sections in one doc.xml 612 $self->edit_doc_xml($gsdl_cgi,$doc_xml_filename, 613 $metaname,$metavalue,$metapos,$metamode,$docid_secnum); 614 725 } 726 727 my $status = $self->set_archives_metadata_entry($gsdl_cgi,$archive_dir, $collect_dir,$collect, $infodbtype,$docid, 728 $metaname,$metapos,$metavalue,$metamode); 729 615 730 # Release the lock once it is done 616 731 $self->unlock_collection($username, $collect); 617 732 618 my $mess = "set-archives-metadata successful: Key[$docid]\n"; 619 $mess .= " $metaname"; 620 $mess .= "->[$metapos]" if (defined $metapos); 621 $mess .= " = $metavalue"; 622 $mess .= " ($metamode)\n"; 623 624 $gsdl_cgi->generate_ok_message($mess); 733 if ($status == 0) { 734 my $mess = "set-archives-metadata successful: Key[$docid]\n"; 735 $mess .= " $metaname"; 736 $mess .= "->[$metapos]" if (defined $metapos); 737 $mess .= " = $metavalue"; 738 $mess .= " ($metamode)\n"; 739 740 $gsdl_cgi->generate_ok_message($mess); 741 } 742 else { 743 my $mess .= "Failed to set archives metadata key: $docid\n"; 744 $mess .= "Exit status: $status\n"; 745 $mess .= "System Error Message: $!\n"; 746 $mess .= "-" x 20 . "\n"; 747 748 $gsdl_cgi->generate_error($mess); 749 } 750 } 751 752 753 sub set_archives_metadata_array 754 { 755 my $self = shift @_; 756 757 my $username = $self->{'username'}; 758 my $collect = $self->{'collect'}; 759 my $gsdl_cgi = $self->{'gsdl_cgi'}; 760 my $gsdlhome = $self->{'gsdlhome'}; 761 762 if ($baseaction::authentication_enabled) { 763 # Ensure the user is allowed to edit this collection 764 &authenticate_user($gsdl_cgi, $username, $collect); 765 } 766 767 my $site = $self->{'site'}; 768 my $collect_dir = $gsdl_cgi->get_collection_dir($site); 769 770 $gsdl_cgi->checked_chdir($collect_dir); 771 772 # Obtain the collect dir 773 ## my $collect_dir = &util::filename_cat($gsdlhome, "collect"); 774 775 # Make sure the collection isn't locked by someone else 776 $self->lock_collection($username, $collect); 777 778 # look up additional args 779 780 my $infodbtype = $self->{'infodbtype'}; 781 782 my $archive_dir = &util::filename_cat($collect_dir,$collect,"archives"); 783 784 my $json_str = $self->{'json'}; 785 my $doc_array = decode_json $json_str; 786 787 788 my $global_status = 0; 789 my $global_mess = ""; 790 791 my @all_docids = (); 792 793 foreach my $doc_array_rec ( @$doc_array ) { 794 795 my $docid = $doc_array_rec->{'docid'}; 796 my $metaname = $doc_array_rec->{'metaname'}; 797 my $metapos = $doc_array_rec->{'metapos'}; 798 my $metamode = $self->{'metamode'}; 799 my $metavalue = $doc_array_rec->{'metavalue'}; 800 801 # Some sanity checks 802 $metapos = 0 if (!defined $metapos); 803 804 if ((!defined $metamode) || ($metamode =~ m/^\s*$/)) { 805 # make "accumulate" the default (less destructive, as won't actually 806 # delete any existing values) 807 $metamode = "accumulate"; 808 } 809 810 push(@all_docids,$docid); 811 812 my $status = $self->set_archives_metadata_entry($gsdl_cgi,$archive_dir, $collect_dir,$collect, $infodbtype,$docid, 813 $metaname,$metapos,$metavalue,$metamode); 814 815 if ($status != 0) { 816 # Catch error if set infodb entry failed 817 $global_status = $status; 818 $global_mess .= "Failed to set metadata key: $docid\n"; 819 $global_mess .= "Exit status: $status\n"; 820 $global_mess .= "System Error Message: $!\n"; 821 $global_mess .= "-" x 20 . "\n"; 822 } 823 } 824 825 if ($global_status != 0) { 826 $global_mess .= "PATH: $ENV{'PATH'}\n"; 827 $gsdl_cgi->generate_error($global_mess); 828 } 829 else { 830 my $mess = "set-archives-metadata-array successful: Keys[ ".join(", ",@all_docids)."]\n"; 831 $gsdl_cgi->generate_ok_message($mess); 832 } 833 834 # Release the lock once it is done 835 $self->unlock_collection($username, $collect); 625 836 } 626 837
Note:
See TracChangeset
for help on using the changeset viewer.