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(); $isNotRecommendedProvider = in_array($currentProviderId, array( LocationProvider\DefaultProvider::ID, GeoIp2\ServerModule::ID)); $isProviderInstalled = (isset($allProviders[$currentProviderId]['status']) && $allProviders[$currentProviderId]['status'] == LocationProvider::INSTALLED); if (!$isNotRecommendedProvider && $isProviderInstalled) { return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK)); } if ($isProviderInstalled) { $comment = $this->translator->translate('GeoIp2_GeoIPLocationProviderNotRecommended') . ' '; $message = 'GeoIp2_LocationProviderDesc_ServerModule2'; $comment .= $this->translator->translate($message, array( '', '', '', '' )); } else { $comment = $this->translator->translate('UserCountry_DefaultLocationProviderDesc1') . ' '; $comment .= $this->translator->translate('UserCountry_DefaultLocationProviderDesc2', array( '', '', '', '' )); } return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment)); } }