Last updated January 22, 2012. Created by solotandem on February 12, 2010.
Edited by juan_g. Log in to edit this page.

The Coder Upgrade module provides a powerful, automated solution to assist developers wishing to upgrade a module for changes in the Drupal core API (or the API provided by any contributed module; for an example of this, click here). This tool relies on the Grammar Parser library to upgrade a module's code files. In addition, Coder Upgrade allows upgrade routines to be written using regular expressions. The latter type of routines are not emphasized due to the concerns with false positives (i.e. code incorrectly identified as needing change).

The Grammar Parser 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.

The Grammar Parser is the new parsing engine for the API module which generates the documentation elements displayed on the Drupal API site. The Grammar Parser can parse interfaces and classes, which have become more popular in D7 (e.g. database layer and views).

The Coder Upgrade and Grammar Parser duo can also be used to:

  • Update Drupal 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.
  • Review code files for security issues.

See also Coder Module: Easily Port Modules to Drupal 7, DrupalCon video on this topic.

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.