Page MenuHomePhabricator

IPInfo: Show country in the popup [M]
Closed, ResolvedPublicBUG REPORT

Description

What is the problem?

The IPInfo popup does not show the country the IP is in.

It only shows city, state, region, etc.

Event Timeline

@dom_walden Do you know if this is still a problem?

Quoting @dom_walden from Slack earlier:

Moreover, the bug I raised was for GeoLite2. I have not tested Enterprise yet.
But I suspect (reading the code) for GeoLite2 it is still happening.
For example, the IP 216.38.130.164 in https://en.wikipedia.beta.wmflabs.org/w/index.php?title=Main_Page&action=history only says Redwood City, California

ARamirez_WMF renamed this task from IPInfo: Show country in the popup to IPInfo: Show country in the popup [M].Oct 13 2021, 4:24 PM

In the interests of not leaking data about an ip, I tested another ip against the free and enterprise databases. For reference, we currently:

  1. Pull the city
  2. Pull the subdivisions
  3. Reverse the order of the subdivisions (since it comes back from the db from largest to smallest)
  4. Return the city and subdivisions in order from smallest to largest

From City.mmdb (with non-en translations and non-location information removed):

"Records": [
    {
        "Record": {
            "city": {
                "geoname_id": 2640101,
                "names": {
                    "en": "Poole",
                }
            },
            "continent": {
                "code": "EU",
                "geoname_id": 6255148,
                "names": {
                    "en": "Europe",
                }
            },
            "country": {
                "geoname_id": 2635167,
                "iso_code": "GB",
                "names": {
                    "en": "United Kingdom",
                }
            },
            "registered_country": {
                "geoname_id": 2635167,
                "iso_code": "GB",
                "names": {
                    "en": "United Kingdom",
                }
            },
            "subdivisions": [
                {
                    "geoname_id": 6269131,
                    "iso_code": "ENG",
                    "names": {
                        "en": "England",
                    }
                },
                {
                    "geoname_id": 12165737,
                    "iso_code": "BCP",
                    "names": {
                        "en": "Bournemouth, Christchurch and Poole Council"
                    }
                }
            ]
        }
    }
]

From the Enterprise.mmdb (similarly redacted):

"Records": [
    {
        "Record": {
            "city": {
                "geoname_id": 2640101,
                "names": {
                    "en": "Poole",                        }
            },
            "continent": {
                "code": "EU",
                "geoname_id": 6255148,
                "names": {
                    "en": "Europe",
                }
            },
            "country": {
                "geoname_id": 2635167,
                "iso_code": "GB",
                "names": {
                    "en": "United Kingdom",
                }
            },
            "registered_country": {
                "geoname_id": 2635167,
                "iso_code": "GB",
                "names": {
                    "en": "United Kingdom",
                }
            },
            "subdivisions": [
                {
                    "geoname_id": 6269131,
                    "iso_code": "ENG",
                    "names": {
                        "en": "England",
                    }
                },
                {
                    "geoname_id": 12165737,
                    "iso_code": "BCP",
                    "names": {
                        "en": "Bournemouth, Christchurch and Poole Council"
                    }
                }
            ],
        }
    }
],

So we do have information about the country in both databases and can access them in similar ways. It would have to be appended to the array_merge that happens at the end of getLocations. Right now the location returns as "Poole, Bournemouth, Christchurch and Poole Council, England" and we'd expect after this fix to show "Poole, Bournemouth, Christchurch and Poole Council, England, United Kingdom"

Change 732838 had a related patch set uploaded (by AGueyte; author: AGueyte):

[mediawiki/extensions/IPInfo@master] Show country in the popup

https://gerrit.wikimedia.org/r/732838

Change 737750 had a related patch set uploaded (by AGueyte; author: AGueyte):

[mediawiki/extensions/IPInfo@master] Show country in the popup and infobox

https://gerrit.wikimedia.org/r/737750

Change 732838 abandoned by AGueyte:

[mediawiki/extensions/IPInfo@master] Show country in the popup and infobox

Reason:

https://gerrit.wikimedia.org/r/732838

Change 737750 merged by jenkins-bot:

[mediawiki/extensions/IPInfo@master] Show country in the popup and infobox

https://gerrit.wikimedia.org/r/737750

From my testing several IP, this is no longer a problem. see screen shot below

Screen Shot 2021-11-18 at 11.30.02 AM.png (1×2 px, 581 KB)

Screen Shot 2021-11-18 at 11.31.46 AM.png (1×2 px, 693 KB)