Ignore:
Timestamp:
2018-11-02T20:51:09+13:00 (5 years ago)
Author:
ak19
Message:

I think this is a bugfix to plugin.pm::remove_some(): when processing files to delete on deletion/reindexing, it would return after the first successful remove_one(). This wasn't a noticeable problem in the past since no plugin had a real need for implementing remove_one(). But now GS SQLPlugin does remove_one() in earnest, we need all the docs marked for deletion to be processed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugin.pm

    r32539 r32565  
    255255    # use 'archiveinf-src' info database to look up all the OIDs
    256256    # that this file is used in (note in most cases, it's just one OID)
     257
     258    my $processed_file = 0; # set to 1 if a plugin could process the file and did so successfully
    257259   
    258260    my $file_with_placeholders = &util::abspath_to_placeholders($file);
     
    264266        $rv = $plugobj->remove_one($file, $oids, $archivedir);
    265267        if (defined $rv && $rv != -1) {
    266         return $rv;
     268        #return $rv;
     269        $processed_file = 1;
     270        last; # break and continue with outer for loop, to process other deleted files
    267271        } # else undefined (was not recognised by the plugin) or there was an error, try the next one
    268272    }
    269     return 0;
    270     }
    271 
    272 }
     273    #return 0;
     274   
     275    if (!$processed_file) { # no plugin could recognise file.
     276        # Should we continue processing other deleted files or not?
     277        print STDERR "WARNING: plugin::remove_some() failed to process $file with oid(s) ". join(",", $oids) . "\n";
     278        return 0;
     279    } # else some plugin processed the current deleted file
     280      # continue to process next deleted file
     281   
     282    }
     283    return 1; # if we got here, all deleted files got processed successfully
     284}
     285
    273286sub file_block_read {
    274287    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $gli) = @_;
Note: See TracChangeset for help on using the changeset viewer.