[SOLVED] How To Upgrade Contributed Module Of Drupal 7 To Drupal 8 Using Drupal Module Upgrader
BY akhila.vn
2 years ago

For upgrading any of your contributed Drupal 7 modules, you just need to follow the few steps shown below. First of all you have to make sure that Drush is installed. If not installed, follow the steps from here.

Now install a fresh Drupal 8 in your system using Drush commands or directly download from Drupal.org. You must be aware that Drupal 8 has changed its structure from Drupal 7 in configuration, theming, folder structure etc. So now we can find the contributed and custom modules in the modules folder in the root directory. It is also better to create a contrib folder in modules folder for both DMU (Drupal Module Upgrader) and your Drupal 7 module for migration.

And now let's have a look at DMU. Drupal Module Upgrader is a script that scans and upgrades the source code of your Drupal 7 module, it also generates a list of new fixes with information links to Drupal.org as an upgrade-info.html file that will be available in your upgrading module directory. Also note that, this DMU scripts will run using Drush and Composer.

Now get into your Drupal 8's contrib folder using the terminal (For example: cd public_html/d8/modules/contrib) and follow the steps :

  • Download DMU using the drush command drush dl drupalmoduleupgrader. For example :
    [email protected]:~/public_html/d8/modules/contrib$ drush dl drupalmoduleupgrader
    Project drupalmoduleupgrader (8.x-1.2) downloaded to                 [success]
  • Now get into your Drupal module upgrader folder and install Composer. For example:
    [email protected]:~/public_html/d8/modules/contrib$ cd drupalmoduleupgrader/
    [email protected]:~/public_html/d8/modules/contrib/drupalmoduleupgrader$ composer install
    Loading composer repositories with package information
    Installing dependencies (including require-dev) from lock file
      - Installing cebe/markdown (dev-master f89dc1d)
        Cloning f89dc1da1fc6823f0286d6cad736a642efd0f59e
      - Installing phpdocumentor/reflection-docblock (2.0.4)
        Loading from cache
      - Installing grom358/pharborist (dev-master 0db9e51)
        Cloning 0db9e51299a80e95b06857ed1809f59bbbab1af6
      - Installing symfony/filesystem (2.6.x-dev 823c035)
        Cloning 823c035b1a5c13a4924e324d016eb07e70f94735
      - Installing symfony/finder (2.6.x-dev 203a10f)
        Cloning 203a10f928ae30176deeba33512999233181dd28
      - Installing mikey179/vfsstream (v1.5.0)
        Loading from cache
      - Installing phpunit/php-token-stream (1.4.8)
        Loading from cache
      - Installing symfony/yaml (v2.7.4)
        Loading from cache
      - Installing sebastian/version (1.0.6)
        Loading from cache
      - Installing sebastian/global-state (1.0.0)
        Loading from cache
      - Installing sebastian/recursion-context (1.0.1)
        Loading from cache
      - Installing sebastian/exporter (1.2.1)
        Loading from cache
      - Installing sebastian/environment (1.3.2)
        Loading from cache
      - Installing sebastian/diff (1.3.0)
        Loading from cache
      - Installing sebastian/comparator (1.2.0)
        Loading from cache
      - Installing phpunit/php-text-template (1.2.1)
        Loading from cache
      - Installing doctrine/instantiator (1.0.5)
        Loading from cache
      - Installing phpunit/phpunit-mock-objects (2.3.7)
        Loading from cache
      - Installing phpunit/php-timer (1.0.7)
        Loading from cache
      - Installing phpunit/php-file-iterator (1.4.1)
        Loading from cache
      - Installing phpunit/php-code-coverage (2.2.3)
        Loading from cache
      - Installing phpspec/prophecy (v1.5.0)
        Loading from cache
      - Installing phpunit/phpunit (4.8.9)
        Loading from cache
    phpdocumentor/reflection-docblock suggests installing dflydev/markdown (~1.0)
    phpdocumentor/reflection-docblock suggests installing erusev/parsedown (~1.0)
    sebastian/global-state suggests installing ext-uopz (*)
    phpunit/php-code-coverage suggests installing ext-xdebug (>=2.2.1)
    phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
    Generating autoload files
  • Get back to your contrib folder and clone your Drupal 7 module to it. You can find its cloning commands from its Drupal.org version control page. Here for example: commerce_techprocess is used as Drupal 7 module for migration.
    [email protected]:~/public_html/d8/modules/contrib/drupalmoduleupgrader$ cd ..
    [email protected]:~/public_html/d8/modules/contrib$ git clone --branch 7.x-1.x http://git.drupal.org/project/commerce_techprocess.git
    Cloning into 'commerce_techprocess'...
    remote: Counting objects: 23, done.
    remote: Compressing objects: 100% (22/22), done.
    remote: Total 23 (delta 6), reused 0 (delta 0)
    Unpacking objects: 100% (23/23), done.
    Checking connectivity... done.
  • Get back to your site root directory and enable drupalmoduleupgrader.
    [email protected]:~/public_html/d8$ drush en drupalmoduleupgrader
    The following extensions will be enabled: drupalmoduleupgrader
    Do you really want to continue? (y/n): y
    drupalmoduleupgrader was enabled successfully.                       [ok]
  • Now start analysing your module using the upgrader, it will list out the fixes and generate an html info file.
    [email protected]:~/public_html/d8$ drush dmu-analyze commerce_techprocess --path=modules/contrib/commerce_techprocess/
    Generated a report at                                                [success]
  • After all, you can upgrade your module using the command,
    [email protected]:~/public_html/d8$ drush dmu-upgrade commerce_techprocess --path=modules/contrib/commerce_techprocess/
    It will automatically create some of the Drupal 8 supporting files (for example: .info.yml, .routing.yml etc) and update some of your module codes, and other main functionalities will be commented and provide a @FIXME comment along with it. So that you can easily findout the necessary fixes that the DMU can't do.

Now enable your module and fix the issues in Drupal 8 syntax. Also note that your .info or other Drupal 7 supporting files will be there which can be easily removed after fix(if it has no use) and completely upgrading your module codes. Now test your code.

Happy Coding!



on 01st January 2008 / by webmaster
We have added a few new modules to our site recently. Drupal Technical StumbleThis Sean (not verified) access_time 01 Aug 2021 - 15:33 Hi there, I uploaded the files, enabled the modules to use SU, and now I see the link, but there is no icon... How can I fix this? Thanks, Sean webmaster access_time 01 Aug 2021 - 15:33 In reply to Icon doesn't show by Sean (not verified) What do you see when you view the source? Search for stumblethis_button and you should be able to see the code for the image and the URL. Then you should be able to troubleshoot from there. Juicy Couture Addict (not verified) access_time 01 Aug 2021 - 15:33 thanks for the post. would love to hear more of you. by the way, drupal's really popular nowadays as it has easy and fast features. you agree with me? thanks.

on 16th January 2008 / by webmaster
Most webmasters do not realize this, but a lot of the content on lot of websites can be accessed from multiple URLs. A simple example would be where www.example.com and example.com leads to the same page. This is a fatal mistake in Search Engine Optimization and search engines penalize you for duplicate content. The correct configuration would be where the above two urls will lead you to the same page but example.com will redirect you to www.example.com with a 301 (Moved permanently) status which will not result in search engines penalizing the page. It is very easy to configure 301 redirects using Apache .htaccess file and the process is the same for a Drupal installation also. Drupal Technical Apache htaccess SEO Anonymous (not verified) access_time 01 Aug 2021 - 15:33 Hello. I'm trying to make example.com show as www.example.com, and I'm running into difficulties. I'm on Apache 2.0 and using the following lines in my httpd.conf file: RewriteEngine on RewriteCond %{HTTP_HOST} ^xxxxxxxxxx\.com$ [NC] RewriteRule ^(.*)$ http://www.xxxxxxxxxx.com/$1 [L,R=301] When I go to http://xxxxxxxxxx.com, I get http://www.xxxxxxxxxx.com (as expected). However, when I go to http://xxxxxxxxxx.com/node/1 (it's a Drupal site), I get a 404 thrown and the URL changes to xxxxxxxxxx.com/var/www/drupal/node/1. Same thing with www.xxxxxxxxxx.com/node/1. Any suggestions? I want to run without Drupal's .htaccess file (instead incorporating these calls into my httpd.conf file). webmaster access_time 01 Aug 2021 - 15:33 In reply to Rewrite including filesystem path by Anonymous (not verified) I think the problem is with the base path which results in the redirection to /var/www/ part. The best approach I would think is to start with drupal htaccess and then strip out parts and move to httpd SNVC (not verified) access_time 01 Aug 2021 - 15:33 This is definitely a good guide. Thanks for this. wellyson access_time 01 Aug 2021 - 15:33 This is really nice and helpful.

on 08th February 2008 / by webmaster
Attachment Size slashdotit.tar.gz 173.55 KB Similar to the StumbleThis module that we had created earlier we have created another bookmarking Drupal Technical Slashdotit Shlomi Fish (not verified) access_time 01 Aug 2021 - 15:33 Hi! I'm interested in this module, but Drupal 6.2 complains that it's incompatible with it. Can you please update it or tell me how? Regards, Shlomi Fish shlomifish.org webmaster access_time 01 Aug 2021 - 15:33 In reply to Can you update it for Drupal-6.x? by Shlomi Fish (not verified) Sure we are working on this currently and will post an update soon. Also we will post this module on www.drupal.org as well Cheers Anoop John Team Zyxware Anonymous (not verified) access_time 01 Aug 2021 - 15:33 Hello! Nice Article very interesting, thanks