Blog Upgrading to Drupal 9: Why and How to Do It 10 min
Digital TransformationDrupal

Upgrading to Drupal 9: Why and How to Do It

SparkFabrik Team10 min read
Upgrading to Drupal 9: Why and How to Do It

June 9, 2020 marked the birth of Drupal 9, the natural technological evolution of Drupal.
An event announced well in advance, which raises several questions for those currently using a previous version of the famous CMS. Is it worth upgrading? And how can it be done with the least possible impact in terms of time and cost?

In this article, we address the topic by briefly introducing Drupal 9 and then analyzing the best paths for upgrading to this latest version. Before we begin, if you are not yet familiar with all the advantages and features of Drupal, we recommend reading “Why Choose Drupal for Complex Enterprise Websites”.

What’s New in Drupal 9

During the DrupalCon held in Amsterdam in October 2019, Dries Buytaert presented the pillars on which this latest version of the platform is founded, which can make a significant contribution to the digital growth of businesses. In summary, here are the four strategic objectives that guided the creation of Drupal 9:

  • Reduce costs and effort: the goal is to continue investing in tools that allow site management and maintenance at lower costs and with less effort, such as automatic core or contrib module updates or more efficient configuration management.
  • Simplify the beginner experience: first-time Drupal users often find it complex, but over time they fall in love with it. Drupal 9 aims to lower the barriers to entry for new users, making the learning process easier.
  • Open Web: Drupal 9’s focus is on accessibility, inclusivity, security, privacy, and interoperability.
  • Be the best data engine: making Drupal an increasingly advanced content repository with a flexible API, ready to adapt to a future with more content, more integrations, more devices, and more channels.

But how do these objectives translate into product features? Here are some of the innovations that have characterized the latest Drupal updates.

  • Layout Builder: introduced with Drupal 8, it allows you to create custom page layouts in which you can then place the necessary components. Historically, in Drupal 7, achieving this required using contrib modules like Panels or Display Suite.
  • Blocks, generic configurable and positionable containers, are now fieldable and reusable (which in Drupal 7 required a contrib module like Bean).
  • WYSIWYG Editor available natively in the core, without the need to install contrib modules or third-party libraries.
  • Views is now in the core, and most custom lists in the core are now fully customizable.
  • Media Management is no longer an add-on, but an integral part of the platform.
  • JSON-API in the core for using Drupal in API-First or Headless approaches.
  • Custom editorial workflows are now available in the core, without the need to use contrib modules like Workbench Moderation or Workflow.

Drupal 9: Is the Upgrade Really Necessary?

To answer this question, we need to analyze two different scenarios: that of those currently using Drupal 7 and that of those who have already made the transition to Drupal 8.

Starting from Drupal 8

This is the simplest case to address: for those with a Drupal 8 platform, the upgrade will be (almost) painless.

Drupal 9.0 involves the removal of deprecated code and the update of third-party dependencies (Symfony 3.0 → 4.5), but it does not introduce new features. It is effectively the same codebase (stable and extensively tested) that characterizes Drupal 8, so the upgrade will have the same impact as updating from one minor release to another, provided that the core is updated to the latest available version.

We can therefore say that Drupal 9 is simply a new release of Drupal 8. After all, from Drupal 8 onward, all updates will be frequent and of minor impact, representing the natural continuation of an iterative development process and following a “rolling release” model where new features can be introduced even between minor releases within the same development branch.

This new paradigm is also reflected in the limited duration of support planned for Drupal 8, which will end as early as November 2021, since the upgrade to version 9 is much simpler compared to the one from 7 to 8.

Starting from Drupal 7

Those currently using Drupal 7 should consider that the last supported release of this version, after a full 10 years of support, is reaching “EOL” (End of Life). As a result, official security support will no longer be available, with all the related security risks that this entails. It goes without saying that shortcomings in this area can cause serious effects on business continuity, as well as risks of data breaches and potentially very hefty fines.

The end of support also coincides with the halt of new feature creation, the cessation of contrib module support, improvements, and bug fixes: in other words, to have a secure, performant, and modern site, upgrading to Drupal 9 is a must. And without even considering all the new features related to the latest release – listed above – which represent the real reason for making the “leap.”

Initially, the end of support for Drupal 7 was planned for November 2021, but due to the Covid emergency the deadline has been extended to November 2022. There are therefore still several months to organize the transition to the most up-to-date and secure version of Drupal.

The transition from release 7 to release 8 or 9 means, in most cases, undertaking a complete rewrite of the website or web application; that is why it is important to take all the necessary time to carefully plan the upgrade.

Below, we look at how to do it.

How to Upgrade to Drupal 9 from Drupal 8

As we already mentioned, the main advantage of moving from Drupal 8 to Drupal 9 is that you don’t need to face a major migration project, but rather an incremental upgrade. You therefore need to pay attention to a few aspects and follow some simple instructions before proceeding with the update.

1. Make Sure Your Environment Is Compatible with Drupal 9

Speaking of server infrastructure, the first step is to make sure that your hosting, if it is not already updated, meets the minimum service requirements for Drupal 9.

More specifically, Drupal 9 requires PHP 7.3 or higher (7.4 is also supported but not required), MySQL 5.7.8+, MariaDB 10.3.7+, SQLite 3.26+, PostgresSQL 10+ with the pg_trgm extension enabled.

For those using Drush, it is important to know that only Drush 10 is compatible with Drupal 9.

2. Update the Drupal Core to the Latest Version

Starting from Drupal 8, the transition to Drupal 9 is painless if you have always updated to the latest minor release (8.9.6, at the time of writing). Also make sure to remove dependencies that you are not using.

3. Verify That Contrib Modules Are Up to Date

The Upgrade Status module and the Drupal Check tool allow you to verify whether the contrib modules you are using on your site have already been updated for Drupal 9. These tools are not only useful for analyzing the current status but also allow you to check that the code written for any custom modules is compatible with Drupal 9.

By resolving the issues flagged by the two tools, you will be certain of having code compatible with both Drupal 8 and Drupal 9: you can choose to do it manually or use helpful tools like Drupal-rector or the Upgrade Rector user interface.

4. Perform the Upgrade

Once you have updated Drupal 8 to the latest minor release, verified and updated contrib modules and any custom code, you can proceed with the upgrade without issues.

How to Upgrade to Drupal 9 from Drupal 7

Migrating from Drupal 7 to Drupal 9 requires a complete rewrite, just as it does when moving from Drupal 7 to Drupal 8.

From Drupal 7 to Drupal 9… Via Drupal 8?

Many people wonder whether it is better to go directly from release 7 to 9, or whether it makes more sense to go through version 8 first. Given that there is no universally valid answer, one consideration to make concerns the availability of modules and themes.

You might find that the themes and modules you need are available in version 8 but not yet in version 9: in this case, it makes sense to upgrade to the latest minor release of Drupal 8, which represents the most demanding part of the migration, while waiting for contrib modules, themes, and updated documentation to become available in version 9 as well. At that point, all that remains is to follow the instructions outlined above for upgrading from 8 to 9.

Since Drupal 9 is effectively an update of Drupal 8, within a few months the ecosystem will be fully compatible and therefore it will be advisable to go directly from version 7 to 9: the effort would be the same, and you would actually avoid an unnecessary intermediate step. In the meantime, Acquia provides an interesting tool for checking the progress status of Drupal 9–compatible modules.

Useful Tools to Simplify Migration

Here are some tools to know and use to effectively tackle the migration:

  • Upgrade Status (Drupal 7 version): it will allow you to find out in advance whether the contrib modules you are using already have versions for Drupal 8/9 and, if not, whether there are replacement modules.
  • Drupal Module Upgrader: a command-line tool that, through automatic analysis, will flag the portions of code that need to be modified to make it compatible with Drupal 8/9.
  • Core Migrate Suite: an API specifically designed for content migration.
  • Migration Planner: a very helpful tool for planning all aspects of the migration.
  • Drush pre-deploy: a tool we developed at SparkFabrik that is useful during the upgrade release phase. Assuming you have moved to Drush 10 and are already using the new drush deploy command to release updates across environments, this tool allows you to write custom hooks to execute before the standard update:db (for example, fixing integrity issues, enabling modules, etc.).

Two Approaches to Organizing the Migration

Regardless of the help that tools can provide, it should not be forgotten that a complete rewrite is required and the tools mentioned can be a valuable aid in tackling the challenges of such a complex migration.

There are two possible approaches:

  • Migrate automatically with the help of the Migrate tool included in the core and using the modules mentioned above, leveraging the “migration paths” already provided for migrations from Drupal 6 and 7. The module will provide useful information during the migration process on how to resolve issues such as deprecated or incompatible code or migration problems.
    This approach is recommended only for very simple sites with simplified data structures, using few contrib modules and little custom code.
  • Migrate manually to a new Drupal 8 installation, partially leveraging automatic migrations and proceeding with manual migrations of content, configurations, custom code, and everything else. This is always a good opportunity to review the site architecture and optimize it, also taking advantage of the new possibilities offered by Drupal 8/9.
    This approach is always recommended for complex sites with many customizations, extensive custom code, and contrib modules.

Conclusion: Why Drupal?

Drupal is undoubtedly the most suitable platform for achieving great flexibility in organizing and managing content, as well as ease of integration with the existing ecosystem within a company. It can handle extremely high request peaks with an excellent level of security.

It guarantees consistent long-term support, significantly reducing the problem of obsolescence: a Drupal site can thrive for many years at peak functionality and security, provided it receives proper maintenance.

Its open-source nature makes the platform extremely customizable: it is not the tool that dictates the way of working and the processes to follow, but rather Drupal that perfectly adapts to every need. This ultimately makes it the ideal solution for many small, medium, and large organizations.

A final piece of advice for those who decide to start a Drupal project or undertake a major migration is to take the time to choose the right partner. While total customization freedom is an advantage, it can also be a double-edged sword in inexperienced hands. By relying on those who know the tool well, you can be certain that best practices will be applied that will result in a secure, performant, and flexible site with the ability to evolve over time.

Get in touch

Follow us on social media
Listen to Continuous Delivery