Instead of prompting the admin to update the database, it would be great if cron would automatically update it!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

anrikun’s picture

By the way, I'm OK to work on that if you're open to patches.
Let me know :-)

aruna.kulatunga’s picture

Assigned: anrikun » Unassigned
Status: Needs review » Active

How very interesting. I was looking at that functionality just five minutes ago and then while searching found this post...

BTW, the current download URL, that appears in the Status page, is broken. The correct download URL should be

http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP....

drewish’s picture

aruna.kulatunga, would you mind opening a separate issue for the URL?

anrikun’s picture

Assigned: Unassigned » anrikun
Status: Active » Needs review
FileSize
3.51 KB

Here is a patch based on 6.x-1.2 that adds this feature.
It assumes that a GeoIP.dat is already present at sites/all/libraries/geoip/GeoIP.dat (or wherever you have changed the GeoIP data file location to).
It will not carry any automatic update if not.

drewish’s picture

Assigned: Unassigned » anrikun
Status: Active » Needs review

Humm... I feel like auto updating it in the files directory would be one but updating it in other places is going to cause problems (the webserver should not have permissions to overwrite Drupal core or contrib files). I wonder if it would make sense to implement this as a drush command. It would make installation and upgrading a lot easier. You could always schedule a cron job to run the drush task. Thoughts?

anrikun’s picture

I don't know much about Drush :-(
I will have a look at it!

roball’s picture

Per default I would point to the City (not Country) DB file's location at
http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz

drewish’s picture

Status: Needs review » Needs work

Take a look at #863930: Add drush command to fetch the getid3 library I did a drush command for getid3 to download its library. Should be able to do something similar.

alarcombe’s picture

Status: Needs work » Needs review
FileSize
3.13 KB

I added a patch for the 7.x-1.x which adds a drush command to update the city or country database.

alarcombe’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
FileSize
3.72 KB

A better patch - increased informational logging, and creates the geoip library directory if not already present.

drewish’s picture

Should we be calling drush_log('Decompressing database', 'ok'); with 'ok' if it hasn't finished yet? Seems like it might be beter to flag that as 'info' rather than okay.

dnotes’s picture

How interesting to see this being discussed now. I created an automated cron update of the geoip city database for a 6.x project some time ago, and am just now upgrading to 7.x. The code was part of the glue module for the project, but if you would like, I can do it as a patch to geoip and incorporate alarcombe's code above, which seems to move in the direction that I was going with the choice of database type. I ran into a few issues with truly automated updates:

1. Administrators should really be notified when a geo database update is attempted, so that they can check the site.
2. When files are created by php with cron, file ownership and permissions can get tricky depending on the webhost. My only solution was to set the downloaded file to 777; otherwise I ran into problems of the cron download creating a file that I could not move or delete through my limited shell access. =Bad.

markosaurus’s picture

Hi there,

Just wondered if this ever made it into the module? I just got prompted to update as my local version is out of date by over a month.

Would be lovely to see this functionality automated! :)

Thanks,

Mark