Skip to content

Conversation

dwightwatson
Copy link
Contributor

This is a follow-up to #163 that is intended to fix #162.

It expands on the work by @tylermann - with a couple of differences.

Instead of adding the database filename to the config it searches for the first file with the extension .mmdb and assumes this is the correct one. Seems like a little simpler to me though less configurable - open to feedback here.

It would be great if we could leverage Laravel's filesystem adapter as it would clean up much of the directory creation/removal code, but that's probably part of a larger discussion.

@dwightwatson
Copy link
Contributor Author

This is likely to still fail because there is no licence key on the testing server - so it's a matter of getting a licence key for testing, stubbing out the download or removing the test completely.

Copy link

@tylermann tylermann left a comment

Choose a reason for hiding this comment

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

@dwightwatson this looks great, thanks for cleaning this up! Just searching for the extension makes sense as far as I can see. I guess there's no guarantees either way around their naming conventions so this is probably less likely to break. We could potentially check to make sure there aren't more than one .mmdb files in the tar but otherwise I don't see any issues with it.

I'm not super familiar with this laravel-geoip project though so will let a maintainer take a look as well.

if (pathinfo($file, PATHINFO_EXTENSION) === 'mmdb') {
return $file;
}
}

Choose a reason for hiding this comment

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

Could potentially explicitly return null at the end here instead of an implicit void in case the file wasn't matched but up to you. I just usually like having a function either always return something or always not return something for readability, but that may also just be me so feel free to ignore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not opposed to it, it's nice that it's more explicit. I've made the change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Better yet - I've moved the exception into the method. Means I don't have to do the is_null check further up.

@theblindfrog
Copy link

@Torann are you able to review this PR?

@Torann
Copy link
Owner

Torann commented Jan 10, 2020

Going over it today

@Torann
Copy link
Owner

Torann commented Jan 10, 2020

This looks great!!! I'm thinking since people have to update their config file, which is out of our hands, I'm going to mark this a version 1.1 which will then require people to go over the upgrade doc. @dwightwatson if you wouldn't mind could you update upgrade.md on Lyften.com with the best way for people to go about upgrading from v1.0 to v1.1

How does this sound?

@dwightwatson
Copy link
Contributor Author

Makes sense, no worries - just made a quick PR that goes over the change: Torann/lyften.com#17

@Torann Torann merged commit b9af2e5 into Torann:master Jan 10, 2020
@Torann
Copy link
Owner

Torann commented Jan 10, 2020

Ok, making the release version now and the docs are being deployed now. Thanks!

@dwightwatson dwightwatson deleted the maxmind-database branch January 10, 2020 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MaxMind database fetching is broken due to privacy change on MaxMind side
4 participants