Drupal 8 Updates

Revision as of 10:50, 15 November 2019 by Ian McBride (talk | contribs)


There are no exclusions at this time.


Composer allows us to peg modules and dependencies at specific versions. We do this to ensure that updates are not applied unless we specifically request them. These are common formats for versions of Drupal core and its modules.

Tagged Release

Core release 8.5.3 = composer require --no-update drupal/core:8.5.3

Module anchor_link release 8.x-1.6 = composer require --no-update drupal/anchor_link:1.6

Module twig_tweak 8.x-2.0 = composer require --no-update drupal/twig_tweak:2.0

Alpha / Beta / RC Releases

Module block_field 8.x-1.0-alpha5 = composer require --no-update drupal/block_field:1.0-alpha5

Module media_entity_audio 8.x-1.0-beta3 = composer require --no-update drupal/media_entity_audio:1.0-beta3

Module diff 8.x-1.0-rc1 = composer require --no-update drupal/diff:1.0-rc1

Development Releases

Generally, we want to avoid pegging to a development release, however this is sometimes necessary if we need to apply a patch which will only apply cleanly to the dev branch or if a module maintainer has committed a critical patch, but has not released a stable tagged release. Whenever we use a dev release, we should get the hash of the commit we've tested against and include it in the composer requirements. This prevents composer from downloading commits past that hash.

Module olark 8.x-1.x-dev = compooser require --no-update drupal/olark:1.x-dev#940ab50528b683c12ca6208daec06d38899b883a

Module token_language 8.x-1.x-dev = composer require --no-update drupal/token_language:1.x-dev#489c8ca30d165b6aaeba3e5dc65bd17b967a8b54

Adding Modules

  1. Adding module via composer involves first telling composer to add the module to composer.json while not performing other updates:

    composer require --no-update drupal/MODULE_NAME:VERSION
  2. Next we tell composer to rebuild the composer.lock file with any dependencies, and install the odule and its dependencies:

    composer update --with-dependencies nothing

Running "composer install" will install everything listed in the composer.lock file and not make any updates to it or the composer.json. This is useful after a "git pull" to install any new dependencies.

Updating Modules

  1. Go to https://www.middlebury.edu/institute/admin/reports/updates and click on Check Manually to fetch the latest version information. The settings on the Institute site are configured to check for all modules, including those disabled on the site.
  2. cd ~/private_html/institute
  3. git pull
  4. Create a new branch to test the module updates, based on the master branch.
    1. git checkout --track -b updates-20180601
    2. git push -u origin updates-20180601
  5. For each module:
    1. composer require --update-with-dependencies drupal/MODULE_NAME:VERSION (see the Versions section above)
    2. If you receive as error such as: "Could not apply patch! Skipping."
      1. Check the module's dev log to see if the named patch was incorporated into the new release
      2. If so, you can remove the patch from composer.json and run composer require again.
    3. Check to ensure that only the module and composer files were changed using git status.
    4. git add composer.*
    5. git add -A web/modules/contrib/MODULE_NAME
    6. git commit -m "MODULE_NAME: Upgraded module from OLD_VERSION to NEW_VERSION. For #NNN."
      1. "NNN" is the number of the issue in Github for updating the modules this week.
    7. Update the Weekly Updates Post with "Drupal MODULE_NAME NEW_VERSION" linking to the releases page on drupal.org.
  6. Check whether the module updates require database schema changes:
    1. drush8 -y updatedb
    2. If the module requires schema changes, do not deploy it until scheduled downtime on Thursday morning.
  7. git checkout master
  8. git merge --no-ff -m "Fix #NNN updates." updates-20180601
  9. git push
  10. Follow the Drupal 8 Deployment process. Make sure to use the -c flag.
Powered by MediaWiki