@sgiehl opened this Pull Request on April 5th 2018 Member

As using GeoIP2 requires a schema change on log tables to be able to track ISO region codes, GeoIP2 will be included as a new plugin. This way we can avoid an automatic schema change while updating Matomo.

This plugin will be automatically enabled for new installs. Instances updating to the new version will have the plugin included disabled. Enabling the plugin will then trigger the schema change.

As long as the GeoIP2 plugin is disabled nothing will change for Geolocation configuration, tracked data and API.

As soon as the GeoIP2 plugin is enabled some stuff changes:

Autoupdating of GeoIP databases
Autoupdating feature for databases will switch to configure updates for GeoIP2 databases.
For existing installs with configured updates for GeoIP, it will still show those settings as read only. This settings will be automatically removed as soon as GeoIP2 updates are configured

As soon as a GeoIP2 provider is chosen region codes will be stored as ISO codes. [GeoIP Legacy used FIPS codes]. To convert old log data from FIPS to ISO the command usercountry:convert-region-codes can be used. The command will convert all codes stored before the date of switching to a GeoIP2 provider.

Changes in API
Until a GeoIP2 provider is selected nothing changes and still old FIPS codes and region names will be returned.
After switching to one all old codes included in archives will be converted [FIPS => ISO] if possible and region names will be used accordingly.

Switching back from GeoIP2 to GeoIP is only possible by disabling GeoIP2 plugin. This is on purpose as it may cause problems if FIPS and ISO codes are mixed too much in the database.

replaces #12553
fixes #4487

@diosmosis commented on April 6th 2018 Member

Noticed there's a bug in pear/archive_tar which piwik/decompress uses which causes a fatal error when downloading databases on PHP 7: https://pear.php.net/bugs/bug.php?id=21218

I think matomo/decompress uses the fixed version.

EDIT: one way to fix this is to run composer require pear/archive_tar locally.

@diosmosis commented on April 6th 2018 Member

@mattab tested locally all features seem to work, except unarchiving on PHP 7. Leaving up to you whether my remaining comments should be addressed.

@diosmosis commented on April 8th 2018 Member

@sgiehl Looked again, looks good to me except for php 7 archive tar fatal error (see my comment above for more info).

@sgiehl commented on April 8th 2018 Member

I read it. But that seems not a "bug" related to the changes for GeoIP2, right? It should currently occur for GeoIP Legacy as well I guess.
Maybe we could create a issue to fix that later. I'm not able to handle that the next days, if you see an easy solution feel free to fix it ;)

@diosmosis commented on April 8th 2018 Member

Easiest fix is to run composer require pear/archive_tar locally, I'll do this later today.

@diosmosis commented on April 9th 2018 Member

PHP 7 bug no longer exists after 8fbe252, the offending method is no longer called. Moving back to extractInString fixed this.

@sgiehl commented on April 23rd 2018 Member

I've now tested the maps with geoip2 changes_

Realtime map should work as before, as it doesn't use any region data.

The other maps will lack some information on region level. (Country and City level will still work as before) All countries where the new iso codes do not match any old fips codes the map will show those visits as "unknown region". (Note: US and Canada are not affected, as they used iso codes before, also some countries where the codes didn't change between fips and iso will still show up correctly).

To have working maps on region level with geoip2 we need to create completely new maps that also show correct regions (based in ISO) and then force all location providers to use ISO region codes in order to show region data on the map

Powered by GitHub Issue Mirror