Drupal upgrades: tools and workflow
This page is part of my digital garden. It is more like a notebook entry than a polished blog post. It’s a space where I document learnings primarily for my own reference, yet share them in case they benefit others. Unlike my blog posts, these pages are works-in-progress and updated over time. Like tending to a real garden, I periodically refine its content. I welcome suggestions for improvements at dries@buytaert.net.

$ ddev composer require –dev mglaman/drupal-check

  • Drupal Check is a command-line tool that scans Drupal projects for deprecated code and compatibility issues.

    Tools overview

    Tool Interface Functionality Target Audience
    Upgrade Status module UI in Drupal Identifies deprecated code, hosting environment compatibility, and more Site administrators and developers
    Drupal Check Command-line Identifies deprecated code Developers, especially during coding and continuous integration (CI)

    Upgrade Status module

    Installation:

    Screenshot of Drupal 11 upgrade status report in the administration interface.
    Screenshot of a Drupal upgrade status report showing hosting environment compatibility checks.




    1. $ ddev drush pm-enable upgrade_status
      I always run drupal-check before updating my Drupal site’s code and third-party dependencies. This helps ensure there are no compatibility issues with the current codebase before upgrading. I also run drupal-check after the update to identify any new issues introduced by the updated code.
    2. To update the PHP version of DDEV, use the following command:
      $ ddev composer require –dev drupal/upgrade_status
      $ ddev debug migrate-database mariadb:10.11

      Enable the Upgrade Status module:

      The Upgrade Status module might recommend updating PHP and MySQL, per Drupal’s system requirements.

      The Upgrade Status module assesses a Drupal site’s readiness for major version upgrades by checking for deprecated code and other compatibility issues.

      Drupal Check

      $ ddev config –-php-version 8.3

      $ ./vendor/bin/drupal-check –-memory-limit 500M docroot/modules/custom
      In the future, I’d like to evaluate whether using PHPStan directly is simpler. This is a TODO for myself. Drupal Check is essentially a wrapper around PHPStan, offering default configuration such as automatically running at level 2. To achieve the same result with PHPStan, I should be able to simply run:
      When a new major version of Drupal is released, custom code often requires updates to align with API changes, including the removal of deprecated APIs.
      Because I keep forgetting certain aspects of this workflow, I decided to document it for future reference.

    Using PHPStan directly

    Install the Upgrade Status module like you would install any other Drupal module:

    $ php vendor/bin/phpstan analyze -l 2 docroot/modules/custom
  • Similar Posts