Software reconstruction

| drupal

Our partners really like the Drupal-based content management system I’ve been working on, so we might roll it out to a number of other countries. To minimize headaches, we’ll probably run them as separate Drupal databases using the same code. Over the next quarter, my team needs to clean up and genericize our current US-centric site so that it can be used in lots of other geographies.

This would be a nightmare to do if we had made all of our changes on the Web. Fortunately, most of our changes are in .install files. The changes had gotten out of sync with the installation profile we created near the beginning of the project, but it was relatively easy to work through the updates and incorporate them in the profile. The regression tests I wrote are proving to be really useful, too.

There are still a number of variables that we set through the web-based interface (blame moments of weakness!), so after we clean up the profile, we’ll compare some of production tables against the tables produced by our from-scratch installation.

I applied the lots-of-little-inc-files-that-automatically-get-included-an-run pattern from our last project, so now everything is neatly compartmentalized. I improved that pattern to add weights, so now I can make sure that some inc files are run after others.

Which brings me to thinking about the proper way to backport changes from update functions back into the install functions or to the installation profile. _install functions should reflect the latest versions of the database schema, but some code (node creation, etc.) logically feels more like a part of the installation profile’s final steps. My current approach is to use the _install function for code that doesn’t require other modules to be correctly configured, and to use my custom _install_final method for the finishing touches. I’ve also broken site-specific code out into separate .inc files so that I can include any of them as needed, and I’m using regression tests to check that things are okay. Command-line drush and my Makefile make it easy to switch between the two virtual hosts.

Most of my tests are still fail, but some of them pass with from-scratch installs. Hooray! =D

You can comment with Disqus or you can e-mail me at sacha@sachachua.com.