diff options
author | Stefan Giehl <stefan@matomo.org> | 2019-08-15 21:16:34 +0300 |
---|---|---|
committer | diosmosis <diosmosis@users.noreply.github.com> | 2019-08-15 21:16:34 +0300 |
commit | 0da695c3b557d4eaa74fe224f0f5565332d3d702 (patch) | |
tree | 7e0bbb788387a7dee82cdbd19f47e6a339a4f972 /plugins/UserCountry | |
parent | 9b15cdb0e07bb10768c9cc92e0d70dee683ac752 (diff) |
Fix city archiving for cities without regions (#14731)
* Fix city archiving for cities without regions
* Add city without region
* Regenerate mmdb files
* update exprected test files
Diffstat (limited to 'plugins/UserCountry')
-rw-r--r-- | plugins/UserCountry/Archiver.php | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/plugins/UserCountry/Archiver.php b/plugins/UserCountry/Archiver.php index 1fb9ad68b7..16eca3bd26 100644 --- a/plugins/UserCountry/Archiver.php +++ b/plugins/UserCountry/Archiver.php @@ -107,12 +107,13 @@ class Archiver extends \Piwik\Plugin\Archiver $row[$column] = str_replace(self::LOCATION_SEPARATOR, '', $row[$column]); } - if (!empty($row[self::REGION_FIELD])) { - $row[self::REGION_FIELD] = $row[self::REGION_FIELD] . self::LOCATION_SEPARATOR . $row[self::COUNTRY_FIELD]; + // set city first, as containing region might be manipulated afterwards if not empty + if (!empty($row[self::CITY_FIELD])) { + $row[self::CITY_FIELD] = $row[self::CITY_FIELD] . self::LOCATION_SEPARATOR . $row[self::REGION_FIELD] . self::LOCATION_SEPARATOR . $row[self::COUNTRY_FIELD]; } - if (!empty($row[self::CITY_FIELD])) { - $row[self::CITY_FIELD] = $row[self::CITY_FIELD] . self::LOCATION_SEPARATOR . $row[self::REGION_FIELD]; + if (!empty($row[self::REGION_FIELD])) { + $row[self::REGION_FIELD] = $row[self::REGION_FIELD] . self::LOCATION_SEPARATOR . $row[self::COUNTRY_FIELD]; } } |