Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Upgrading to Drupal 9

Upgrading to Drupal 9

For most Drupal Developers and users, the idea of moving a project from one major version of Drupal to another can be daunting, with modules and themes having to being changed significantly or rebuilt completely, and data being migrated from the old site to the new one.

This was no more so than the move from Drupal 7 to 8, but luckily this has changed for Drupal 9 and an upgrade can be done with minimal changes and not a data migration in sight!

In this talk, we'll look at some of the changes to Drupal's tools and processes that have made this possible, and how to move your Drupal site to Drupal 9.

https://www.oliverdavies.uk/talks/upgrading-your-site-drupal-9

Oliver Davies

April 22, 2021
Tweet

More Decks by Oliver Davies

Other Decks in Technology

Transcript

  1. The D7 release cycle • One long-running branch • Minor

    versions for bug fixes (7.80, April 2021) • No big, new features • Long time for changes to get committed to core @opdavies
  2. The D8 release cycle • Semantic versioning for core •

    Minor release (new features) every 6 months • Patch release (bug fixes) every month • Multiple supported versions of core (8.9, 9.0, 9.1) @opdavies
  3. Drupal 8 vs Drupal 9 • No new functionality •

    Deprecated code removed • PHP required version increased • Major versions of dependencies updated @opdavies
  4. Previous upgrade issues • Lots of breaking changes • Core

    released, but contrib takes time to catch up @opdavies
  5. Contrib improvements • Minimal code changes required • Single release

    can support multiple versions of core • Semantic versioning enabled for contrib projects @opdavies
  6. Deprecation example function drupal_set_message($message = NULL, $type = 'status', $repeat

    = FALSE) { @trigger_error('drupal_set_message() is deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0. Use \Drupal\Core\Messenger\MessengerInterface ::addMessage() instead. See https://www.drupal.org/node/2774931', E_USER_DEPRECATED); $messenger = \Drupal::messenger(); if (isset($message)) { $messenger->addMessage($message, $type, $repeat); } return $messenger->all(); } @opdavies
  7. Drupal Check • Developed by Matt Glaman • "Built on

    PHPStan, this static analysis tool will check for correctness (e.g. using a class that doesn't exist), deprecation errors, and more." • https://github.com/mglaman/drupal-check @opdavies
  8. PHPUnit Bridge • Drupal 8 uses Symfony's PHPUnit Bridge •

    Includes a 'Deprecation Helper' • Displays deprecation notices in test output @opdavies
  9. Composer • Dependency management tool for PHP • My preferred

    way to manage Drupal codebases • composer.json lists your dependencies and version constraints • composer.lock stores the installed dependencies and versions • Separate packages for core-recommended, core-dev and core-composer-scaffold @opdavies
  10. Upgrading Dransible • Remove Drush (temporarily) • Update from Drupal

    8.8 to 8.9 • Add Upgrade Status module • Update contrib modules to D9 compatible versions • Remove incompatible contrib modules (if possible) • Fix deprecations in custom code • Upgrade from Drupal 8.9 to 9.0 @opdavies
  11. Cannot autowire service "Drupal\simple_message\Display SimpleMessage": argument "$messenger" of method "__con

    struct()" references interface "Drupal\Core\Messenger\ MessengerInterface" but no such service exists. You sh ould maybe alias this interface to the existing "messe nger" service @opdavies
  12. Fixing autowiring services: + Drupal\Core\Messenger\MessengerInterface: + alias: messenger + private:

    true Drupal\simple_message\DisplaySimpleMessage: autowire: true tags: - { name: event_subscriber } @opdavies
  13. The big deal about Drupal 9 is... that it should

    not be a big deal Dries Buytaert @opdavies
  14. Drupal 10 • Released around June 2022 • Drupal 9

    EOL around November 2023 • Symfony 4 EOL in November 2023 • Another easy upgrade @opdavies