diff options
Diffstat (limited to 'plugins/UserCountry/Diagnostic/GeolocationDiagnostic.php')
-rw-r--r-- | plugins/UserCountry/Diagnostic/GeolocationDiagnostic.php | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/plugins/UserCountry/Diagnostic/GeolocationDiagnostic.php b/plugins/UserCountry/Diagnostic/GeolocationDiagnostic.php index 5a7ce0a69a..fa6497c199 100644 --- a/plugins/UserCountry/Diagnostic/GeolocationDiagnostic.php +++ b/plugins/UserCountry/Diagnostic/GeolocationDiagnostic.php @@ -8,8 +8,10 @@ namespace Piwik\Plugins\UserCountry\Diagnostic; use Piwik\Config; +use Piwik\Plugin\Manager; use Piwik\Plugins\Diagnostics\Diagnostic\Diagnostic; use Piwik\Plugins\Diagnostics\Diagnostic\DiagnosticResult; +use Piwik\Plugins\GeoIp2\LocationProvider\GeoIp2; use Piwik\Plugins\UserCountry\LocationProvider; use Piwik\Translation\Translator; @@ -40,16 +42,20 @@ class GeolocationDiagnostic implements Diagnostic $currentProviderId = LocationProvider::getCurrentProviderId(); $allProviders = LocationProvider::getAllProviderInfo(); - $isRecommendedProvider = in_array($currentProviderId, array(LocationProvider\GeoIp\Php::ID, $currentProviderId == LocationProvider\GeoIp\Pecl::ID)); + $isNotRecommendedProvider = in_array($currentProviderId, array( + LocationProvider\DefaultProvider::ID, + LocationProvider\GeoIp\ServerBased::ID, + GeoIp2\ServerModule::ID)); $isProviderInstalled = (isset($allProviders[$currentProviderId]['status']) && $allProviders[$currentProviderId]['status'] == LocationProvider::INSTALLED); - if ($isRecommendedProvider && $isProviderInstalled) { + if (!$isNotRecommendedProvider && $isProviderInstalled) { return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK)); } if ($isProviderInstalled) { $comment = $this->translator->translate('UserCountry_GeoIpLocationProviderNotRecomnended') . ' '; - $comment .= $this->translator->translate('UserCountry_GeoIpLocationProviderDesc_ServerBased2', array( + $message = Manager::getInstance()->isPluginActivated('GeoIp2') ? 'GeoIp2_LocationProviderDesc_ServerModule2' : 'UserCountry_GeoIpLocationProviderDesc_ServerBased2'; + $comment .= $this->translator->translate($message, array( '<a href="https://matomo.org/docs/geo-locate/" rel="noreferrer" target="_blank">', '', '', '</a>' )); } else { |