| 1 | package OpenInteract2::Setup::RequireIndexers; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | # $Id: RequireIndexers.pm,v 1.2 2005/03/18 04:09:51 lachoy Exp $ | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 87 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 87 | ▶ | use base qw( OpenInteract2::Setup::RequireClasses ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 87 | ▶ | use Log::Log4perl qw( get_logger ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 87 | ▶ | use OpenInteract2::Constants qw( :log ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 87 | ▶ | use OpenInteract2::Exception qw( oi_error ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 87 | $OpenInteract2::Setup::RequireIndexers::VERSION = sprintf("%d.%02d", q$Revision: 1.2 $ =~ /(\d+)\.(\d+)/); | |||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 87 | my ( $log ); | |||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 87 | ▶ | sub get_name { | ||||||||||||||||||
|
Subroutine
get_name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 16 | 87 | return 'require indexers'; | |||||||||||||||||||
| 17 | } | ||||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | 1 | ▶ | sub get_dependencies { | ||||||||||||||||||
|
Subroutine
get_dependencies: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 20 | 1 | return ( 'create templib' ); | |||||||||||||||||||
| 21 | } | ||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | 0 | ▶ | sub setup { | ||||||||||||||||||
|
Subroutine
setup: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||
| 24 | 0 | my ( $self, $ctx ) = @_; | |||||||||||||||||||
| 25 | 0 | ▶ | $log ||= get_logger( LOG_INIT ); | ||||||||||||||||||
|
Condition0%0/3
$log ||= get_logger("OI2.INITIALIZE")
MC/DC0%0/2
$log ||= get_logger("OI2.INITIALIZE")
$log
get_logger("OI2.INITIALIZE")
Truth table0%0/3
A ||= B
A= $logB= get_logger("OI2.INITIALIZE")
| |||||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | 0 | my $all_idx_config = $ctx->lookup_fulltext_config; | |||||||||||||||||||
| 28 | 0 | ▶ | unless ( ref $all_idx_config eq 'HASH' ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 29 | 0 | $log->warn( "Fulltext configuration does not return a ", | |||||||||||||||||||
| 30 | "hash reference; continuing with setup, but ", | ||||||||||||||||||||
| 31 | "this could bode poorly for server operation..." ); | ||||||||||||||||||||
| 32 | 0 | return; | |||||||||||||||||||
| 33 | } | ||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | 0 | my @indexer_classes = (); | |||||||||||||||||||
| 36 | 0 | ▶ | while ( my ( $idx_name, $idx_info ) = each %{ $all_idx_config } ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 37 | 0 | ▶ | next if ( $idx_name eq 'default' ); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 38 | 0 | my $idx_class = $idx_info->{class}; | |||||||||||||||||||
| 39 | 0 | ▶ | unless ( $idx_class ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 40 | 0 | $log->warn( "Indexer '$idx_name' is not associated with ", | |||||||||||||||||||
| 41 | "a class; continuing with setup, but this could ", | ||||||||||||||||||||
| 42 | "bode poorly for server operation..." ); | ||||||||||||||||||||
| 43 | } | ||||||||||||||||||||
| 44 | 0 | push @indexer_classes, $idx_class; | |||||||||||||||||||
| 45 | } | ||||||||||||||||||||
| 46 | 0 | $self->param( classes => \@indexer_classes ); | |||||||||||||||||||
| 47 | 0 | $self->param( classes_type => 'Full-text indexer classes' ); | |||||||||||||||||||
| 48 | } | ||||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | 87 | OpenInteract2::Setup->register_factory_type( get_name() => __PACKAGE__ ); | |||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | 87 | 1; | |||||||||||||||||||
| 53 | |||||||||||||||||||||
| 54 | __END__ | ||||||||||||||||||||