Skip to content

Adds support for continent specific GeoIP2-City databases #13338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 27, 2018
Merged

Adds support for continent specific GeoIP2-City databases #13338

merged 4 commits into from
Aug 27, 2018

Conversation

fs1
Copy link
Contributor

@fs1 fs1 commented Aug 22, 2018

Since I use the GeoIP2-City-Europe Database from maxmind I needed to modify the files LocationProvider/GeoIp2/Php.php and LocationProvider/GeoIp2.php in the GeoIp2 Plug-in. After modification the GeoIP file was recognized an worked like expected.
Please consider implementing this patch.

@sgiehl
Copy link
Member

sgiehl commented Aug 22, 2018

Guess the database is available for other continents as well? Maybe we should add them then too.

@fs1
Copy link
Contributor Author

fs1 commented Aug 22, 2018

Good idea and yes, it is. Feel free to extend my proposal.

@sgiehl
Copy link
Member

sgiehl commented Aug 23, 2018

@fs1 Guess you don't have purchased or have access to any of the other continent dbs? Would be good to know how their naming is. Otherwise it's hard to add their names

@sgiehl sgiehl added the Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. label Aug 23, 2018
@sgiehl
Copy link
Member

sgiehl commented Aug 23, 2018

@fs1 found a page where it's mentioned. Would you mind adjusting your PR, so the other continents are listed as well?

https://dev.maxmind.com/geoip/geoip2/geoip2-city-country-csv-databases/

For the city subset by continent databases, the {Content} is one of “City-Africa”, “City-Asia-Pacific”, “City-Europe”, “City-North-America”, or “City-South-America”.

@fs1 fs1 changed the title add GeoIP2-City-Europe add all kinds of GeoIP2/GeoLite2-City Databases Aug 23, 2018
@sgiehl
Copy link
Member

sgiehl commented Aug 23, 2018

@fs1 thanks for updating. Are you sure there are continent separated dbs for GeoLite2? Did only find some for the paid version...

@fs1
Copy link
Contributor Author

fs1 commented Aug 23, 2018

well. guess you're right.
On https://www.maxmind.com/en/geoip2-city-database-by-continent they write

Subsets of the GeoIP2 City database are available for individual continents.

This explanation from https://dev.maxmind.com/geoip/geoip2/geoip2-city-country-csv-databases/ ist some kind of contradictory

The zip file itself is named {Product}-{Content}-CSV_latest.zip. The {Product} is either “GeoIP2” or “GeoLite2”. The {Content} refers to the particular product name, such as “City” or “Country”. For the city subset by continent databases, the {Content} is one of “City-Africa”, “City-Asia-Pacific”, “City-Europe”, “City-North-America”, or “City-South-America”.

Im going to update the PR again.

@@ -273,7 +283,7 @@ public function getInfo()
. '</a>';

$availableDatabaseTypes = array();
if (self::getPathToGeoIpDatabase(['GeoIP2-Enterprise.mmdb', 'GeoIP2-City.mmdb', 'GeoLite2-City.mmdb']) !== false) {
if (self::getPathToGeoIpDatabase(['GeoIP2-City.mmdb', 'GeoIP2-City-Africa.mmdb', 'GeoIP2-City-Asia-Pacific.mmdb', 'GeoIP2-City-Europe.mmdb', 'GeoIP2-City-North-America.mmdb', 'GeoIP2-City-South-America.mmdb', 'GeoIP2-Enterprise.mmdb', 'GeoIP2-Country.mmdb', 'GeoLite2-City.mmdb', 'GeoLite2-Country.mmdb']) !== false) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Country versions shouldn't be added here, as its the detection if the city level is available.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx for the hint, i missed that.

@sgiehl sgiehl changed the title add all kinds of GeoIP2/GeoLite2-City Databases Adds support for continent specific GeoIP2-City databases Aug 27, 2018
@sgiehl
Copy link
Member

sgiehl commented Aug 27, 2018

@fs1 Thanks again for your contribution. Will merge it now, so it will be included in the next release.

@sgiehl sgiehl merged commit 5c68962 into matomo-org:3.x-dev Aug 27, 2018
@sgiehl sgiehl added this to the 3.6.0 milestone Aug 27, 2018
InfinityVoid pushed a commit to InfinityVoid/matomo that referenced this pull request Oct 11, 2018
…#13338)

* add GeoIP2-City-Europe

* added all kinds of maxmind city databases

* removed GeoLite2-City-Continent database support since this separation is only for GeoIp2 databases available

* removed country files from city detection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Development

Successfully merging this pull request may close these issues.

2 participants