detail-cloud

Drupal 9 to 10 Upgrade Checklist

Technology
30.11.2023
Pasan
Pasan
Senior Backend Developer

It’s getting closer to 2 years since the first release of Drupal 10 and closer to a year since Drupal 9 was End of Life. But still, we can find some websites still out there on Drupal 9. 

This guide is here to help those sites to be updated to the latest of Drupal 10.

When performing a Drupal 10 core update to a site, a few things need to be addressed beforehand. These steps are important to ensure that once the Drupal core is on D10 it will not cause any breaks or other compatibility issues.

 

D10 Readiness Checklist Items

We can use the contributed (a.k.a contrib) module called Upgrade Status to help us with this task. https://www.drupal.org/project/upgrade_status It provides a comprehensive list of items that need to be addressed before upgrading a site’s Drupal version.

 

Upgrade checklist

 

Drupal core and hosting environment

Upgrades to Drupal 10 are supported from Drupal 9.4.x and Drupal 9.5.x. It is suggested to update to the latest Drupal 9 version available, which is v9.5.11.

This involves updating the existing Drupal site core, modules, themes, other custom code, and plugins to the minimum required core version. The host environment's PHP version has to be upgraded to PHP 8.1

With the D10 there are some deprecated code and functionality that needs to be addressed. 

 

Scanning of every installed module, theme and library for D10 support.

In Drupal, we have two types of code. Custom and Contrib.

To simplify, Custom code is the code that is created in-house and not available via Drupal.org.

The code that is available through Drupal.org can be named as Contributed.

The status of a project cannot be determined without scanning the source code. This involves updating every module that is currently active in the project to be updated to a D10-supported path. If any items here are not D10 supported those need to be patched or a new patch file has to be created temporarily until the module maintainer publishes a release. The creation of new patches can be a time-consuming task for complex modules.

 

Removal and updation of deprecated code

From D9 to D10, there are a few methods, services, and classes that are completely removed. Therefore these need to be checked and corrected accordingly.

A tool such as Drupal Rector can take some of the heavy lifting.

https://github.com/palantirnet/drupal-rector

 

CKEditor 4 to 5

CKEditor4 is completely removed and an entirely new platform has been created for CKE5.

This means any CKE4 plugin that was used in the D9 site has to be ported to CKE5. This is a highly time-consuming task, especially for custom modules.

A summary of the most used contributor CKE4 modules are being worked on and the progress can be tracked here. https://www.drupal.org/node/3273985

To extend the CK5 default functionalities checkout the module https://www.drupal.org/project/ckeditor5_plugin_pack

 

Twig updated from 2.x to 3.x

With the D10 update the twig version was changed and we can check the site templates against the change records published by the Drupal community.

https://www.drupal.org/node/3256890

For example;

The {% for ... if ... %} statement is removed from Twig 3.x. See solutions at: https://stackoverflow.com/questions/18357600/if-condition-in-for-loop-in-twig-template-engine

 

jQuery.Once and other deprecated functions.

Most of the js in modules use .once, cookie libraries. Since these are removed from D10 it’s important to fix them moving forward. Please check the resources heading for a list of useful articles. 

 

Configurations

Drupal heavily relies on the configurations, which must be managed properly at each step to avoid breaks.

 

Testing

Once everything in the D10 readiness checklist is done we can do a final test to uncover any issues.

 

Final Step

Upon completion of the above checklist, the final step is to go ahead with the upgrade to D10.

Whatever the new issues that arise with this have to be tested and addressed at this time.

 

Wrap up

The time to update a site to D10 varies per site depending on the site complexity and the modules used. 

The most time-consuming items are;

- CKE4 to CK5 upgrades

- Patching complex modules to support D10

- Testing

 

Resources

jQuery

Twig

Deprecated and obsolete extensions

CKE4to5

Other common Deprecations