Here's a new version of location.install that implements hook_install() to stick stuff into the database when the module is enabled for the first time.

Enjoy!

CommentFileSizeAuthor
#2 location.install_0.patch2.51 KBwebchick
location.install.txt1.09 KBjjeff

Comments

webchick’s picture

Status: Active » Needs work

I could swear I already rolled a patch for this once already but I can't seem to find it. Anyway, a couple comments:

1. Coding style-wise, here document syntax is not very standard in Drupal
2. Tables shouldn't be hard-coded as type=MyISAM; if this is left off MySQL will use whatever the default is (usually MyISAM, but also InnoDB, etc.)
3. The zipcodes table should be included. I don't think the zipcodes _data_ should be included (we're not all in the U.S. ;)) but the table definition should be there.

I will find my old copy and roll a patch based on this feedback momentarily.

webchick’s picture

Assigned: Unassigned » webchick
Status: Needs work » Needs review
StatusFileSize
new2.51 KB

Yeah, so "momentarily" turned into "4 days" but anyway. ;)

Here is an updated patch, that both conforms to coding standards and also includes Views-style drupal_set_message()s to inform user of the progress. In addition, I added a note about importing the zipcodes. Ideally though, it would be better if there was a mechanism to automate this (menu callback? so "click here to import [country-code] zip codes" ?) rather than telling the user to import manually.. :\

ankur’s picture

Status: Needs review » Fixed

Committed to HEAD. Thank you, webchick!

karens’s picture

The reason for the manual install of the zip code fields is that the size of the database is so large that it will time out. I can't even do it from phpMyAdmin but have to do it directly from shell to get it to work. That means there can be no automatic install of those files unless someone figures out a way to knock it down into smaller pieces, and then you have to track how far along you got and where to pick up and so on and so on.... Would be a great feature if someone could figure out how to automate it.

Anonymous’s picture

Status: Fixed » Closed (fixed)