Changeset 21305
- Timestamp:
- 2009-12-09T13:15:20+13:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gs3-extensions/pharos-imageis/trunk/perllib/plugins/PharosImageIndexer.pm
r21296 r21305 74 74 # Check that Pharos is installed and available on the path 75 75 my $pharos_available = 1; 76 ## change for windows! 77 #my $result = `phraros-imageis-identify 2>&1`; 78 #my $return_value = $?; 79 #if ( ($ENV{'GSDLOS'} eq "windows" && $return_value == 256) || $return_value == -1) { # Linux and Windows return different values for "program not found" 80 # $pharos_available = 0; 81 #} 76 my $result = `pharos-imageis-identify.pl 2>&1`; 77 my $return_value = $?; 78 if ( ($ENV{'GSDLOS'} eq "windows" && $return_value == 256) || $return_value == -1) { # Linux and Windows return different values for "program not found" 79 $pharos_available = 0; 80 } 82 81 83 $self->{'pharos_available'} = 1; #$pharos_available;82 $self->{'pharos_available'} = $pharos_available; 84 83 85 84 if ($self->{'pharos_available'} == 0) { … … 94 93 } 95 94 96 sub removeold { 95 sub remove_one { 96 my $self = shift (@_); 97 98 my ($file, $oids) = @_; 99 print STDERR "in pharos remove_one, $file, $oids\n"; 100 return if ($self->{'disable_pharos_imageis'}); 101 102 if (!$self->{'pharos_available'}) { 103 print STDERR "pharos not available, can't remove\n"; 104 return; 105 } 106 107 my $doc_id = @$oids[0]; 108 return unless defined $doc_id; 109 my $collection = &util::get_current_collection_name(); 110 my $cmd = "perl -S pharos-imageis-delete.pl $collection $doc_id.jpg 2>&1"; 111 print STDERR "Running command $cmd\n"; 112 my $result = `$cmd`; 113 my $return_value = $?; 114 my $outhandle = $self->{'outhandle'}; 115 if ($return_value != 0) { 116 print $outhandle "Pharos Indexing failed to delete $doc_id from database for collection $collection\n"; 117 } 118 print $outhandle "$result\n"; 119 120 } 121 sub remove_all { 97 122 my $self = shift (@_); 98 123 my ($pluginfo, $base_dir, $processor, $maxdocs) = @_; … … 101 126 102 127 if (!$self->{'pharos_available'}) { 103 print STDERR "pharos not available, not doing a remove old\n";128 print STDERR "pharos not available, not doing a remove_all\n"; 104 129 return; 105 130 } 106 131 # need to delete everything from the derby database. 107 132 my $collection = &util::get_current_collection_name(); 108 my $cmd = "perl -S pharos-imageis-delete.pl $collection *.jpg2>&1";133 my $cmd = "perl -S pharos-imageis-delete.pl $collection '*.jpg' 2>&1"; 109 134 print STDERR "Running command $cmd\n"; 110 135 my $result = `$cmd`;
Note:
See TracChangeset
for help on using the changeset viewer.