Skip to content
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

Allow using paid db-ip urls for auto update #15606

Merged
merged 3 commits into from Feb 22, 2020
Merged

Allow using paid db-ip urls for auto update #15606

merged 3 commits into from Feb 22, 2020

Conversation

sgiehl
Copy link
Member

@sgiehl sgiehl commented Feb 21, 2020

This allows adding urls like https://db-ip.com/account/$ACCOUNT_KEY/db/ip-to-location or https://db-ip.com/account/$ACCOUNT_KEY/db/ip-to-location/mmdb/url directly to the auto updater

fixes #15580

@sgiehl sgiehl added not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Needs Review PRs that need a code review labels Feb 21, 2020
@sgiehl sgiehl added this to the 3.13.4 milestone Feb 21, 2020
@sgiehl sgiehl linked an issue Feb 21, 2020 that may be closed by this pull request
@@ -741,4 +744,28 @@ public static function isDbIpUrl($url)
{
return !! preg_match('/db-ip\.com/', $url);
}

private function isPaidDbIpUrl($url)
Copy link
Member

Choose a reason for hiding this comment

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

is it possible to add a test for this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added some tests

@tsteur tsteur merged commit 0e15480 into 3.x-dev Feb 22, 2020
@tsteur tsteur deleted the dbippaid branch February 22, 2020 23:40

protected function fetchUrl($url)
{
return Http::fetchRemoteFile($url);
Copy link
Member

Choose a reason for hiding this comment

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

@sgiehl just realising we should be checking whether internet is enabled and if not, throw an exception maybe?

BTW out of curiosity: Any reason using fetchRemoteFile over sendHttpRequest?

Copy link
Member Author

Choose a reason for hiding this comment

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

Checking if internet is enabled is done in __construct, so need to do that another time.

BTW out of curiosity: Any reason using fetchRemoteFile over sendHttpRequest?

No. Actually not. Feel free to change that...

jonasgrilleres pushed a commit to 1024pix/pix-analytics that referenced this pull request Sep 22, 2020
* Allow using paid db-ip urls for auto update

* apply review feedback

* Adds some Unit tests for new GeoIP2AutoUpdater methods
jbuget pushed a commit to 1024pix/pix-analytics that referenced this pull request Sep 26, 2020
* Allow using paid db-ip urls for auto update

* apply review feedback

* Adds some Unit tests for new GeoIP2AutoUpdater methods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Geolocation: automatically download latest paid DB-IP databases
2 participants