translator = $translator;
}
public function execute()
{
$isPiwikInstalling = !Config::getInstance()->existsLocalConfig();
if ($isPiwikInstalling) {
// Skip the diagnostic if Piwik is being installed
return array();
}
$label = $this->translator->translate('UserCountry_Geolocation');
$currentProviderId = LocationProvider::getCurrentProviderId();
$allProviders = LocationProvider::getAllProviderInfo();
$isRecommendedProvider = in_array($currentProviderId, array(LocationProvider\GeoIp\Php::ID, $currentProviderId == LocationProvider\GeoIp\Pecl::ID));
$isProviderInstalled = ($allProviders[$currentProviderId]['status'] == LocationProvider::INSTALLED);
if ($isRecommendedProvider && $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(
'', '', '', ''
));
} else {
$comment = $this->translator->translate('UserCountry_DefaultLocationProviderDesc1') . ' ';
$comment .= $this->translator->translate('UserCountry_DefaultLocationProviderDesc2', array(
'', '', '', ''
));
}
return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment));
}
}