Index: /gsdl/trunk/perllib/plugins/ArchivesInfPlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/ArchivesInfPlugin.pm	(revision 19492)
+++ /gsdl/trunk/perllib/plugins/ArchivesInfPlugin.pm	(revision 19493)
@@ -169,5 +169,7 @@
 sub metadata_read {
     my $self = shift (@_);
-    my ($pluginfo, $base_dir, $file, $block_hash, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, 
+	$extrametakeys, $extrametadata, $extrametafile,
+	$processor, $maxdocs, $gli) = @_;
 
     return undef;
Index: /gsdl/trunk/perllib/plugins/BasePlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/BasePlugin.pm	(revision 19492)
+++ /gsdl/trunk/perllib/plugins/BasePlugin.pm	(revision 19493)
@@ -906,5 +906,7 @@
 sub metadata_read {
     my $self = shift (@_);
-    my ($pluginfo, $base_dir, $file, $block_hash, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, 
+	$extrametakeys, $extrametadata, $extrametafile,
+	$processor, $maxdocs, $gli) = @_;
     
     # can we process this file??
Index: /gsdl/trunk/perllib/plugins/DSpacePlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/DSpacePlugin.pm	(revision 19492)
+++ /gsdl/trunk/perllib/plugins/DSpacePlugin.pm	(revision 19493)
@@ -240,5 +240,7 @@
 sub metadata_read {
     my $self = shift (@_);
-    my ($pluginfo, $base_dir, $file, $block_hash, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, 
+	$extrametakeys, $extrametadata, $extrametafile,
+	$processor, $maxdocs, $gli) = @_;
 
     my $only_first_doc = $self->{'only_first_doc'};
Index: /gsdl/trunk/perllib/plugins/DirectoryPlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/DirectoryPlugin.pm	(revision 19492)
+++ /gsdl/trunk/perllib/plugins/DirectoryPlugin.pm	(revision 19493)
@@ -326,5 +326,7 @@
 sub metadata_read {
     my $self = shift (@_);
-    my ($pluginfo, $base_dir, $file, $block_hash, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, 
+	$extrametakeys, $extrametadata, $extrametafile,
+	$processor, $maxdocs, $gli) = @_;
 
     return undef;
@@ -395,4 +397,5 @@
     my $additionalmetadata = 0;      # is there extra metadata available?
     my %extrametadata;               # maps from filespec to extra metadata keys
+    my %extrametafile;               # maps from filespec to the metadata.xml (or similar) file it came from
     my @extrametakeys;               # keys of %extrametadata in order read
 
@@ -411,6 +414,8 @@
 	    my $extrakeys_re  = $ek->{'re'};
 	    my $extrakeys_md  = $ek->{'md'};
+	    my $extrakeys_mf  = $ek->{'mf'};
 	    push(@extrametakeys,$extrakeys_re);
 	    $extrametadata{$extrakeys_re} = $extrakeys_md;
+	    $extrametafile{$extrakeys_re} = $extrakeys_mf;
 	}
 	delete($self->{'subdir_extrametakeys'}->{$local_dirname});
@@ -437,4 +442,5 @@
 					  $file_subfile,$block_hash,
 					  \@extrametakeys, \%extrametadata,
+					  \%extrametafile,
 					  $processor, $maxdocs, $gli);
 	$additionalmetadata = 1;
@@ -455,8 +461,9 @@
 	if ($ek_non_re =~ m/$dirsep_re/) { # specifies at least one directory
 	    my $md = $extrametadata{$ek};
+	    my $mf = $extrametafile{$ek};
 
 	    my $subdir_extrametakeys = $self->{'subdir_extrametakeys'};
 
-	    my $subdir_rec = { 're' => $subdir_re, 'md' => $md };
+	    my $subdir_rec = { 're' => $subdir_re, 'md' => $md, 'mf' => $mf };
 
 	    # when its looked up, it must be relative to the base dir
@@ -562,11 +569,24 @@
 	# Next add metadata read in XML files (if it is supplied)
 	if ($additionalmetadata == 1) {
-	    my ($filespec, $mdref);
-	    foreach $filespec (@extrametakeys) {
+	    foreach my $filespec (@extrametakeys) {
 		## use the utf8 encoded filename to do the filename comparison
 		if ($tmpfile =~ /^$filespec$/) {
 		    print $outhandle "File \"$subfile\" matches filespec \"$filespec\"\n" 
 			if ($verbosity > 2);
-		    $mdref = $extrametadata{$filespec};
+		    my $mdref = $extrametadata{$filespec};
+		    my $mfref = $extrametafile{$filespec};
+
+		    # Add the list files where the metadata came from
+		    # into the metadata table so we can track this
+		    # This mechanism is similar to how gsdlassocfile works
+
+		    my @metafile_pair = ();
+		    foreach my $l (keys %$mfref) {
+			my $f = $mfref->{$l};
+			push (@metafile_pair, "$f:$l");
+		    }
+
+		    $mdref->{'gsdlmetafile'} = \@metafile_pair;
+
 		    &metadatautil::combine_metadata_structures($out_metadata, $mdref);
 		}
@@ -583,9 +603,6 @@
 
 
-		my $inf_timestamp = $self->{'inf_timestamp'};
-
 		if (! -d $full_filename) {
-		    my $filename_timestamp = -M $full_filename;
-		    if ($filename_timestamp > $inf_timestamp) {
+		    if (!$block_hash->{'reindex_files'}->{$full_filename}) {
 			# filename has been around for longer than inf
 			print $outhandle "**** Skipping $subfile\n" if ($verbosity >3);
@@ -602,5 +619,4 @@
 			# mark to doc-oids that rely on it for re-indexing
 			## &GDBMUtils::gdbmDatabase();
-
 		    }
 		}
Index: /gsdl/trunk/perllib/plugins/LOMPlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/LOMPlugin.pm	(revision 19492)
+++ /gsdl/trunk/perllib/plugins/LOMPlugin.pm	(revision 19493)
@@ -118,5 +118,7 @@
 sub metadata_read {
     my $self = shift (@_);
-    my ($pluginfo, $base_dir, $file, $block_hash, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, 
+	$extrametakeys, $extrametadata, $extrametafile,
+	$processor, $maxdocs, $gli) = @_;
 
     my $outhandle = $self->{'outhandle'};
Index: /gsdl/trunk/perllib/plugins/MetadataCSVPlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/MetadataCSVPlugin.pm	(revision 19492)
+++ /gsdl/trunk/perllib/plugins/MetadataCSVPlugin.pm	(revision 19493)
@@ -79,5 +79,7 @@
 {
     my $self = shift (@_);
-    my ($pluginfo, $base_dir, $file, $block_hash, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, 
+	$extrametakeys, $extrametadata, $extrametafile,
+	$processor, $maxdocs, $gli) = @_;
 
     # Read metadata from CSV files
Index: /gsdl/trunk/perllib/plugins/MetadataEXIFPlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/MetadataEXIFPlugin.pm	(revision 19492)
+++ /gsdl/trunk/perllib/plugins/MetadataEXIFPlugin.pm	(revision 19493)
@@ -168,5 +168,7 @@
 {
   my $self = shift (@_);
-  my ($pluginfo, $base_dir, $file, $block_hash, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli) = @_;
+  my ($pluginfo, $base_dir, $file, $block_hash, 
+      $extrametakeys, $extrametadata, $extrametafile,
+      $processor, $maxdocs, $gli) = @_;
   
 
Index: /gsdl/trunk/perllib/plugins/MetadataXMLPlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/MetadataXMLPlugin.pm	(revision 19492)
+++ /gsdl/trunk/perllib/plugins/MetadataXMLPlugin.pm	(revision 19493)
@@ -167,6 +167,7 @@
 {
     my $self = shift (@_);
-    my ($pluginfo, $base_dir, $file, $block_hash, $extrametakeys, $extrametadata,
-$processor, $maxdocs, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, 
+	$extrametakeys, $extrametadata,$extrametafile,
+	$processor, $maxdocs, $gli) = @_;
 
     my $filename = &util::filename_cat($base_dir, $file);
@@ -174,4 +175,7 @@
         return undef;
     }
+
+    $self->{'metadata-file'} = $file;
+    $self->{'metadata-filename'} = $filename;
 
     my $outhandle = $self->{'outhandle'};
@@ -182,4 +186,5 @@
     $block_hash->{'file_blocks'}->{$filename} = 1;
     $self->{'metadataref'} = $extrametadata;
+    $self->{'metafileref'} = $extrametafile;
     $self->{'metakeysref'} = $extrametakeys;
     
@@ -236,4 +241,5 @@
 	    my $file_metadata = $self->{'metadataref'}->{$target};
 	    my $saved_metadata = $self->{'saved_metadata'};
+
 	    if (!defined $file_metadata) {
 		$self->{'metadataref'}->{$target} = $saved_metadata;
@@ -245,4 +251,16 @@
 		&metadatautil::combine_metadata_structures($file_metadata,$saved_metadata);
 	    }
+
+	    
+	    # now record which metadata.xml file it came from
+
+	    my $file = $self->{'metadata-file'};
+	    my $filename = $self->{'metadata-filename'};
+
+	    if (!defined $self->{'metafileref'}->{$target}) {
+		$self->{'metafileref'}->{$target} = {};
+	    }
+
+	    $self->{'metafileref'}->{$target}->{$file} = $filename
 	}
     }
Index: /gsdl/trunk/perllib/plugins/OAIPlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/OAIPlugin.pm	(revision 19492)
+++ /gsdl/trunk/perllib/plugins/OAIPlugin.pm	(revision 19493)
@@ -183,5 +183,7 @@
     my $self = shift (@_);  
 
-    my ($pluginfo, $base_dir, $file, $block_hash, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, 
+	$extrametakeys, $extrametadata, $extrametafile,
+	$processor, $maxdocs, $gli) = @_;
 
     # can we process this file??
Index: /gsdl/trunk/perllib/plugins/PDFPlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/PDFPlugin.pm	(revision 19492)
+++ /gsdl/trunk/perllib/plugins/PDFPlugin.pm	(revision 19493)
@@ -148,4 +148,5 @@
 	    push(@$pagedimg_options, "-title_sub", '^(Page\s+\d+)?(\s*1\s+)?');
 	    push(@$pagedimg_options, "-screenviewsize", "1000");
+	    push(@$pagedimg_options, "-enable_cache");
 	}
     }
Index: /gsdl/trunk/perllib/plugins/SplitTextFile.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/SplitTextFile.pm	(revision 19492)
+++ /gsdl/trunk/perllib/plugins/SplitTextFile.pm	(revision 19493)
@@ -118,5 +118,7 @@
 sub metadata_read {
     my $self = shift (@_);  
-    my ($pluginfo, $base_dir, $file, $block_hash, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, 
+	$extrametakeys, $extrametadata, $extrametafile,
+	$processor, $maxdocs, $gli) = @_;
 
     # returns 1 if matches process_exp, and has done blocking in the meantime
@@ -124,6 +126,7 @@
 					      $block_hash, 
 					      $extrametakeys, 
-					      $extrametadata, $processor, 
-					      $maxdocs, $gli);
+					      $extrametadata, 
+					      $extrametafile,
+					      $processor, $maxdocs, $gli);
     my $split_matched = undef;
 
