Upgrading to Drupal 9: The Complete Plan

Rashed Azzam

Drupal has promised unprecedented smoothness when upgrading to a newer version, and with the launch of Drupal 9 only a few months away, we prepared this article for you to make sure you’re not left behind! 

In this article, we will cover what needs to be done before upgrading to Drupal 9, and we will show you how to avoid the commonly faced post-Drupal Upgrade issues. After that, it’s going to be your call on whether Drupal has fulfilled its promises or not!

 

Before Upgrading to Drupal 9

Drupal 9 possesses all the functionalities of Drupal 8, yet it exceeds it with unprecedented and revolutionary features. This of course increased the database requirements, but it also enhanced security levels. For instance, Drupal 9 relies on Symfony 4, and it requires PHP 7.3 or above; this results in unfathomable cyber shields and complete stability.

Drupal 9 still relies on jQuery but most of the components were removed from core. Also, CKEditor 4 is still available in Drupal 9, but it’s expected to be deprecated for removal in Drupal 10 since CKEditor 5 support is expected to be added later.

In Drupal 9.1, the front-end theme Olivero was introduced, and it’s expected to replace Bartik in the coming releases from Drupal 9 before getting rid of it in Drupal 10. Olivero is smoother, practical, and more accessible than Bartik.

We understand that it’s an exciting endeavor to finally upgrade to the latest available version of Drupal CMS. But it has to be noted that you need to have already upgraded to Drupal 8.8 or above before accessing the latest Drupal updates. So, once you make sure your site runs on Drupal 8.8 or 8.9, then you will be ready to access the newest Drupal update.

These are the necessary steps for upgrading Drupal 9:

  1. Ensure that there are no outdated modules on your site and that everything has already been updated to its latest versions. Old module versions may not be compatible with Drupal 9 and therefore result in unpredictable overhauls.
  2. Double-check if your hosting environment meets the minimum system requirements for Drupal 9 (or any other version you’re upgrading to)
  3. The deprecated code will be erased and removed after the Drupal 8 upgrade is done. So, fix any codes marked as deprecated unless you don’t mind losing them.
  4. Contributed projects, themes, and custom code as well must be up to date and Drupal 9 compatible.
  5. Update Drupal core codebase to Drupal 9

If you’re done making all the necessary updates, the process is expected to run smoothly and easily from this part on. And you can use the Upgrade Status to check their compatibility. However, in the next part, we will walk you through the step-by-step journey of updating Drupal 8 to Drupal 9.

The Process of Updating Drupal 8

Step 1: Create a Module Inventory and Run a Test

1.1 Creating Module Inventory

Drupal 8.9 and Drupal 9 have the same codebase. But we can’t stress enough that all deprecated codebases will be erased after you upgrade to Drupal 9. The impact this will have on your website depends on what plugins you use, and the application programming interfaces (APIs) you deployed.

The pre-installed upgrade status module will be of great help in this stage, it will give a precise description of the information you’re tracking. Use a spreadsheet to organize the collected info.

However, when creating a module inventory you have to look at three things: Custom modules, Contrib modules, and themes.

A- Custom Modules

For safety purposes, install and enable Drupal-check. It will show you if you need to do any work in order to get your custom modules' codebase compatible with Drupal 9.

If any module has a compatibility issue, create a ticket for it in your ticketing system and insert detailed info about it. That way you’d know whether it’s a simple change such as a function, or it’s a major refactoring issue. Identifying these issues early in the process will save you a lot of time in the next steps. 

B - Contrib Modules

Create a list of groups in which you categorize your contrib modules based on the amount of effort required. Answering these questions will help you determine which goes where:

  • Which module has a Drupal 9 release and which doesn’t?
  • Are the required updates major or minor ones?
  • What modules are we forking or debugging that might need extra management to get to their Drupal 9 compatible version?
  • Is it going to have a new release or will it be replaced by a new module?

At the end of the process, you may have a sheet that looks like this:

  • Group 1: minor tagged release available
  • Group 2: Major tagged release available
  • Group 3: Minor dev release available, unforked
  • Group 4: Major dev release available, unforked
  • Group 5: Major release available, forked
  • Group 6: Unavailable releases
C - Themes

Themes can be tracked and treated as modules. The Upgrade Status module will help you spot unsupported templates if you use Twig, but most projects aren’t expected to require any changes. 

1.2 Run a Test

Also, test your website before starting the update. Perform a test update (using the Update Manager) on a non-production system before you start an update in production. This is to guarantee that everything works fine, and that there are no bugs during the actual update process.

If you just updated to 8.8 or 8.9, a good way to test for things that don't work right is by testing your site's mobile version, but you need to try everything on all the possible screens in order to see that everything works as it may.

Step 2 - Ensure Your Site Can Safely Start the Update

It's common for a site to be in poor shape after an update. This means that many updates will take a long time, often resulting in lots of errors and warnings. Also, if one patch fails, it can cause your site to be broken and possibly even need to be reinstalled!

To ensure this doesn't happen to your site, start by updating all installed contributed modules first, before moving on to the core. You should also consider updating any custom modules (i.e. contributed modules not included in the core module list). It is a good idea to always check your custom modules as well, even if you don't notice any issues.

This is important because, after a Drupal 8 upgrade, every module will have to be manually updated by site administrators. This means that each module needs to be installed and activated again. You will find out more about how to update each of the modules later in the article.

Step 3 - Update The Modules & Themes

Now your modules are already running on Drupal 8.8 or higher, you created the inventory, migrated the codebase and data, and you tested everything’s compatibility! You are ready to upgrade Drupal 8 to Drupal 9.

If you are using a local workstation or Virtual Hosting with Git, make sure to commit your code after each stage of the upgrade. This will make it easier for you to roll back if something goes wrong during an update.

The Upgrade Process

Now that everything is ready to go for your next Drupal core upgrade, you can start the actual upgrade process.

The basic upgrade process consists of the following steps:

  • Step 1: Upgrade Drupal Core
  • Step 2: Update all custom modules  (use Drupal-check to check for deprecations)
  • Step 3: Perform database updates 
  • Step 4: Review modified files
  • Step 5: Clear caches, monitor your logs, and verify your site is working

Note: In some cases, you may need to repeat these steps several times before your site has been fully upgraded to Drupal 9.

Perform a backup before every update with Drupal core, you should create a backup of your site manually or using Drush. This will ensure that no data loss occurs during the upgrade process since it can become necessary for you to roll back an update if you have encountered an error that cannot be fixed through the normal uninstall process.

Useful Advice: 

We recommend that you use the following tools to perform the upgrade process:

Adminer or phpMyAdmin – Cross-platform SQL management system (via PHP/MySQL)

Drupal Console and/or Drush – Command-line tool that enables you to easily accomplish many of the tasks related to Drupal 8/9 development

Git for Git users – As your site gets more complex, it often becomes harder to work on version control. We recommend using Git for the Drupal 8 upgrades. This will ensure that if something goes wrong during an update, you can just roll back and start over from the point where you left off (until the point when everything went wrong).

 

In sum

Compared to upgrading Drupal 7 to Drupal 8, upgrading to Drupal 9 is pretty easy. This means that Drupal, to an extent, has kept its promises and carried a great effort to make the process accessible to more users. But the process is still long and demanding for the vast majority.

If you happened to be one of those facing an issue with the upgrade, it’s okay! You’re not the only one. In fact, our Acquia-certified team helps tens of satisfied clients upgrade and migrate their websites seamlessly. With us, it is guaranteed that you get:

  • 100% Secure Data Migration
  • Automated Migration Plans
  • Hassle-Free Project Launch
  • Superior Website Performance
  • Continuous Quality Assurance