DATE

TIME TO READ

If you’ve been meaning to upgrade your site from Drupal 8 to Drupal 9 but haven’t had the chance yet, this is for you. Although the process should be straightforward, unexpected errors, issues and obstacles can turn a simple project into a hellish conundrum. With only a handful of weeks to commit the upgrade, the risk of running into last minute problems grows.

After successfully completing multiple Drupal 8 upgrades, we figured sharing some of the problems we’ve solved could help others out of a sticky situation. To save you time (and frustration) during your own upgrade project, here’s our breakdown of what you need to know before upgrading from Drupal 8 to Drupal 9!

Get up to date with Composer

Composer is a necessary tool for Drupal 9 that helps you manage modules. It downloads modules and manages the dependencies between them, allowing for easier updates and patches. Depending on when your website was built, you may or may not have used Composer to manage it. From a development point of view it’s not a hard task to switch to a Composer-managed site, however it can be a time consuming feat.

The next steps you take are dependent on which scenario applies to your site:

  1. Your site was built in Drupal 8 during its infancy. In this instance, you might not use Composer at all and will need to switch the site over to using it.
  2. Your site was built using Composer. If you fall into this category, you should be ready to migrate to Drupal 9.

As a best practice, be sure to check which version of Composer your site is using. If you’re using version 1, it’s worth considering upgrading to version 2, as it operates much faster than the previous version.

Updating your modules

So your site’s controlled by Composer, now what should you do? It’s time to tackle your modules. Not every module is compatible with Drupal 9; if you try to upgrade one that isn’t compatible, you could break your site. But don’t worry, there’s a solution at hand!

Using a module called Upgrade Status, you can quickly identify Drupal 9 compatible modules, and pinpoint those that need extra work to get them ready. You can also view which bits of code need changing, i.e where deprecated functionality needs to be updated. If any functions are no longer valid, you’ll need to rewrite them or hire a Drupal development agency to sort this step.

There are two types of modules: Contrib (modules written by the Drupal community) and Custom (written by the developers of your website). The majority of incompatible code can be fixed by telling Upgrade Status to scan your modules, and then following the remedial advice that it provides.

If you’re using an actively updated contrib module, then half the battle is done. For most maintained contrib modules, you can tell Composer to grab the latest version and it will update the code accordingly. However, many contrib modules aren’t actively maintained, even if they’re widely used by the Drupal community. These will be listed in upgrade status under the heading ‘Collaborate with maintainers’.

This section is a list of modules that aren’t compatible with Drupal 9, as their ongoing maintenance and development has been abandoned. As a first step, you should consider if you really need the functionality that these modules provide. If you do, then head over to the modules ‘Issues’ list to see if the community has written a patch to make the module Drupal 9 compatible. If there is a patch, you’ll need your development team to work their magic and complete the necessary work to install the patch. Thankfully, there are useful resources out there that can guide your team through most sticky situations.

If there are no patches available for the module, then you’ll need to get your development team to update it for compatibility. You can see how development time can add up, even from the beginning of the upgrade, regardless of whether you have done all the right prep ahead of time.

The last step is the easiest: look through the ‘Remove’ section of contrib modules and get removing.

Once all of your modules are compatible with Drupal 9, you’re ready to upgrade.

Unexpected errors

So you’ve gone through your modules with a fine tooth comb and finally upgraded to Drupal 9 - hoorah!

But all of a sudden…. your site has broken.

Even with the right tools like Upgrade Status, you may still find unexpected errors that need fixing. Our dev team came up against problems such as invalid library config files; with Drupal 8 there weren’t any issues if you omitted a space after a colon in the code, whereas in Drupal 9 small details like that can break the code.

Some errors can’t always be detected, so ensuring you’ve given your team enough time to work on any issues should they arise is imperative for a smooth upgrade. If you’re outsourcing your Drupal development, it’s wise to account for additional budget in case an unforeseen problem works its way into the upgrade project.

The looming Drupal 8 end of life date

As we get closer to November 2nd 2021, Drupal 8’s end of life date, more site owners will be getting their upgrade projects underway. Even in the last six months an increasing amount of updates have been released for modules, so they can be successfully upgraded to Drupal 9.

If you haven’t got the ball rolling yet, you still have time. With more solutions at your disposal, the process of upgrading should be easier than it was even a few months ago. But make sure you leave enough time to account for any unforeseen errors or necessary additional development time.

Need support with module patches or the general upgrade process? Give our team a call on 01865 422 112 or drop us a message and we’ll be happy to help.