Migrating to Drupal 9: the Good, the Bad and the Ugly - Plus Tips

With the release of Drupal 9.2 in June 2021, it is a good time to insist that a Drupal 9 upgrade is not only about staying up-to-date, closing security gaps, and getting deprecations removed – but it also has new features such as increased performance or support for the WebP image format. All this, just by installing regular updates.
 

The Good


The days of long Drupal 7 to Drupal 8 migrations are over – now it is more a process of keeping the code up-to-date. This increases collaboration efforts within the community to get Drupal 9 compatible releases of the modules and themes installed in Drupal 8. We even had a very pleasant surprise with a module seeing a release with our changes included in less than 2 hours. It is great to see free open-source software in motion.

Updating projects to Drupal 9 has another positive effect, it allows an overview of ALL the modules on the site, so we can question whether we even need them in the current state of the project. If no longer necessary, we can remove them and, if needed, the way forward is to update them to a Drupal 9 compatible version. This is a great clean-up exercise that we don’t normally do for modules when we just update minor versions of Drupal core. Getting familiar with this process is crucial in preparation for what’s to come: Drupal 10 – the new major version of Drupal which will be available next year.

As time passes we see more and more modules with Drupal 9 releases and that makes it easy to upgrade a site. Remember that if you see an abandoned project you can always offer to take it over and give the code a new life. At Amazee Labs, we support a good number of modules so we are happy when we are given the chance of getting more projects updated.
 

The Bad and the Ugly


Although the upgrade status module is constantly getting better with updates and is the best tool to get the site ready for Drupal 9 (and Drupal 10), it is not a silver bullet and there are still code patterns that it won’t detect as deprecated. So we always set aside some hours to actually get the site to Drupal 9 on a non-production environment and perform some tests to confirm all is working as originally intended. Particularly, we found some usages of the now-deprecated EntityManagerInterface to require some investigation to change the code to one of the 11 classes it has been split into.
 

Tips and Tricks


As mentioned before, not all modules declare their compatibility with Drupal 9 but many of them are actually compatible. The main problem is that Composer will detect it as incompatible and will therefore not download the code – making patching, not an option. For that situation, we use Composer inline aliases that allow us to use a certain version of a package but declare another for compatibility purposes.

For example 

"drupal/core": "9.1.4 as 8.9991"

The composer.json file will get Drupal 9.1.4 installed, but all the modules that are only compatible with Drupal 8 will be happy with the situation and resolve all the dependencies successfully.

Talking about Composer, I can’t stress enough how beneficial it is,  during this kind of upgrade, to also update Composer to its latest version, especially if you are using any version older than Composer 2. I usually take around one hour to get a site ready for Composer 2, but the time saved in the long run makes it worthwhile very quickly.
 

Not only Drupal can be migrated to Drupal 9


Drupal can cover migrations from Drupal 6, 7 and 8, powered by a flexible API that can take many kinds of data formats and transform them into the native Drupal SQL table system. 

Do you want to talk with us about upgrades? Whether you’re operating on Drupal 7 or 8, or any other system – we’re ready to help. Get in touch with us and upgrade to Drupal 9 today!

 

Stay in the Loop

We will use the personal data you are sharing with us solely for the purpose of sending you our newsletter. See more here: Data Privacy.

GET IN TOUCH

Let us know how we can help you.

1