/[Grep]/bin/import.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /bin/import.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 155 - (show annotations)
Sun Jun 10 19:20:59 2007 UTC (16 years, 10 months ago) by dpavlin
File MIME type: text/plain
File size: 1049 byte(s)
hush debugging, Import plugin now returns stats for better reporting
1 #!/usr/bin/perl
2
3 # helper script to import external data sources into local index and full text index
4
5 use strict;
6
7 use lib 'lib';
8
9 use Jifty;
10 use Grep::Search;
11 use Module::Pluggable search_path => 'Grep::Import', sub_name => 'importers', require => 1;
12 use Data::Dump qw/dump/;
13
14 $|=1;
15
16 BEGIN { Jifty->new; };
17
18 my @importers = __PACKAGE__->importers();
19
20 Jifty->log->debug("Found import plugins: ", join(", ", @importers) );
21
22 my $system_user = Grep::CurrentUser->superuser;
23 my $search = Grep::Search->new();
24
25 foreach my $importer ( @importers ) {
26
27 if ( $importer->can('import') ) {
28 Jifty->log->info("importing with $importer");
29
30 my $stats = $importer->import( $search );
31
32 Jifty->log->info(
33 ( $stats->{new} ? $stats->{new} . ' new' : '' ) .
34 ( $stats->{old} ? $stats->{old} . ' old' : '' ) .
35 ( $stats->{failure} ? ' with ' . $stats->{failure} . ' failures' : '' ) .
36 ' of total ' . $stats->{total} . ' pages with ' . $importer
37 );
38 } else {
39 Jifty->log->error("importer $importer doesn't implement import");
40 }
41 }
42
43 $search->finish;
44
45

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26