Voting starts in March for the Drupal Association Board election.
The Drupal Module Upgrader is a Drush command that helps you update your modules from Drupal 7 to Drupal 8.
Drupal Module Upgrader, or DMU from here on in, has two main modes of operation:
- Analyze mode (
drush dmu-analyze MODULE_NAME)
- In this mode, DMU will scan your Drupal 7 module and look for things that need to be changed in order to port the module to Drupal 8, and generate a nice-looking report that outlines the required changes and links off to the relevant API change records in each case that tell you how to do the port yourself.
- Upgrade mode (
drush dmu-upgrade MODULE_NAME)
- In upgrade mode, DMU will try to convert as much of your module to Drupal 8 as it can. The module code will be upgraded in place, so for example .info files converted to .info.yml, hook_menu() converted to controllers, etc. The goal is not to get the module 100% working, but rather to save you a ton of time on any D7 => D8 module port. However, in some cases it can get you far enough along that you can turn the module on and perhaps even see some basic things working (such as settings forms and blocks)!
NOTE: It is highly recommended that if you're brand new to Drupal 8 you run DMU in analyze mode only at first, and try and fix the things yourself manually. You'll be able to read the background behind many of the changes in D8, learn a lot about D8 in the process, and it will make future module porting much easier.
DMU supports converting Drupal 7 modules to Drupal 8 only. There are no plans to support Drupal 6 modules. To convert module code from Drupal 6 to Drupal 7, see the Coder Upgrade project.
DMU is a Drush command for Drupal 8, so you will need Drush 7.x and Composer. Download DMU and install it like any normal module, then run
composer install from within the DMU directory to install dependencies. (If you're using Composer Manager, you'll want to run
drush composer-manager install instead.)
Or, if you're that whole blurb reeks of effort and you just want to copy/paste some stuff:
cd /PATH_TO_DRUPAL_8_WEB_ROOT/modules/ drush dl drupalmoduleupgrader cd drupalmoduleupgrader composer install drush en drupalmoduleupgrader -y
Analyzing a Drupal 7 module
Move the Drupal 7 module into your Drupal 8 root (in the
modules directory). Then run
drush dmu-analyze MODULE_NAME.
If all goes well, a report will be generated in the module's directory, called upgrade-info.html. Open that and peruse at your leisure :)
Upgrading a Drupal 7 module
Same deal, except run
drush dmu-upgrade MODULE_NAME instead. Your module's code will be updated in-place:
git add . ; git diff --cached to see what it changed.
If desired, you can also run
drush dmu-clean MODULE_NAME and this will delete any old D7 code that was already ported (e.g. your old .info file), providing the DMU conversion plugin supports a cleanup operation.