22 Jul 2021 - Dennis Egen

Upgrading to Drupal 9

Drupal upgrade copy

Drupal 9 was released on June 3, 2020, alongside Drupal 8.9 — a long-term support minor release of Drupal 8 that was designed to help users transition from Drupal 8 to Drupal 9. While Drupal 8 will be supported until November of this year and Drupal 7 will be supported until November of 2022, there’s never been a better time to make the switch to Drupal 9.

It’s no secret that the upgrade from Drupal 6 or 7 to Drupal 8 was quite challenging. In some cases, it took just as much work to upgrade as it would to build a new site. But Drupal 9 was developed to address this problem, making ease of upgrade a key feature of Drupal 9. Version 8 was supposed to make sure that website updates were as simple as they are in other CMS solutions like WordPress.

Thanks to thoughtful development, Drupal 9 finally accomplishes this. 

Drupal 9: It’s time to make the move.

What Is Drupal 9?

What is Drupal 9? Simply put, it’s a cleaner version of Drupal 8. It’s the most up-to-date version of the open-source content management software (CMS) and digital experience platform. Drupal is used to power many of the websites and applications that we use and access every day and is known for coming with a fantastic set of features that come standard, such as:

  • Easy content authoring
  • Reliable performance
  • First-rate security

Where Drupal really excels, though, is in how flexible and modular it is, which means that organizations can use Drupal to build all kinds of versatile content that are structured and dynamic — everything that modern web experiences need to be. 

Since Drupal is so modular, users can add on all kinds of functionalities and themes to mix and match and enhance the core abilities. Organizations can also integrate Drupal into existing external services and applications in a way that no other CMS can, making it more powerful and scalable than other CMS options. 

Like previous iterations, Drupal 9 is open-source, which means that anyone can download it, use it, work on it, or share it with others. According to Drupal, Drupal 9 is the same as the Drupal 8.9 minor version, only the deprecated code was removed, and third-party dependencies were updated.

What does this mean for users? Most extensions only need a few changes, which is good news for organizations that rely on Drupal and are ready to upgrade. 

Guide to Building & Maintaining a Website

Why Was the Code Deprecated?

When code is deprecated, it’s streamlined to remove any unnecessary extras. Think of it like moving through an airport. If you have lots of heavy baggage to carry, it’s hard to move forward quickly. This also happens with your CMS. Drupal is so highly configurable and flexible, which means it comes with a sophisticated algorithm with lots of complexities, and Drupal 9 helps shed some of the unneeded digital baggage. 

As the Drupal team shared, “There is always something to improve in Drupal” — even with such a strong system. The functions that existed in Drupal 8 were around for a long time, but not all of them were a great fit anymore. In fact, most of them were deprecated already in Drupal 8.7.0 and will be permanently removed in Drupal 9, leaving behind a more lightweight software solution.

Take a look at one before/after pairing from Drupal 8 to Drupal 9:

  • Before: file_unmanaged_copy($source, $destination)
  • After: \Drupal::service('file_system')->copy($source, $destination)

This new deprecated system is helpful for a few reasons:

  1. The new file system service makes it much easier to find all the related functionalities, so users don’t have to search through all the global function names following a naming convention.
  2. The new solution service can be switched for different file system implementations like logging file operations.
  3. The service can be mocked up and tested before implementation, which means changes to file system operations can be avoided during testing. 
  4. The code doesn’t need to be loaded and can be autoloaded whenever needed. 

Why Upgrade to Drupal 9?

Those who have been with Drupal for a while will remember that back in 2015 when Drupal 8 was introduced, the transition to the new upgrade was not an easy one. The migration process was just about as labor-intensive and time-consuming as building a new site from scratch; then it took even longer to continue to bring content in. Some organizations even skipped Drupal 8 altogether and are still powering their sites on Drupal 7, which was introduced nearly a decade ago. 

So it makes sense that some developers and organizations are questioning why they should upgrade to Drupal 9, especially since the migration to Drupal 8 was such a headache.

Fortunately, making the change to Drupal 9 is nothing like migrating to Drupal 8. It’s smooth, uncomplicated, and, best of all, it’s entirely unnoteworthy. The updates are stable, and the development process is nothing like as challenging as that which came with the introduction of Drupal 8. While the migration requires a little bit more than the flipping of a switch or one click of a button, it’s far simpler than the infamous migration to Drupal 8.

Plus, Drupal 9 offers all kinds of security coverage that Drupal 8 doesn’t have. The final version of Drupal 8, Drupal 8.9 will only cover bug fixes and security coverage until November 2021 — while the development and security updates of Drupal 9 will continue moving forward. 

What does this mean for organizations and their developers? You can feel good about making changes to your website in Drupal 8 only until November 2021. 

Making the switch to Drupal 9 is ideal for those who want to have forward compatibility with future releases. While Drupal 8 code will not run on Drupal 9, no new Drupal offerings or integrations will be compatible with Drupal 8. 

Planning Your Upgrade: Technical Tips

Moving from one version of Drupal to another requires some advanced planning — even if the migration is simpler than past iterations. 

What kind of steps should you take before making the big switch?

Take Stock of Your Modules and Your System

The codebase for Drupal 9 is a lot like Drupal 8.9, only without the deprecated code. This might impact you a lot or a little, depending on what APIs, custom codes, or themes you have. Drupal 9 requires all active themes and modules to declare Drupal 9 compatibility, which means you need to take a look at three areas:

  • Custom modules
  • Contrib modules
  • Themes

There are tools available to help you check your site’s modules and themes to be sure they are compatible with Drupal 9. They require either the ability to run PHP at the command line or to manage your site through Composer, like Drupal Express websites. 

You can use the Upgrade Status module to perform a website audit to find which of your site’s modules, themes, and other add-ons are compatible with the latest upgrade. Upgrade Status will help you establish a baseline of all the information you want to track. You can even format this information into a spreadsheet through this patch. This way, you can filter your contrib and custom modules since each needs to be upgraded in different ways. 

Contrib modules will often support Drupal 8 and 9 as long as you are working with the latest releases. If so, you can go ahead and update each of these modules. If you or your team are comfortable running simple commands at the Linux command line, you can get an overview of each module’s declared compatibility by entering the main modules directory and running this command:

  grep "core" */*info*

Any module without a line with “^9” toward the end will require some testing and research to see how (and if) it will work with Drupal 9.

Custom code may be a bit more labor-intensive but also needs to be done. With both contrib and custom modules, it’s wise to tackle some of the easier upgrades first, then handle the major modules next — the ones your website depends on for functionality and ease of use.

Themes, especially custom or contrib themes, should be treated like modules, and each updated one by one.  Any custom code or themes should be checked to ensure they don’t rely on code that was deprecated in Drupal 8.8 or any earlier versions before updating your site to Drupal 9. With themes and modules, keep track of your progress as you go. 

Other Helpful Tips

  • Drupal is one of the top three CMS solutions for a reason. Because it is an open-source platform with lots of available existing modules — and supports plenty of custom modules as well — it’s very scalable. But this also means that some of the contrib modules you use might not have a Drupal 9 version released yet. You’ll want to track these release dates, plus whether or not they are major or minor updates. For those contrib modules that will not be getting a Version 9 release, you may want to start looking for modules to take their place.
  • Custom modules will certainly need attention, but there are tools to help. Drupal-check is a useful tool you can install and run in your development environment or as part of your continuous integration (CI) workflow, so you know exactly where you are when it comes to making sure your codebase is compatible with Drupal 9.  By adding drupal-check to your CI workflow, you can also be sure you aren’t introducing new incompatibilities into your modules. 
  • Once you’ve gone through all of your preparation, upgrading to Drupal 9 is the same as if you were upgrading to another point release of Drupal 8. However, as with any other major update, you’ll want to make a full backup of your filesystem and database before you begin — just in case!
  • After your upgrade, don’t forget to test all the major capabilities of your website thoroughly since a lot of the old code has been removed and the underlying system went through a major update. 

Get Support from the Pros

You shouldn’t have to make the move to Drupal 9 on your own. At Engine Room Tech, we’re well-versed in making the transition process as painless as possible. To discover how we can assist you so that your site is secure, updated, and ready for anything, connect with our team today! 

 

Consult with a Marketing Tech Expert