Changeset 21307


Ignore:
Timestamp:
12/09/09 13:19:28 (11 years ago)
Author:
kjdon
Message:

removeold renamed to remove_all, added remove_some - a list of files to be deleted(or reindexed)

File:
1 edited

Legend:

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

    r21290 r21307  
    2525
    2626package plugin;
     27
     28use inexport;
    2729
    2830use strict; # to pick up typos and undeclared variables...
     
    213215}
    214216
    215  sub removeold {
     217 sub remove_all {
    216218    my ($pluginfo, $base_dir, $processor, $maxdocs) = @_;
    217219   
    218     map { $_->removeold($pluginfo, $base_dir, $processor, $maxdocs); } @$pluginfo;
     220    map { $_->remove_all($pluginfo, $base_dir, $processor, $maxdocs); } @$pluginfo;
    219221}
    220222 
    221 
     223sub remove_some {
     224    my ($pluginfo, $archivedir, $deleted_files) = @_;
     225    print STDERR "in remove some\n";
     226    return if (scalar(@$deleted_files)==0);
     227    my $arcinfo_src_filename = &inexport::src_db_file($archivedir);
     228
     229    foreach my $file (@$deleted_files) {
     230    # use 'archiveinf-src' GDBM file to look up all the OIDs
     231    # that this file is used in (note in most cases, it's just one OID)
     232   
     233    my $src_rec = GDBMUtils::gdbmRecordToHash($arcinfo_src_filename,$file);
     234    my $oids = $src_rec->{'oid'};
     235    map {$_->remove_one($file, $oids); } @$pluginfo;
     236    }
     237
     238}
    222239sub file_block_read {
    223240    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $gli) = @_;
Note: See TracChangeset for help on using the changeset viewer.