This project is a command-line script that scans the source of a Drupal 7 module, flags any code that requires updating to Drupal 8, points off to any relevant API change notices, and (where possible) will actually attempt to convert the Drupal 7 code automatically to the Drupal 8 version! The goal is to hit the most widely-used Drupal hooks and ensure there's coverage for them. See the current battle plan.

Check out the latest demo video:

Brought to you by:

With generous support from:
PreviousNext

Installation

See README.txt for installation and set up instructions. Note that installing this script requires Composer and Drush.

Basically:

drush dl drupalmoduleupgrader
cd modules/drupalmoduleupgrader
composer install
drush en drupalmoduleupgrader

Usage

  1. Place the Drupal 7 module you wish to port into your Drupal 8 site's /modules directory.
  2. To scan code and get a report of code that needs updating and how, run
    the following inside the Drupal 8 root directory:
    drush dmu-analyze MODULE_NAME
    

    This will print a report showing any relevant change notices where you can
    read more.

  3. To attempt to upgrade your Drupal 7 module's code to Drupal 8 automatically,
    run the following inside the Drupal 8 root directory:
    drush dmu-upgrade MODULE_NAME
    

    The script will output a few lines as it attempts various conversions. Go into your modules/MODULE_NAME directory and check out all of your new YAML files and such. ;)

  4. Background

    The code upgrade routines are implemented as a series of Drupal 8 plugins wrapped by a Drush extension and using Pharborist to do the code conversions. For information on how Drupal Module Upgrader works under the hood to help contribute sniffs and plugins, see the developer docs.

    About releases

    Drupal 8 is still undergoing active development, and introducing API changes between beta releases in order to fix critical bugs. As a result, Drupal Module Upgrader (DMU) releases work as follows:

  • The latest stable release of DMU should be compatible with the latest beta/rc release of Drupal 8.
  • DMU's -dev release chases the tip of the 8.0.x branch as much as possible.

Choose whichever release accommodates your Drupal 8 workflow: chasing betas/rcs or chasing HEAD. If DMU is not working as expected, please let us know.

Supporting organizations: 
Created / funded development of project
Extremely active upstream maintenance of Pharborist library

Project Information

Downloads