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:
authordiosmosis <diosmosis@users.noreply.github.com>2020-01-24 04:58:21 +0300
committerThomas Steur <tsteur@users.noreply.github.com>2020-01-24 04:58:21 +0300
commitfc4437c0090156ff88ed351f7e855151d44d5c82 (patch)
tree009f44f0d8e65799cf53ecd2a5460aeb52c2f816 /plugins/UserCountry
parentb2a24e3795816459bf983d311a70e220eadd2b48 (diff)
Make sure geolocation admin experience is consistent if user is not using GeoIp2 plugin. (#15447)
Diffstat (limited to 'plugins/UserCountry')
-rw-r--r--plugins/UserCountry/Controller.php6
-rw-r--r--plugins/UserCountry/lang/en.json3
-rw-r--r--plugins/UserCountry/templates/adminIndex.twig13
3 files changed, 19 insertions, 3 deletions
diff --git a/plugins/UserCountry/Controller.php b/plugins/UserCountry/Controller.php
index 84e7fd2376..97b5eadf92 100644
--- a/plugins/UserCountry/Controller.php
+++ b/plugins/UserCountry/Controller.php
@@ -70,6 +70,9 @@ class Controller extends \Piwik\Plugin\ControllerAdmin
}
$view->isThereWorkingProvider = $isThereWorkingProvider;
+ $view->notUsingGeoIpPlugin = !Manager::getInstance()->isPluginActivated('GeoIp2')
+ && !Manager::getInstance()->isPluginActivated('GeoIp');
+
// if using either the Apache, Nginx or PECL module, they are working and there are no databases
// in misc, then the databases are located outside of Piwik, so we cannot update them
$view->showGeoIPUpdateSection = true;
@@ -80,6 +83,9 @@ class Controller extends \Piwik\Plugin\ControllerAdmin
) {
$view->showGeoIPUpdateSection = false;
}
+ if ($view->notUsingGeoIpPlugin) {
+ $view->showGeoIPUpdateSection = false;
+ }
$view->isInternetEnabled = SettingsPiwik::isInternetEnabled();
diff --git a/plugins/UserCountry/lang/en.json b/plugins/UserCountry/lang/en.json
index a707f363e8..852293b84d 100644
--- a/plugins/UserCountry/lang/en.json
+++ b/plugins/UserCountry/lang/en.json
@@ -98,6 +98,7 @@
"UpdaterScheduledForNextRun": "It is scheduled to run during the next cron core:archive command execution.",
"UpdaterWasLastRun": "The updater was last run on %s.",
"UpdaterWillRunNext": "It is next scheduled to run on %s.",
- "WidgetLocation": "Visitor Location"
+ "WidgetLocation": "Visitor Location",
+ "InstallGeoIp2": "Matomo recommends using the %1$sdbip%2$s databases, but this requires using the GeoIp2 plugin. If you install and activate it (which will require a possibly long running update), you will be able to get started using %1$sdbip%2$s databases. (Ignore this if you are using a third party plugin that provides it's own geolocation functionality.)"
}
} \ No newline at end of file
diff --git a/plugins/UserCountry/templates/adminIndex.twig b/plugins/UserCountry/templates/adminIndex.twig
index ac9e2c1f59..f0a32da588 100644
--- a/plugins/UserCountry/templates/adminIndex.twig
+++ b/plugins/UserCountry/templates/adminIndex.twig
@@ -16,6 +16,7 @@
{% if not isThereWorkingProvider %}
<h3 style="margin-top:0;">{{ 'UserCountry_HowToSetupGeoIP'|translate }}</h3>
+ {% if dbipLiteUrl|default is not empty %}
<p>{{ 'UserCountry_HowToSetupGeoIPIntro'|translate }}</p>
<ul style="list-style:disc !important;margin-left:2em;">
<li style="list-style-type: disc !important;">{{ 'UserCountry_HowToSetupGeoIP_Step1'|translate('<a rel="noreferrer noopener" href="'~dbipLiteUrl~'">','</a>','<a rel="noreferrer noopener" target="_blank" href="http://db-ip.com/?refid=mtm">','</a>')|raw }}</li>
@@ -23,6 +24,9 @@
<li style="list-style-type: disc !important;">{{ 'UserCountry_HowToSetupGeoIP_Step3'|translate('<strong>','</strong>','<span style="color:green"><strong>','</strong></span>')|raw }}</li>
<li style="list-style-type: disc !important;">{{ 'UserCountry_HowToSetupGeoIP_Step4'|translate }}</li>
</ul>
+ {% else %}
+ <p>{{ 'UserCountry_InstallGeoIp2'|translate('<a rel="noreferrer noopener" target="_blank" href="http://db-ip.com/?refid=mtm">','</a>')|raw }}</p>
+ {% endif %}
<p>&nbsp;</p>
{% endif %}
@@ -127,7 +131,7 @@
</div>
{% endif %}
-{% if isInternetEnabled %}
+{% if isInternetEnabled and not notUsingGeoIpPlugin %}
<div piwik-content-block
content-title="{% if not geoIPDatabasesInstalled %}{{ 'UserCountry_GeoIPDatabases'|translate|e('html_attr') }}{% else %}{{ 'UserCountry_SetupAutomaticUpdatesOfGeoIP'|translate|e('html_attr') }}{% endif %}"
id="geoip-db-mangement">
@@ -161,9 +165,14 @@
</div>
</div>
</div>
+ {% if dbipLiteUrl|default is not empty %}
+ {% set downloadingDbLink %}<a href="{{ dbipLiteUrl|e('html_attr') }}">{{ dbipLiteFilename }}</a>{% endset %}
+ {% else %}
+ {% set downloadingDbLink = '' %}
+ {% endif %}
<div id="geoipdb-screen2-download" ng-show="locationUpdater.showFreeDownload">
<div piwik-progressbar
- label="{{ ('UserCountry_DownloadingDb'|translate('<a href="'~dbipLiteUrl~'">'~dbipLiteFilename~'</a>') ~ '...')|json_encode }}"
+ label="{{ ('UserCountry_DownloadingDb'|translate(downloadingDbLink) ~ '...')|json_encode }}"
progress="locationUpdater.progressFreeDownload">
</div>
</div>