16 Drupal Module Upgrader is a script that scans the source of a Drupal 7 module,
17 flags any code that requires updating to Drupal 8, points off to any relevant
18 API change notices from https://www.drupal.org/list-changes/, and (where
19 possible) will actually attempt to *convert* the Drupal 7 code automatically to
22 * For a full description of the module, visit the project page:
23 https://drupal.org/project/drupalmoduleupgrader
24 * To submit bug reports and feature suggestions, or to track changes:
25 https://drupal.org/project/issues/drupalmoduleupgrader
31 1. Place the Drupal 7 module you wish to port into your Drupal 8 site's
34 2. To scan the code and get a report of code that needs updating and how, run
35 the following inside the Drupal 8 root directory:
37 drush dmu-analyze MODULE_NAME
39 This will print a report showing any relevant change notices where you can
42 3. To attempt to upgrade your Drupal 7 module's code to Drupal 8 automatically,
43 run the following inside the Drupal 8 root directory:
45 drush dmu-upgrade MODULE_NAME
47 The script will output a few lines as it attempts various conversions. Go
48 into your modules/MODULE_NAME directory and check out all of your new YAML
51 4. To clear out D7 code that has been converted, run the clean command:
53 drush dmu-clean MODULE_NAME
55 This will do things like delete old .info files and such, so you're closer to
56 your port being completed!
60 This project requires the following dependencies:
62 * Composer (https://getcomposer.org)
63 * Drush 7+ (https://github.com/drush-ops/drush)
64 * Pharborist (https://github.com/grom358/pharborist)
65 * Symfony Yaml Component (https://github.com/symfony/Yaml)
67 Note that most dependencies are automatically downloaded by Composer during
74 0. Download and install Composer:
76 https://getcomposer.org/doc/00-intro.md#system-requirements
78 1. Download and install the latest version of Drush:
80 https://github.com/drush-ops/drush#installupdate---composer
82 2. Download and install the latest Drupal 8:
84 git clone --branch 8.0.x http://git.drupal.org/project/drupal.git 8.x
86 3. Download the latest release of drupalmoduleupgrader to your Drupal 8 site’s
89 drush dl drupalmoduleupgrader
91 4. Run `composer install` from the drupalmoduleupgrader directory:
93 cd drupalmoduleupgrader
96 You should see output as it downloads various dependencies (pharborist,
99 5. Finally, enable the module:
101 drush en drupalmoduleupgrader -y
106 * If you are getting any errors, check the following first:
107 - Are you using the very latest Drupal 8 code? From the 8.x root directory,
110 - Are you using the very latest drupalmoduleupgrader code (and dependencies'
111 code)? From the drupalmoduleupgrader root directory:
114 drush pm-uninstall drupalmoduleupgrader -y
115 drush en drupalmoduleupgrader
121 Drupal Module Upgrader uses Composer to install its dependencies inside the
122 module folder. Since it operates as a standalone project this is perfectly
123 fine. However if we want to run the tests we have to use a different strategy.
124 Drupal core itself also uses Composer, and it manages its dependencies and
125 namespaces inside the core/vendor/ folder. It is unaware of DMU's dependencies
126 and the tests will fail.
128 We can use Composer Manager [1] to generate a new composer.json file in the
129 root of the Drupal site. This will combine the dependencies of Drupal core and
130 all contributed and custom projects.
133 0. Navigate to the root folder of your Drupal installation:
135 cd /path/to/drupal/site/
137 1. Download Composer Manager:
139 drush dl composer_manager
141 2. Initialize Composer Manager:
143 php modules/composer_manager/scripts/init.php
145 3. Install the combined dependencies of Drupal core and modules:
147 composer drupal-install
151 ./vendor/bin/phpunit -c core --group=DMU
156 Q: Wow, this thing is awesome! How does it work under the hood?
157 A: You're in luck! We have documentation describing DMU's overall architecture
158 and how to contribute:
159 https://www.drupal.org/documentation/modules/drupalmoduleupgrader/contributors
164 * Adam (phenaproxima) - https://www.drupal.org/u/phenaproxima
165 * Angela Byron (webchick) - https://www.drupal.org/u/webchick
168 * Gábor Hojtsy - https://www.drupal.org/u/gábor-hojtsy
169 * Jakob Perry (japerry) - https://www.drupal.org/u/japerry
170 * Jess (xjm) - https://www.drupal.org/u/xjm
171 * Lisa Baker (eshta) - https://www.drupal.org/u/eshta
172 * Wim Leers - https://www.drupal.org/u/wim-leers
175 * Cameron Zemek (grom358) - https://www.drupal.org/u/grom358 for all the
178 This project has been sponsored by:
180 Dream It. Drupal It. https://www.acquia.com
182 This project has been supported by:
184 Australia’s premium Drupal website consulting, design and development firm.
185 http://www.previousnext.com.au/
190 [1] Composer Manager: https://www.drupal.org/project/composer_manager