Drupal Module Upgrader

Porting drupal 7 module to drupal 8 using Drupal Module Upgrader

We started to migrate our sites from drupal 7 to drupal 8, but we need our Drupal modules also to be ported from Drupal 7 to 8 and it’s time to port the same, Due to substantial changes in Drupal 8 from its previous versions, we "Drupal developers" find it hard to porting the modules from drupal 7 to drupal 8. This is mainly because Drupal 8 is object-oriented and much closer to a Model View Architecture(MVC), Drupal is no longer a Presentation Abstraction Control (PAC) architecture framework, Drupal follows the PSR-4 folder structure incompatible with Symfony component which Drupal 8 uses. To make our porting fast, we can use Drupal module upgrader.

Let's see what is a Drupal Module Upgrader?

Drupal Module Upgrader

Drupal Module Upgrader is a module which scans the source of a Drupal 7 module, and that flags any code that requires updating to Drupal 8 and it will attempt to *convert* the Drupal 7 code automatically to the Drupal 8 version using the relevant API changes which notice from Drupal List changes

 For a full description of the module, visit the project page:



Installing the module

This module requires drush 8 or above, Assuming that the drush 8 installed in your system if it isn’t please visit how to install drush with the composer. Use the following Drush commands

drush dl drupalmoduleupgrader
cd modules/drupalmoduleupgrader
composer install

composer install


drush en drupalmoduleupgrader


  1. Place the Drupal 7 module which you wish to port into your Drupal 8 site's /modules directory. (not in sites/all/modules as like in drupal7)

  2. To scan code and get a report of code that needs updating and how to run the following Drush commands inside the Drupal 8 root directory:
drush dmu-analyze MODULE_NAME


      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



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

Workarounds to @FIXME Tags

  • Enabling your drupal module can still throw off errors and/or give you a white screen death, even after the DMU-upgrade has executed successfully,  This is mainly because of the program while executing, skips call by references and minute changes like that. If you read your code after dmu-upgrade is done, you will see comment tags @FIXME. This is to indicate where the changes have to manually be done. Almost every change will be mentioned throughout the code and links to the corresponding change records are present in the html file generated by DMU-analyze

  • Only run dmu-clean after the code is bug-free and perfectly functional. Otherwise, the old code will be removed which had to be changed manually.


The Drupal Module Upgrader (DMU) module despite being in the development stages, saves developers a lot of time when upgrading modules to be compatible with Drupal 8.


If you need any help for Drupal Backup and Migrate, Feel free to Talk to Us for your Enterprises.