Infrastructure Services

Drupal Install Profiles

William O'Connor
CTO

WTH is a Drupal Install Profile?

Install profiles rock, and you should know what they are and why they're the future.

There's a folder you probably have paid little attention to that is situated right at the top level of a drupal install (5 or 6): profiles. The standard Drupal profile is called Drupal and comes with any Drupal installation. Every time you installed Drupal 5 or Drupal 6 (which probably borders the 1000s if you're like me), you have run through the default install profile.

The file itself is nested inside of the directory by the same name, so in the base case, we have default.profile. Here is a quick rundown of what is available to you in Drupal-5 & Drupal-6:

  • hook_profile_modules() D5 & D6 - this defines all the modules that you'll need in order to get your site up and running. This includes core - optional modules and contributed modules. Sometimes, you even need to define core modules to get things to work right, but that is for a later discussion or another time
  • hook_profile_details() D5 & D6 - this defines the name and information that will be presented to the user on the initial install screen. I like to try and include a list (with links) to all of the modules that are contrib so that downloading everything is radically easier, but hey, whatever floats your boayt, include a link to Ricky Astley if that's your thing. :-)
  • hook_profile_task_list()  D6 only - a list of steps that a user will go through before being redirected to the site. I haven’t used this one extensively, but it basically adds another page of installation
  • hook_profile_final()  D5 only - all the tasks that you want to accomplish before the user gets redirected to the site. At this point, modules are installed, so you can run anything relating to your modules, set up content types, users, site variables. You name it, you can pretty much do it.
  • hook_profile_tasks(&$task, $url)  D6 only - This is pretty much the successor to the hook_profile_final with the exception that this function can get called a number of times with varying tasks and urls. This is another one I haven't used much - to a large degree because Install Profiles in D6 are a little hit or miss - but my understanding is that you could basically use this to create custom forms, query the user for decisions along the path, and, say install or not install blog elements based on their choices. Since the modules are installed previously, things could get funky, but let's not get off into hypotheticals, and leave it at this: this function is cool, powerful, and the backbone of your D6 profile.
  • hook_form_alter(&$form, $form_state, $form_id) D6 only, I think. :-p - It's one of our tried and true functions, and it allows you to add form fields on pre-populate values on the installation forms.
So, What's the Point?

Install profiles are the future of Drupal, no two ways about it. Install profiles provide simplicity. They allow you to specify all the modules required and pre-configure the site for a non-experienced user. This means that a completely new user could install, say, a blog site, simply by having the installation profile and downloading a list of module, or an e-commerce site or a brochure site or social-networking site or a youtube clone or... you get the picture. We build the installation profiles, and the average joe is able to get a basic site up and running of a particular flavor while we get to leverage the installation profile to give us a well-architected beginning to any project.

If everything makes sense to you, you can probably stop there, and just know that Install profiles have a ton of power and can be leveraged in many useful ways. For anyone that's still a little foggy, let's try an analogy

Drupal Install Profiles are Bare-bones Computers

I used to build a lot of computers from scratch, and when you do that you find you run into a lot of somewhat unexpected problems. This video card, though the best on the market, doesn't like this motherboard and neither does the hard drive, etc. Basically, when you start from scratch each time and try new pieces, you introduce the possibility for error. Hence, the invention of the bare-bones computer. Just the things to get you up and running for what you need to do, and it's already been done for 300 other people, so you can use it with some confidence.

A bare bones computer gives you something to start with and deals with all the mundane things you don't want to think about. You get to choose your what you're going to use the machine for - say gaming or word-processing - and you get a pre-configured system with the right hardware and software to get you up and running. The installation profile behaves the same way in many respects. You get to choose what you want to use your website for - ecommerce, blogging, etc - and out pops a bare-bones implementation of exactly what you want. You're off an running with your new computer or website.

Once you've got your bare bones computer up and running, you may want - what am I saying you DO want - to add more functionality to your computer - you want a better video card, a monster sound system AND a sweet 27" monitor just because you can - but you have the assurance that the core of your system is a tested configuration, and performs well. Likewise, using installation profiles as your base, you can build and test your base configuration and then deploy new sites of the same type with a great deal of certainty, knowing that, at the core they perform well and have few issues.

Moving Forward

Install profiles won't save the world, but they will make your job easier, and mine too. Install profiles have a ton of power, so I suggest you check them out when you have the chance. Thanks, and if you have questions about Install Profiles, have at it, and I'll try and share what I've learned!

More about Infrastructure Services

Achieve Internet is excited to announce the recent launch of a new Digital Health Library created for our long-standing client Scripps Translational Science Institute.  
The importance of monitoring your server access logs We recently had a client come to us with random performance problems on their site.  The site is a low traffic brochure site on a shared hosting account.  Most of the time the site performs reasonably well.  However, there are mysterious times where the site slows down to a crawl. This reached a critical point Friday afternoon and their hosting provider shut down the site for using too many server resources.