You are here

Planet Drupal

Making Drupal 7 a Reality for Your Production Sites

In this post, I:

  • Announce a cool, new tool to help make Drupal 7 a current reality for your existing sites.

  • Make a call to the Drupal community for assistance to utilize this tool.


Sixteen months ago, in August of 2008, I suggested the Drupal community should early adopt the cool, new features of each new core release by upgrading the contributed modules in a timely fashion. In December of 2008, I followed this up with a challenge goal to the community. Since then, the D7CX movement formed with pledges by certain contributed module maintainers to have a full Drupal 7 release on the day that Drupal 7 is released. Is there someone who does not wholeheartedly applaud their efforts and commitment?

To assist the entire community of module maintainers and the army of module users, we have a new tool in our arsenal – the D7 release of the Deadwood module (aka Coder Upgrade). Under the covers, this release bears virtually no resemblance to its regular expression-based predecessor. The new module takes advantage of the brand new PHP Grammar Parser module (called PGP for short) to upgrade a module's code files to the 7.x core API.

Grammar Parser for Precise Manipulation

The Grammar Parser module turns a string of code into an object-based structure that allows for precise manipulation in a programmatic fashion. This eliminates the need to rely on opportunistic regular expressions that can generate false positives and find/change things not intended. (Borrowing from military parlance, changing from using regular expressions to the parser is like switching from carpet bombing to laser-guided missiles.)

The Grammar Parser module can also be used to:

  • Generate the documentation elements for the API module to display on the Drupal api site. PGP is also able to parse interfaces and classes, which have become more popular in D7 (e.g. database layer and views) and for which documentation has not been included on the Drupal api site.

  • Update core code files for core API changes. Just as Coder Upgrade can be used to update contributed modules, an upgrade routine could be added to update core files programmatically instead of manually. The changes to the permissions array structure in hook_perm (now hook_permissions) is a good example. Coder Upgrade will also generate the necessary patch file to post on the project issue.

Extensible API

The 7.x version of the Deadwood module provides an extensible API to define the upgrade routines. Coder Upgrade comes with routines to upgrade code to the new Drupal core API. However, routines may also be defined for any contributed module defining an API. By doing so, these upgrade routines may be used by other contributed modules which interface with its API.

Formatting Standards

A pleasant side effect of the Grammar Parser is the rewritten code which is automatically formatted in accordance with the Drupal code formatting standards. In other words, it can be used simply to rewrite a code file to conform to coding standards. Thus, in one place, you can have your module code upgraded and your code file cleaned up and looking sharp (if it wasn't already).

Code Sprint of Sorts

With the D7 release approaching, I would appreciate the community's assistance to write upgrade routines for the remaining items listed on the categorical companion to Converting 6.x modules to 7.x. Issues have been added to the Coder Upgrade issue queue for each of these items. Check out an issue to work on by assigning the issue to yourself. If you have questions, post them on the issue (or send me an email from my contact page).

The documentation in the upgrade routine code file contains examples of using the Parser API to write upgrade routines.

Getting Involved

To be a part of this important effort as a developer:

  • Download and install the Coder module and its submodules, including Coder Upgrade.

  • Copy (or symbolically link) the /coder/coder_upgrade/tests/old/samples directory to your local files directory, by default at files/coder_upgrade/old/samples.

  • Check out an upgrade to work on by assigning the upgrade issue to yourself.

  • Write the conversion routine(s) in Coder Upgrade.

  • Write an example function in the example.module file (see Step 2) to test your routine. By convention, the function should be named "example_" followed by the anchor tag on the issue page. For example, if you were working on Update functions in .install files must include a Doxygen style comment (hover over the link and look at the text following the "#" symbol), your function would be named "example_update_php."

  • Write the expected example function after upgrade in the example.module file in /coder/coder_upgrade/tests/new/samples directory

  • Test the upgrade routine by running Coder Upgrade and looking at the output file saved by default in the files/coder_upgrade/new/samples directory.

  • Post the upgrade routine code and example function on the issue. (A patch file works too.)

As a tester and documenter, you can:

  • Test the upgrade routines on contributed modules and provide feedback on the related project issue.

  • Help document the undocumented core API changes on the two "Converting 6.x modules to 7.x" pages linked above.

  • Once documented, add the item as an issue to the upgrade issue queue.

Upgrades to online module conversion

Automated module conversion continues strong at Boombatower Development. Through July 31, 2009, over 1100 modules have been uploaded to the site and run through the Deadwood conversion routines. We are pleased to provide this free service to the Drupal community which eliminates the need to download and install Deadwood on your server.

Based on user feedback, we have fixed a couple of issues with the online service. The primary user difference is that you may upload a single module without including a top-level directory in the tar.gz file. This fixes some interesting issues that people experienced when the tar.gz file did not have a top-level directory.

Boombatower Development is also available to assist you with making sure your module runs properly in D6 and to help you take advantage of the Drupal 6 API.

Update on automated module conversion

Automated module conversion seems to be a hit!

In December 2008, the Deadwood module was made available for use without download on the Boombatower web site. In the three months since, nearly 600 modules have been uploaded to the site and run through its conversion routines.

This is very encouraging news for the entire Drupal community. My only regret is this heavy usage comes nearly a year after the official release of Drupal 6. As stated in my previous post, I continue to challenge and encourage us as a community to embrace the idea of having our contributed modules ready to deploy when the new core version is released. To this end, I am working on a new version of Deadwood (that will be part of the Coder project and be renamed to Coder Upgrade). My goal with the new release is to increase the percentage of core API changes handled by the conversion routines and to provide an API to assist developers to write conversion routines for non-core APIs that are referenced in other contributed modules.

Challenge Goal and Proposal for Drupal 7

Community Strategy

My challenge goal to the Drupal community is that we have our contributed modules ported within a month of the D7 release to show our support for and be able to take advantage of the new Drupal core. As most of us know, it has been 10 months since the release of Drupal 6.0 and a fair number of large modules have either not been ported to D6 or did so only recently.

The idea is that, when D7 goes to code freeze, module developers would similarly freeze the feature development of their D6 releases and focus on conversion to D7. This strategy will reflect well on the community's commitment to maintain a solid code base and reap the benefits of all the cool new features in each new core release.


In order to facilitate the achievement of this goal, I propose the following:

  • Recast the 6.x to 7.x conversion roadmap documentation as the depository for developers to log the changes from D6 to D7
  • Create another 6.x to 7.x conversion roadmap (from the above depository) organized into separate pages by topic, and
  • Automate a great percentage of the changes in the 7.x release of Deadwood to be ready when D7 goes into code freeze

The Drupal community will benefit from the documentation change by:

  • Making it easier for module developers to find the core changes relevant to their module,
  • Clarifying for module developers the conversion routines to be applied by Deadwood,
  • Providing a more organized history of core changes by release, and
  • Helping everyone to understand the changes to core.

Similarly, the community will benefit from having Deadwood updated by the time D7 goes into code freeze by:

  • Making it easier for module developers to port their code by significantly reducing the time commitment involved
  • Increasing the time available to module developers to focus on new features for their D7 release
  • Increasing the likelihood that developers will port their modules on a timely basis with the D7 release

As part of this effort to update Deadwood, I would appreciate the assistance of developers to test its conversion routines, help correct any errors and suggest enhancements. I would like to remind everyone that Deadwood is not intended to perform all conversions but rather to do a great percentage of the mundane changes needed to port a module, thus leaving only a minimum number of changes requiring manual attention.

Role Model

In my opinion, the Firefox plug-in developers are excellent role models for us. They have new versions of their plug-ins ready in conjunction with new Firefox releases. (Is there anyone who doesn't appreciate this?) Let's have the Drupal community emulate this practice.


Subscribe to RSS - Planet Drupal