6 tips for auditing Drupal contrib modules

4 comments

One of the biggest tasks when building a Drupal site is selecting, configuring, and integrating contrib modules into your site. For almost everything you need to do "there's a module for that", but whether you should be using that module is an entirely different question.

For every new module I choose for a site, I go through some quick steps and questions (mostly unconsciously now) to determine whether I should risk a module.

Enabling multiple themes in Aegir install profiles

4 comments

Couples using wedful.com can select from a variety of themes for their wedding website. So when building the install profile we wanted to have all of these themes enabled by default. Enabling multiple themes in an install profile should be something simple to do. In fact, the install profile api even has a function just for this: install_enable_theme(array('theme1', 'theme2')).

However, due to the issues I discussed previously with static variables, enabling multiple themes from within an install profile is actually extremely difficult.

Hooking into Drush and Aegir

2 comments

(Disclaimer: I'm still just learning this stuff, so please let me know if you notice anything wrong in here)

If you build and maintain Drupal sites and haven't used Drush yet, it's time you take a look at it. Even if you only use it for very basic things such as downloading and updating modules it can still be a big time saver.

One of the things that makes Drush so powerful is it's flexibility with hooks. Each Drush command can be hooked in at three different levels; before, during, and after it runs. The hooks are pre, validate, and post, respectively. It works slightly differently than the Drupal hook system but the concept is the same.

A new blog RSS feed

4 comments

Since I'm writing a lot more technical posts now than I have historically, I've decided to make another RSS feed for people who don't want the tech posts clogging up their RSS readers. You can subscribe to it here: General posts

If you want to read only the technical posts, but not the other stuff then subscribe to this one: Technical posts

And if you don't mind getting both, then you don't need to change anything.

Static variables and Drupal install profiles

2 comments

I believe that this is not an issue with Drupal 7 as it handles variables differently than D5/D6. However, if you want to make an install profiles for anything earlier than D7 static variables can pose a huge problem. Static varibles are used for caching within a function in PHP. Generally the first time the function is called during a page load the static will be set. The second time it's called there's no need to execute most of the code and the value stored in the static will be returned.

While statics can be convenient and help improve performance, they become a huge problem when the relevant data has been altered partway through a page load and you need to reset the cache. Since the install profile is executed in what's effectively a single page load, static variables become problematic.