Skip to content

Commit

Permalink
fix bug tickled by combi of non-standard GeoIP.dat and Geo::IP
Browse files Browse the repository at this point in the history
  • Loading branch information
Rory McNicholl committed Dec 26, 2015
1 parent da63f93 commit a84f22b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/plugins/EPrints/Plugin/Stats/Processor/Access/Country.pm
Expand Up @@ -29,11 +29,16 @@ sub new
$dat_file = 1 if( !-e $dat_file );

#Test Geo::IP first - it's faster!
#RM: If dat_file is not the global one and Geo::IP is available, then we need to call open($dat_file) not new($dat_file)
foreach my $pkg ( 'Geo::IP', 'Geo::IP::PurePerl' )
{
if( EPrints::Utils::require_if_exists( $pkg ) )
{
$self->{geoip} = $pkg->new( $dat_file );
if($pkg !~ /PurePerl/){
$self->{geoip} = $pkg->open( $dat_file, GEOIP_MEMORY_CACHE);
}else{
$self->{geoip} = $pkg->new( $dat_file );
}
last if( defined $self->{geoip} );
}
}
Expand Down

0 comments on commit a84f22b

Please sign in to comment.