Drupal 9 was released on June 3, 2020. With that in mind, it is high time for companies and users to consider an upgrade to Drupal 9 of their web ecosystem. With previous Drupal versions, upgrading the system required a considerable amount of time and effort, but ease of upgrade is not the only new feature in Drupal 9.
What is new in Drupal 9?
There’s plenty more new functionalities under Drupal 9 that all of the deprecated code removed and a new Symfony version.
This new version supports headless applications and third-party data integrations. Furthermore, Drupal 9 contains a new layout builder, WYSIWYG media management system and content workflow tools that make Drupal much easier to use.
A few Drupal 9 features
Here are some of the new features that have been added into Drupal 9:
1. A cleaner code base
Basically Drupal 9 is Drupal 8.9 but without deprecated code. So the code marked as deprecated in Drupal 8.9 will no longer be supported and used in the Drupal ecosystem.
The reason behind this is to have a cleaner version. As a result, every module in Drupal 8 has to remove their deprecated code to make themselves compatible with Drupal 9.
In conclusion, less deprecated code means better performance.
2. Major updates to core’s dependencies, including Symfony and Twig
Symfony 3.4 will be upgraded to Symfony 4.4 and Twig to Twig 2.0, those two as major changes. So if any module uses functions that relies on an older version of these dependencies that code will need to be updated.
- Symfony 4 is the maintained version and extends the security support.
- In Twig 2.0 there are a lot of cleanup, dropped support for old PHP versions, fixed wrong behaviors, and simplified things whenever possible.
3. New Layout Builder
The Layout Builder module is now very famous in the Drupal environment; it allows content editors and site builders to create visual layouts for displaying content. Users can customize how content is arranged on a single page, across types of content, or even create custom landing pages with an easy to use drag-and-drop interface. This module replaces others like Place blocks or Panelizer.
4. Headless Drupal
Why should I upgrade to Drupal 9
Support for Drupal 7 and 8 ends
Support for Drupal 7 and 8 ends in November 2022. Both were extended due to COVID19 but are going to be retired at the same time. So this could be the first and most important reason to upgrade.
Upgrading from Drupal 7
Upgrading from Drupal 7 usually requires rebuilding the entire site directly into Drupal 8 and later migrating the whole content. This may require a huge effort but it is a great opportunity to give your site a fresh new look, a better structure and add other improvements.
Currently more than 1 million of websites are still under Drupal 7. It is important to consider upgrading a Drupal 7 system as it might be compromised and exposed to potential attacks when the support expires.
Upgrading from Drupal 8
If the Drupal 8 site has been updated regularly, upgrading to Drupal 9 is a piece of cake, or like Dries said: "The big deal about Drupal 9 is … that it should not be a big deal".
Otherwise, here is is a checklist you could consider going through:
- Update to Drupal 8.8.x or 8.9.x, important step before upgrading to Drupal 9.
- Update all contributed modules and themes to Drupal 9 (removing deprecations).
- Update the custom code, again deprecations. It is necessary to update the current custom code and ensure that is compatible with Drupal 9.
- Verify that the hosting and tools are compatible, Drupal 9 system requirements have changed.
- Drupal 9 on Apache, at least version 2.4.7 is required.
- Requires at least PHP 7.3. PHP 7.4 is also supported but not required. PHP 8 is not yet supported, but work will be done to support PHP 8 as soon as possible.
- If using Drupal 9 with MySQL or Percona, version 5.7.8+ is required.
- If using Drupal 9 with MariaDB, version 10.3.7+ is required.
- If using Drupal 9 with SQLite, version 3.26+ is required. (PHP 7.4 does not use the system provided SQLite, so take extra care to make sure your PHP is compiled with at least this version).
- If using Drupal 9 with PostgreSQL, version 10 is required with the pg_trgm extension.
- While Drupal core does not require Drush, many people do use it. As of this writing Drush will only provide Drupal 9 compatibility in Drush 10.
Tools for upgrading
There are a few tools that can help and validate the compatibility for Drupal 9. The first is the upgrade status module. This module is for Drupal 8, but can also be installed in Drupal 7 sites.
The other module is the upgrade rector. This module offers automated code fix suggestions to make your modules compatible with Drupal 9. It only has partial coverage for deprecated APIs. This is for Drupal 8 only and is still a work in progress.
It is important that the 'upgrade reactor' module fixed automatically more than 50% of the updates of the 200 most used modules.
When is the best time to upgrade?
When everything is ready. It is important to consider that Drupal 9 comes to us with most of its contrib modules updated already.
What does it mean?
It means that there are two things here that have to be ready. First of all the code of the site and then Drupal 9 version.
The first version of Drupal 9 can be called a kind of transition phase, so when Drupal 9 is on version 9.2, it would be a good time to have a site with Drupal 9. However in this case, there is no penalty for earlier Drupal 9 users, so that it could be a good time to upgrade from the early version as well.
Drupal has made itself dependent on the PHP Symfony framework, which does 2 year release cycles for major updates, which means Drupal 9 will be following this schedule.