DNotes LLC

DNotes LLC

Drupal development, hosting, and consulting

Upgrading modules to Drupal 7

Okay, so it's no D7CX or anything, but I just spent the weekend upgrading my three little modules to Drupal 7:

Sudo
Lyric Sheet Chords
Location Chooser

This was fantastic experience for me, because I had to do a lot of study of Drupal 7 that I had previously been putting off; for example, learning the new database API was a big step. I found that the excellent Coder module did a lot of the work for me, but there were a few things that it just couldn't cope with. So, I'm making a list of what to do after running coder module for next time:

  1. Search for any "todo" text, and do what it tells you.
  2. Switch to the Drupal 7 javascript implementation.
  3. Search for any code using "db_placeholders" - coder does NOT deal with those queries.
  4. Search for paths that have changed, such as admin/user is now admin/people.
  5. Check the hook_theme and theme_whatever functions VERY carefully.
  6. Make all your simpletests pass - you do have simpletests already, don't you???
  7. Review the doxygen comments on all your functions.

That really about covers everything I had to do to upgrade my modules to 7.x. Of course there were a few hooks that had changed bits, and various odd errors, but nothing too trying.

If there is one thing this process illustrated, it was the immense desirability of tested code. Basically, I could run the tests, see the exact lines I needed to change, and figure out what was wrong on a line-by-line basis. Without those simpletests, I can't imagine the amount of time it would have taken to upgrade these modules. Thanks, Drupal 7 Testing module!