@sgiehl opened this Pull Request on May 11th 2020 Member

As discussed in #12811 I've added a new checkbox in the last step of the installation.

When checked, Matomo will automatically add the GeoIP2Updater setting, so the dbip database will be donwloaded/updated monthly. In addition it will set the used location provider to geoip2php.

But I'm currently unsure how to handle the automatic download of the database. Doing that within the installation process is a bit difficult to implement and it also might take a while.

With this implementation the updater will be set and thus the automatic task should be scheduled for "tomorrow". That means until then the geolocation would be reported as broken in admin, as geoip2 is configured, but no database is available. (geolocation itself would still work and fallback to the default provider)
~I've changed the geolocation admin a bit, so it will automatic start the download process if autoupdate is configured but no database is available.~
Not sure if that is a suitable solution, but didn't have a better idea right now.
@mattab @tsteur @diosmosis Does anyone of you have a better idea how to do/trigger the download. We could maybe try to run it async, but that might not work in many cases 🤔

fixes #12811

@diosmosis commented on May 11th 2020 Member

what's the issue w/ making the controller requests it to the installation UI?

@sgiehl commented on May 11th 2020 Member

what's the issue w/ making the controller requests it to the installation UI?

That won't work easily with the hooks currently used to add the checkbox I guess.

@diosmosis commented on May 11th 2020 Member

I see, I guess the original code probably uses angular or a lot of JS that needs to be loaded? Or would need to be modified to be pre-loaded during installation?

@tsteur commented on May 11th 2020 Member

Wouldn't do it directly during installation but only once fully installed. Could we set eg during the installation a flag that we need to download the DB... then we try to complete this download eg as part of an hourly task which would simply be executed eg on the first tracking request or so. Additionally, if CliMulti::supportsAsync() returns true, then we could launch a command in the background to sync the DB... AFAIK supportsAsync() works on many installs and most often it would be downloaded fairly soon after installation is completed (could trigger it on last step for example). For all other cases we'd download it through a task.

Not sure it's somewhat clear what I mean?

@sgiehl commented on May 12th 2020 Member

@tsteur change that. it will now be done using a scheduled task and if async is possible, the scheduled tasks will be triggered in the last step of installation

@sgiehl commented on May 13th 2020 Member

@tsteur updated the code

@tsteur commented on May 13th 2020 Member

Looks good to me 👍

This Pull Request was closed on May 14th 2020
Powered by GitHub Issue Mirror