We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2fcc1e0 commit cd9d7b2Copy full SHA for cd9d7b2
Model/IpToCountryRepository.php
@@ -48,9 +48,11 @@ public function __construct(
48
public function getCountryCode($ip)
49
{
50
if (!isset($this->ipToCountry[$ip])) {
51
+ $this->ipToCountry[$ip] = false;
52
if (function_exists('geoip_country_code_by_name')) {
53
$this->ipToCountry[$ip] = geoip_country_code_by_name($ip);
- } else {
54
+ }
55
+ if (!$this->ipToCountry[$ip]) {
56
$longIp = ip2long($ip);
57
$collection = $this->ipToCountryCollectionFactory->create();
58
$collection->addFielToFilter('ip_from', ["gteq" => $longIp])
@@ -74,4 +76,4 @@ public function getVisitorCountryCode()
74
76
$this->remoteAddress->getRemoteAddress()
75
77
);
78
}
-}
79
+}
0 commit comments