source: gs2-extensions/parallel-building/trunk/src/perllib/plugins/DirectoryPlugin.pm@ 27496

Last change on this file since 27496 was 27496, checked in by jmt12, 11 years ago

Replacing a smelly old util::file_exists() with a snazzy new FileUtils::fileExists()

  • Property svn:executable set to *
File size: 21.9 KB
Line 
1###########################################################################
2#
3# DirectoryPlugin.pm --
4# A component of the Greenstone digital library software
5# from the New Zealand Digital Library Project at the
6# University of Waikato, New Zealand.
7#
8# Copyright (C) 1999 New Zealand Digital Library Project
9#
10# This program is free software; you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation; either version 2 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with this program; if not, write to the Free Software
22# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23#
24###########################################################################
25
26# DirectoryPlugin is a plugin which recurses through directories processing
27# each file it finds - which basically means passing it down the plugin
28# pipeline
29
30package DirectoryPlugin;
31
32use extrametautil;
33use PrintInfo;
34use plugin;
35use util;
36use metadatautil;
37
38use File::Basename;
39use strict;
40no strict 'refs';
41no strict 'subs';
42
43use Encode;
44
45BEGIN {
46 @DirectoryPlugin::ISA = ('PrintInfo');
47}
48
49my $arguments =
50 [ { 'name' => "block_exp",
51 'desc' => "{BasePlugin.block_exp}",
52 'type' => "regexp",
53 'deft' => &get_default_block_exp(),
54 'reqd' => "no" },
55 # this option has been deprecated. leave it here for now so we can warn people not to use it
56 { 'name' => "use_metadata_files",
57 'desc' => "{DirectoryPlugin.use_metadata_files}",
58 'type' => "flag",
59 'reqd' => "no",
60 'hiddengli' => "yes" },
61 { 'name' => "recheck_directories",
62 'desc' => "{DirectoryPlugin.recheck_directories}",
63 'type' => "flag",
64 'reqd' => "no" } ];
65
66my $options = { 'name' => "DirectoryPlugin",
67 'desc' => "{DirectoryPlugin.desc}",
68 'abstract' => "no",
69 'inherits' => "yes",
70 'args' => $arguments };
71
72sub new {
73 my ($class) = shift (@_);
74 my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
75 push(@$pluginlist, $class);
76
77 push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});
78 push(@{$hashArgOptLists->{"OptList"}},$options);
79
80 my $self = new PrintInfo($pluginlist, $inputargs, $hashArgOptLists);
81
82 if ($self->{'info_only'}) {
83 # don't worry about any options or initialisations etc
84 return bless $self, $class;
85 }
86
87 # we have left this option in so we can warn people who are still using it
88 if ($self->{'use_metadata_files'}) {
89 die "ERROR: DirectoryPlugin -use_metadata_files option has been deprecated. Please remove the option and add MetadataXMLPlug to your plugin list instead!\n";
90 }
91
92 $self->{'num_processed'} = 0;
93 $self->{'num_not_processed'} = 0;
94 $self->{'num_blocked'} = 0;
95 $self->{'num_archives'} = 0;
96
97 $self->{'subdir_extrametakeys'} = {};
98
99 return bless $self, $class;
100}
101
102# called once, at the start of processing
103sub init {
104 my $self = shift (@_);
105 my ($verbosity, $outhandle, $failhandle) = @_;
106
107 # verbosity is passed through from the processor
108 $self->{'verbosity'} = $verbosity;
109
110 # as are the outhandle and failhandle
111 $self->{'outhandle'} = $outhandle if defined $outhandle;
112 $self->{'failhandle'} = $failhandle;
113
114}
115
116# called once, after all passes have finished
117sub deinit {
118 my ($self) = @_;
119
120}
121
122# called at the beginning of each plugin pass (import has one, building has many)
123sub begin {
124 my $self = shift (@_);
125 my ($pluginfo, $base_dir, $processor, $maxdocs) = @_;
126
127 # Only lookup timestamp info for import.pl, and only if incremental is set
128 my $proc_package_name = ref $processor;
129 if ($proc_package_name !~ /buildproc$/ && $self->{'incremental'} == 1) {
130 # Get the infodbtype value for this collection from the arcinfo object
131 my $infodbtype = $processor->getoutputinfo()->{'infodbtype'};
132 $infodbtype = "gdbm" if $infodbtype eq "gdbm-txtgz"; # in archives, cannot use txtgz version
133 my $output_dir = $processor->getoutputdir();
134 my $archives_inf = &dbutil::get_infodb_file_path($infodbtype, "archiveinf-doc", $output_dir);
135
136 if ( &FileUtils::fileExists($archives_inf) ) {
137 $self->{'inf_timestamp'} = &util::file_lastmodified($archives_inf);
138 }
139 }
140}
141
142sub remove_all {
143 my $self = shift (@_);
144 my ($pluginfo, $base_dir, $processor, $maxdocs) = @_;
145}
146
147
148sub remove_one {
149 my $self = shift (@_);
150 my ($file, $oids, $archivedir) = @_;
151 return undef; # this will never be called for directories (will it??)
152
153}
154
155
156# called at the end of each plugin pass
157sub end {
158 my ($self) = shift (@_);
159
160}
161
162
163
164# return 1 if this class might recurse using $pluginfo
165sub is_recursive {
166 my $self = shift (@_);
167
168 return 1;
169}
170
171sub get_default_block_exp {
172 my $self = shift (@_);
173
174 return '(?i)(CVS|\.svn|Thumbs\.db|OIDcount|~)$';
175}
176
177sub check_directory_path {
178
179 my $self = shift(@_);
180 my ($dirname) = @_;
181
182 # replace -d with function in util library
183 return undef unless (&FileUtils::directoryExists($dirname));
184
185 return 0 if ($self->{'block_exp'} ne "" && $dirname =~ /$self->{'block_exp'}/);
186
187 my $outhandle = $self->{'outhandle'};
188
189 # check to make sure we're not reading the archives or index directory
190 my $gsdlhome = quotemeta($ENV{'GSDLHOME'});
191 if ($dirname =~ m/^$gsdlhome\/.*?\/import.*?\/(archives|index)$/) {
192 print $outhandle "DirectoryPlugin: $dirname appears to be a reference to a Greenstone collection, skipping.\n";
193 return 0;
194 }
195
196 # check to see we haven't got a cyclic path...
197 if ($dirname =~ m%(/.*){,41}%) {
198 print $outhandle "DirectoryPlugin: $dirname is 40 directories deep, is this a recursive path? if not increase constant in DirectoryPlugin.pm.\n";
199 return 0;
200 }
201
202 # check to see we haven't got a cyclic path...
203 if ($dirname =~ m%.*?import/(.+?)/import/\1.*%) {
204 print $outhandle "DirectoryPlugin: $dirname appears to be in a recursive loop...\n";
205 return 0;
206 }
207
208 return 1;
209}
210
211# this may be called more than once
212sub sort_out_associated_files {
213
214 my $self = shift (@_);
215 my ($block_hash) = @_;
216 if (!scalar (keys %{$block_hash->{'shared_fileroot'}})) {
217 return;
218 }
219
220 $self->{'assocfile_info'} = {} unless defined $self->{'assocfile_info'};
221 my $metadata = $self->{'assocfile_info'};
222 foreach my $prefix (keys %{$block_hash->{'shared_fileroot'}}) {
223 my $record = $block_hash->{'shared_fileroot'}->{$prefix};
224
225 my $tie_to = $record->{'tie_to'};
226 my $exts = $record->{'exts'};
227
228 if ((defined $tie_to) && (scalar (keys %$exts) > 0)) {
229 # set up fileblocks and assocfile_tobe
230 my $base_file = "$prefix$tie_to";
231 $metadata->{$base_file} = {} unless defined $metadata->{$base_file};
232 my $base_file_metadata = $metadata->{$base_file};
233
234 $base_file_metadata->{'gsdlassocfile_tobe'} = [] unless defined $base_file_metadata->{'gsdlassocfile_tobe'};
235 my $assoc_tobe = $base_file_metadata->{'gsdlassocfile_tobe'};
236 foreach my $e (keys %$exts) {
237 # block the file
238 &util::block_filename($block_hash,"$prefix$e");
239 # set up as an associatd file
240 print STDERR " $self->{'plugin_type'}: Associating $prefix$e with $tie_to version\n";
241 my $mime_type = ""; # let system auto detect this
242 push(@$assoc_tobe,"$prefix$e:$mime_type:");
243
244 }
245 }
246 } # foreach record
247
248 $block_hash->{'shared_fileroot'} = undef;
249 $block_hash->{'shared_fileroot'} = {};
250
251}
252
253
254# do block exp OR special blocking ???
255
256sub file_is_blocked {
257 my $self = shift (@_);
258 my ($block_hash, $filename_full_path) = @_;
259
260 $filename_full_path = &util::upgrade_if_dos_filename($filename_full_path);
261### print STDERR "*** DirectoryPlugin::file_is_blocked $filename_full_path\n";
262
263 if ($ENV{'GSDLOS'} =~ m/^windows$/) {
264 # on windows, all block paths are lowercased.
265 my $lower_filename = lc ($filename_full_path);
266 if (defined $block_hash->{'file_blocks'}->{$lower_filename}) {
267 $self->{'num_blocked'} ++;
268 return 1;
269 }
270 }
271 else {
272 if (defined $block_hash->{'file_blocks'}->{$filename_full_path}) {
273 $self->{'num_blocked'} ++;
274 return 1;
275 }
276 }
277 # check Directory plugin's own block_exp
278 if ($self->{'block_exp'} ne "" && $filename_full_path =~ /$self->{'block_exp'}/) {
279 $self->{'num_blocked'} ++;
280 return 1; # blocked
281 }
282 return 0;
283}
284
285
286
287sub file_block_read {
288 my $self = shift (@_);
289 my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $gli) = @_;
290
291 my $outhandle = $self->{'outhandle'};
292 my $verbosity = $self->{'verbosity'};
293
294 # Calculate the directory name and ensure it is a directory and
295 # that it is not explicitly blocked.
296 my $dirname = $file;
297 $dirname = &util::filename_cat ($base_dir, $file) if $base_dir =~ /\w/;
298
299 my $directory_ok = $self->check_directory_path($dirname);
300 return $directory_ok unless (defined $directory_ok && $directory_ok == 1);
301
302 print $outhandle "File scan checking directory: $dirname\n";
303
304 $block_hash->{'all_files'} = {} unless defined $block_hash->{'all_files'};
305 $block_hash->{'metadata_files'} = {} unless defined $block_hash->{'metadata_files'};
306
307 $block_hash->{'file_blocks'} = {} unless defined $block_hash->{'file_blocks'};
308 $block_hash->{'shared_fileroot'} = {} unless defined $block_hash->{'shared_fileroot'};
309
310 # Recur over directory contents.
311 print $outhandle "DirectoryPlugin block: getting directory $dirname\n" if ($verbosity > 2);
312
313 # find all the files in the directory
314 my @dir = @{&FileUtils::readDirectory($dirname)};
315 if (scalar(@dir) == 0)
316 {
317 if ($gli)
318 {
319 print STDERR "<ProcessingError n='$file' r='Could not read directory $dirname'>\n";
320 }
321 print $outhandle "DirectoryPlugin: WARNING - couldn't read directory $dirname\n";
322 return -1; # error in processing
323 }
324
325 for (my $i = 0; $i < scalar(@dir); $i++) {
326 my $raw_subfile = $dir[$i];
327 next if ($raw_subfile =~ m/^\.\.?$/);
328
329 my $this_file_base_dir = $base_dir;
330 my $raw_file_subfile = &util::filename_cat($file, $raw_subfile);
331
332 # Recursively read each $raw_subfile
333 print $outhandle "DirectoryPlugin block recurring: $raw_file_subfile\n" if ($verbosity > 2);
334
335 #$count += &plugin::file_block_read ($pluginfo, $this_file_base_dir,
336
337 &plugin::file_block_read ($pluginfo, $this_file_base_dir,
338 $raw_file_subfile,
339 $block_hash, $metadata, $gli);
340
341 }
342 $self->sort_out_associated_files($block_hash);
343 #return $count;
344 return 1;
345
346}
347
348# We don't do metadata_read
349sub metadata_read {
350 my $self = shift (@_);
351 my ($pluginfo, $base_dir, $file, $block_hash,
352 $extrametakeys, $extrametadata, $extrametafile,
353 $processor, $gli, $aux) = @_;
354
355 return undef;
356}
357
358
359# return number of files processed, undef if can't process
360# Note that $base_dir might be "" and that $file might
361# include directories
362
363# This function passes around metadata hash structures. Metadata hash
364# structures are hashes that map from a (scalar) key (the metadata element
365# name) to either a scalar metadata value or a reference to an array of
366# such values.
367
368sub read {
369 my $self = shift (@_);
370 my ($pluginfo, $base_dir, $file, $block_hash, $in_metadata, $processor, $maxdocs, $total_count, $gli) = @_;
371
372 my $outhandle = $self->{'outhandle'};
373 my $verbosity = $self->{'verbosity'};
374
375 # Calculate the directory name and ensure it is a directory and
376 # that it is not explicitly blocked.
377 my $dirname;
378 if ($file eq "") {
379 $dirname = $base_dir;
380 } else {
381 $dirname = $file;
382 $dirname = &util::filename_cat ($base_dir, $file) if $base_dir =~ /\w/;
383 }
384
385 my $directory_ok = $self->check_directory_path($dirname);
386 return $directory_ok unless (defined $directory_ok && $directory_ok == 1);
387
388 if (($verbosity > 2) && ((scalar keys %$in_metadata) > 0)) {
389 print $outhandle "DirectoryPlugin: metadata passed in: ",
390 join(", ", keys %$in_metadata), "\n";
391 }
392
393
394 # Recur over directory contents.
395 print $outhandle "DirectoryPlugin read: getting directory $dirname\n" if ($verbosity > 2);
396
397 # find all the files in the directory
398 my @dir = @{&FileUtils::readDirectory($dirname)};
399 if (scalar(@dir) == 0)
400 {
401 if ($gli)
402 {
403 print STDERR "<ProcessingError n='$file' r='Could not read directory $dirname'>\n";
404 }
405 print $outhandle "DirectoryPlugin: WARNING - couldn't read directory $dirname\n";
406 return -1; # error in processing
407 }
408 map { $_ = &unicode::raw_filename_to_url_encoded($_) } @dir;
409
410 # Re-order the files in the list so any directories ending with .all are
411 # moved to the end
412 for (my $i = scalar(@dir) - 1; $i >= 0; $i--) {
413 if (-d &util::filename_cat($dirname, $dir[$i]) && $dir[$i] =~ /\.all$/) {
414 push(@dir, splice(@dir, $i, 1));
415 }
416 }
417
418 # setup the metadata structures. we do a metadata_read pass to see if there is any additional metadata, then pass it to read
419
420 my $additionalmetadata = 0; # is there extra metadata available?
421 my %extrametadata; # maps from filespec to extra metadata keys
422 my %extrametafile; # maps from filespec to the metadata.xml (or similar) file it came from
423 my @extrametakeys; # keys of %extrametadata in order read
424
425
426 my $os_dirsep = &util::get_os_dirsep();
427 my $dirsep = &util::get_dirsep();
428 my $base_dir_regexp = $base_dir;
429 $base_dir_regexp =~ s/\//$os_dirsep/g;
430
431 # Want to get relative path of local_dirname within the base_directory
432 # but with URL style slashes.
433 my $local_dirname = &util::filename_within_directory_url_format($dirname, $base_dir);
434
435 # if we are in import folder, then local_dirname will be empty
436 if ($local_dirname ne "") {
437 # look for extra metadata passed down from higher folders
438 $local_dirname .= "/"; # closing slash must be URL type slash also and not $dirsep;
439 if (defined $self->{'subdir_extrametakeys'}->{$local_dirname}) {
440 my $extrakeys = $self->{'subdir_extrametakeys'}->{$local_dirname};
441 foreach my $ek (@$extrakeys) {
442 my $extrakeys_re = $ek->{'re'};
443 my $extrakeys_md = $ek->{'md'};
444 my $extrakeys_mf = $ek->{'mf'};
445 &extrametautil::addmetakey(\@extrametakeys, $extrakeys_re);
446 &extrametautil::setmetadata(\%extrametadata, $extrakeys_re, $extrakeys_md);
447 &extrametautil::setmetafile(\%extrametafile, $extrakeys_re, $extrakeys_mf);
448 }
449 delete($self->{'subdir_extrametakeys'}->{$local_dirname});
450 }
451 }
452 # apply metadata pass for each of the files in the directory -- ignore
453 # maxdocs here
454 my $num_files = scalar(@dir);
455 for (my $i = 0; $i < scalar(@dir); $i++) {
456 my $subfile = $dir[$i];
457 next if ($subfile =~ m/^\.\.?$/);
458
459 my $this_file_base_dir = $base_dir;
460 my $raw_subfile = &unicode::url_encoded_to_raw_filename($subfile);
461
462 my $raw_file_subfile = &util::filename_cat($file, $raw_subfile);
463 my $raw_full_filename = &util::filename_cat($this_file_base_dir, $raw_file_subfile);
464
465 if ($self->file_is_blocked($block_hash,$raw_full_filename)) {
466 print STDERR "DirectoryPlugin: file $raw_full_filename was blocked for metadata_read\n" if ($verbosity > 2);
467 next;
468 }
469
470 # Recursively read each $raw_subfile
471 print $outhandle "DirectoryPlugin metadata recurring: $raw_subfile\n" if ($verbosity > 2);
472
473 &plugin::metadata_read ($pluginfo, $this_file_base_dir,
474 $raw_file_subfile,$block_hash,
475 \@extrametakeys, \%extrametadata,
476 \%extrametafile,
477 $processor, $gli);
478 $additionalmetadata = 1;
479 }
480
481 # filter out any extrametakeys that mention subdirectories and store
482 # for later use (i.e. when that sub-directory is being processed)
483 foreach my $ek (@extrametakeys) { # where each Extrametakey (which is a filename) is stored as a url-style regex
484
485 my ($subdir_re,$extrakey_dir) = &util::url_fileparse($ek);
486
487 if ($extrakey_dir ne "") {
488 # a subdir was specified
489 my $md = &extrametautil::getmetadata(\%extrametadata, $ek);
490 my $mf = &extrametautil::getmetafile(\%extrametafile, $ek);
491
492 my $subdir_extrametakeys = $self->{'subdir_extrametakeys'};
493 my $subdir_rec = { 're' => $subdir_re, 'md' => $md, 'mf' => $mf };
494
495 # when it's looked up, it must be relative to the base dir
496 push(@{$subdir_extrametakeys->{"$local_dirname$extrakey_dir"}},$subdir_rec);
497 }
498 }
499
500 # import each of the files in the directory
501 my $count=0;
502 for (my $i = 0; $i <= scalar(@dir); $i++) {
503 # When every file in the directory has been done, pause for a moment (figuratively!)
504 # If the -recheck_directories argument hasn't been provided, stop now (default)
505 # Otherwise, re-read the contents of the directory to check for new files
506 # Any new files are added to the @dir list and are processed as normal
507 # This is necessary when documents to be indexed are specified in bibliographic DBs
508 # These files are copied/downloaded and stored in a new folder at import time
509 if ($i == $num_files) {
510 last unless $self->{'recheck_directories'};
511
512 # Re-read the files in the directory to see if there are any new files
513 last if (!opendir (DIR, $dirname));
514 my @dirnow = readdir (DIR);
515 map { $_ = &unicode::raw_filename_to_url_encoded($_) } @dirnow;
516 closedir (DIR);
517
518 # We're only interested if there are more files than there were before
519 last if (scalar(@dirnow) <= scalar(@dir));
520
521 # Any new files are added to the end of @dir to get processed by the loop
522 my $j;
523 foreach my $subfilenow (@dirnow) {
524 for ($j = 0; $j < $num_files; $j++) {
525 last if ($subfilenow eq $dir[$j]);
526 }
527 if ($j == $num_files) {
528 # New file
529 push(@dir, $subfilenow);
530 }
531 }
532 # When the new files have been processed, check again
533 $num_files = scalar(@dir);
534 }
535
536 my $subfile = $dir[$i];
537 last if ($maxdocs != -1 && ($count + $total_count) >= $maxdocs);
538 next if ($subfile =~ /^\.\.?$/);
539
540 my $this_file_base_dir = $base_dir;
541 my $raw_subfile = &unicode::url_encoded_to_raw_filename($subfile);
542
543 my $raw_file_subfile = &util::filename_cat($file, $raw_subfile);
544 my $raw_full_filename
545 = &util::filename_cat($this_file_base_dir,$raw_file_subfile);
546
547 if ($self->file_is_blocked($block_hash,$raw_full_filename)) {
548 print STDERR "DirectoryPlugin: file $raw_full_filename was blocked for read\n" if ($verbosity > 2);
549 next;
550 }
551 #print STDERR "processing $raw_full_filename\n";
552 # Follow Windows shortcuts
553 if ($raw_subfile =~ /(?i)\.lnk$/ && $ENV{'GSDLOS'} =~ /^windows$/i) {
554 require Win32::Shortcut;
555 my $shortcut = new Win32::Shortcut(&util::filename_cat($dirname, $raw_subfile));
556 if ($shortcut) {
557 # The file to be processed is now the target of the shortcut
558 $this_file_base_dir = "";
559 $file = "";
560 $raw_subfile = $shortcut->Path;
561 }
562 }
563
564 # check for a symlink pointing back to a leading directory
565 if (-d "$dirname/$raw_subfile" && -l "$dirname/$raw_subfile") {
566 # readlink gives a "fatal error" on systems that don't implement
567 # symlinks. This assumes the the -l test above would fail on those.
568 my $linkdest=readlink "$dirname/$raw_subfile";
569 if (!defined ($linkdest)) {
570 # system error - file not found?
571 warn "DirectoryPlugin: symlink problem - $!";
572 } else {
573 # see if link points to current or a parent directory
574 if ($linkdest =~ m@^[\./\\]+$@ ||
575 index($dirname, $linkdest) != -1) {
576 warn "DirectoryPlugin: Ignoring recursive symlink ($dirname/$raw_subfile -> $linkdest)\n";
577 next;
578 ;
579 }
580 }
581 }
582
583 print $outhandle "DirectoryPlugin: preparing metadata for $raw_subfile\n" if ($verbosity > 2);
584
585 # Make a copy of $in_metadata to pass to $raw_subfile
586 my $out_metadata = {};
587 &metadatautil::combine_metadata_structures($out_metadata, $in_metadata);
588
589 # check the assocfile_info
590 if (defined $self->{'assocfile_info'}->{$raw_full_filename}) {
591 &metadatautil::combine_metadata_structures($out_metadata, $self->{'assocfile_info'}->{$raw_full_filename});
592 }
593
594 # $subfile by this point is url-encoded => all ASCII chars => no need to encode as UTF8
595
596 # Next add metadata read in XML files (if it is supplied)
597 if ($additionalmetadata == 1) {
598 foreach my $filespec (@extrametakeys) {
599 ## use the url-encoded filename to do the filename comparison
600
601 if ($subfile =~ /^$filespec$/) {
602 print $outhandle "File \"$subfile\" matches filespec \"$filespec\"\n"
603 if ($verbosity > 2);
604 my $mdref = &extrametautil::getmetadata(\%extrametadata, $filespec);
605 my $mfref = &extrametautil::getmetafile(\%extrametafile, $filespec);
606
607 # Add the list files where the metadata came from
608 # into the metadata table so we can track this
609 # This mechanism is similar to how gsdlassocfile works
610
611 my @metafile_pair = ();
612 foreach my $l (keys %$mfref) {
613 my $f = $mfref->{$l};
614 push (@metafile_pair, "$f : $l");
615 }
616
617 $mdref->{'gsdlmetafile'} = \@metafile_pair;
618
619 &metadatautil::combine_metadata_structures($out_metadata, $mdref);
620 }
621 }
622 }
623
624 if (defined $self->{'inf_timestamp'}) {
625 # Look to see if it's a completely new file
626 if (!$block_hash->{'new_files'}->{$raw_full_filename}) {
627 # Not a new file, must be an existing file
628 # Let' see if it's newer than the last import.pl
629 if (! &util::dir_exists($raw_full_filename)) {
630 if (!$block_hash->{'reindex_files'}->{$raw_full_filename}) {
631 # filename has been around for longer than inf_timestamp
632 print $outhandle "**** Skipping $subfile\n" if ($verbosity >3);
633 next;
634 }
635 else {
636 # Remove old folder in archives (might hash to something different)
637 # *** should be doing this on a Del one as well
638 # but leave folder name?? and ensure hashs to
639 # same again??
640
641 # Then let through as new doc??
642
643 # mark to doc-oids that rely on it for re-indexing
644 }
645 }
646 }
647 }
648
649 # Recursively read each $subfile
650 print $outhandle "DirectoryPlugin recurring: $subfile\n" if ($verbosity > 2);
651
652 $count += &plugin::read ($pluginfo, $this_file_base_dir,
653 $raw_file_subfile, $block_hash,
654 $out_metadata, $processor, $maxdocs, ($total_count + $count), $gli);
655 }
656
657 return $count;
658}
659
660sub compile_stats {
661 my $self = shift(@_);
662 my ($stats) = @_;
663}
664
6651;
Note: See TracBrowser for help on using the repository browser.