Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbenakamoorthi <benaka.moorthi@gmail.com>2012-12-15 06:45:36 +0400
committerbenakamoorthi <benaka.moorthi@gmail.com>2012-12-15 06:45:36 +0400
commit70097b673f98ae39a19e3e2390cbd212ab25b3f1 (patch)
tree403ad7338469c06af39274485e6cdf5270369dee
parent03161c405d7a20a80422d0c64eb8dbd6c9d51bce (diff)
Fixes #3529, modify message displayed if no data in region/city reports based on whether geoip is currently working or not.
git-svn-id: http://dev.piwik.org/svn/trunk@7629 59fd770c-687e-43c8-a1e3-f5a4ff64c105
-rw-r--r--lang/en.php4
-rw-r--r--plugins/UserCountry/Controller.php42
2 files changed, 36 insertions, 10 deletions
diff --git a/lang/en.php b/lang/en.php
index 5dc25b509d..ae61a93c1e 100644
--- a/lang/en.php
+++ b/lang/en.php
@@ -1564,7 +1564,9 @@ And thank you for using Piwik!',
'UserCountry_getCityDocumentation' => 'This report shows the cities your visitors were in when they accessed your website.',
'UserCountry_GeoIPDocumentationSuffix' => 'In order to see data for this report, you must setup GeoIP in the Geolocation admin tab. The commercial %1$sMaxmind%2$s GeoIP databases are more accurate than the free ones. To see how accurate they are, click %3$shere%4$s.',
'UserCountry_OldGeoIPWarning' => 'We\'ve detected the old GeoIP plugin. GeoIP integration is now in Piwik core and this plugin is considered deprecated. New region and city reports will not be shown while this plugin is loaded. %1$sPlease disable the plugin%2$s and %3$sconfigure GeoIP%4$s. If you want location data for your old visits, use the script described %5$shere%6$s then %7$sreprocess your reports%8$s.',
- 'UserCountry_NoDataForGeoIPReport' => 'There is no data for this report because there is no location data available. To enable accurate geolocation, change the settings %1$shere%2$s and use a %3$scity level database%4$s. To get location data for your old visits, use the script described %5$shere%6$s.',
+ 'UserCountry_NoDataForGeoIPReport1' => 'There is no data for this report because there is either no location data available or visitor IP addresses cannot be geolocated.',
+ 'UserCountry_NoDataForGeoIPReport2' => 'To enable accurate geolocation, change the settings %1$shere%2$s and use a %3$scity level database%4$s.',
+ 'UserCountry_ToGeolocateOldVisits' => 'To get location data for your old visits, use the script described %1$shere%2$s.',
'UserCountry_GeoIPPeclCustomDirNotSet' => 'The %s PHP ini option is not set.',
'UserCountry_GeoIPServerVarsFound' => 'Piwik detects the following GeoIP %s variables',
'UserCountry_AssumingNonApache' => "Cannot find apache_get_modules function, assuming non-Apache webserver.",
diff --git a/plugins/UserCountry/Controller.php b/plugins/UserCountry/Controller.php
index bf08563637..38fc6e94ff 100644
--- a/plugins/UserCountry/Controller.php
+++ b/plugins/UserCountry/Controller.php
@@ -437,15 +437,26 @@ class Piwik_UserCountry_Controller extends Piwik_Controller_Admin
if ($dataTable->getRowsCount() == 1
&& $dataTable->getFirstRow()->getColumn('label') == Piwik_Translate('General_Unknown'))
{
- $params = array('module' => 'UserCountry', 'action' => 'adminIndex');
- $footerMessage = Piwik_Translate('UserCountry_NoDataForGeoIPReport', array(
- '<a target="_blank" href="'.Piwik_Url::getCurrentQueryStringWithParametersModified($params).'">',
- '</a>',
- '<a target="_blank" href="http://dev.maxmind.com/geoip/geolite?rId=piwik">',
- '</a>',
- '<a target="_blank" href="http://piwik.org/faq/how-to/#faq_167">',
- '</a>'
- ));
+ $footerMessage = Piwik_Translate('UserCountry_NoDataForGeoIPReport1');
+
+ // if GeoIP is working, don't display this part of the message
+ if (!$this->isGeoIPWorking())
+ {
+ $params = array('module' => 'UserCountry', 'action' => 'adminIndex');
+ $footerMessage .= ' '.Piwik_Translate('UserCountry_NoDataForGeoIPReport2', array(
+ '<a target="_blank" href="'.Piwik_Url::getCurrentQueryStringWithParametersModified($params).'">',
+ '</a>',
+ '<a target="_blank" href="http://dev.maxmind.com/geoip/geolite?rId=piwik">',
+ '</a>'
+ ));
+ }
+ else
+ {
+ $footerMessage .= ' '.Piwik_Translate('UserCountry_ToGeolocateOldVisits', array(
+ '<a target="_blank" href="http://piwik.org/faq/how-to/#faq_167">',
+ '</a>'
+ ));
+ }
// HACK! Can't use setFooterMessage because the view gets built in the main function,
// so instead we set the property by hand.
@@ -479,4 +490,17 @@ class Piwik_UserCountry_Controller extends Piwik_Controller_Admin
}
return false;
}
+
+ /**
+ * Returns true if a GeoIP provider is installed & working, false if otherwise.
+ *
+ * @return bool
+ */
+ private function isGeoIPWorking()
+ {
+ $provider = Piwik_UserCountry_LocationProvider::getCurrentProvider();
+ return $provider instanceof Piwik_UserCountry_LocationProvider_GeoIp
+ && $provider->isAvailable() === true
+ && $provider->isWorking() === true;
+ }
}