HomeServiceContact
Drupal
min read
February 19, 2024

Upgrading from older Drupal versions to Drupal 10 | steps and solutions

Upgrading from older Drupal versions to Drupal 10 | steps and solutions
Table of contents

Drupal 9 support ended on November 1st, 2023. Drupal 8 support ended on November 2, 2021, and Drupal 7 will no longer be supported after January 25, 2025. Maintaining the security and functionality of your website is important, and running on outdated versions exposes your site, business, and users to many risks. Since outdated versions do not receive support or updates, it is time to make a move.

Here's why:

  1. Security vulnerabilities: Over time, hackers can exploit vulnerabilities in older platforms.
  2. Outdated technology: Acquia cloud features and API integrations may not work properly with older platforms, leading to unexpected issues.
  3. Missed updates and patches: You'll miss out on new features and fixes provided by the latest module updates and patches.
  4. Significant improvements to CKEditor 5: This version has been rewritten from the ground up, offering new sticky toolbars and enhanced support for custom plugins.
  5. Difficulty in future Drupal upgrades: Upgrading to future versions of Drupal will be more challenging, both in terms of cost and time for developers.

The process of updating to the newer version of Drupal 10 involves several steps:

  1. Identifying compatibility issues using Upgrade Status: Use Upgrade Status to identify any issues preventing the update to Drupal 10.
  2. Making the Custom theme compatible: Adjust the current theme to ensure compatibility with Drupal 10, which may involve fixing deprecated code and possibly switching to a different theme.
  3. Making the Custom Modules Compatible: Address any issues with custom modules to ensure compatibility with Drupal 10.
  4. Making the Contributed modules compatible: Resolve any compatibility issues with contributed modules to ensure they work with Drupal 10.
  5. Updating Core to the latest Drupal 9.5.11: Ensure that the site is running on the latest version of Drupal 9 before proceeding to update to Drupal 10.
  6. Performing the update to Drupal 10: Once all compatibility issues are resolved, update the site to Drupal 10.

Common challenges and solutions

1. Upgrade Status to fix compatibility issues

Upgrade Status is a helpful tool for identifying and addressing compatibility issues when upgrading from previous Drupal versions. It provides links to issues on drupal.org where similar fixes have been implemented. Upgrade status provides a list of compatibility issues, including themes, custom, and contributed modules, which we’ll need to fix before performing the update. It also provides information on core and hosting environment issues as well.

drupal 10 upgrade status

Using Upgrade Status to see what needs to be fixed.

Upgrade status provides a clear list of modules that need an update,

update menu

and also those that need to be removed as well.

screenshot of remove feature

2. Drupal Rector to speed up the process

Automated compatibility fixes can be done using Drupal Rector which provides solutions for a few of the modules available on drupal.org.

For this, we will need to install using Composer,

$ composer require --dev palantirnet/drupal-rector

and copy the rector.php file to the docroot of the project, using

cp vendor/palantirnet/drupal-rector/rector.php

Once done we can begin using rector in the following way,

$ vendor/bin/rector process web/modules/contrib/[YOUR_MODULE]

3. Drupal lenient to support modules that don’t have Drupal 10 Releases

Upgrading to Drupal 10 may also require usage of Drupal lenient to support earlier versions of modules that don’t have proper Drupal 10 releases. There may be a few modules installed using Composer that doesn’t support Drupal 10 directly And you won't be able to install them after upgrading. In this case, use a tool called Drupal lenient which allows lenient composer checks against accepted versions. To use this, first install lenient using

composer require mglaman/composer-drupal-lenient

then add the module name to a list of allowed modules that bypass this composer check using,

composer config --merge --json extra.drupal-lenient.allowed-list '["drupal/gtranslate"]'

finally, install the module using the,

composer require drupal/gtranslate:^1.0.0

If we’re using Drupal lenient on a Drupal 9 site, remove unsupported modules from the composer using the composer remove command, update the Drupal core, and re-add the module using composer require commands. Then run database updates and configuration export/import using Drush as needed. This ensures all previous configuration settings work the same in Drupal 10 as they did in Drupal 9.

4. Removing modules that are not required or temporary removal for Drupal lenient

To remove the module in Drupal 9, use the composer remove command and pass in module names that are space separated such as

composer remove drupal/wordpress_migrate drupal/twig_extensions drupal/toolbar_anti_flicker

5. Resolving Composer dependencies

Another major part of the upgrade process is resolving composer dependencies. Once all upgrade status issues are fixed, try upgrading the site using the update commands.

If you see the update is getting blocked, get more information using both the following commands.

  • composer prohibits "drupal/core" ^10
  • composer why-not drupal/core-recommended 10.0.2

$ composer prohibits drupal/core 10                                     
drupal/core-recommended 9.5.11      requires         drupal/core (9.5.11)                                    
drupal/core             10.0.0      requires         symfony/console (^6.2)                                            
drupal/core             10.0.0      requires         symfony/dependency-injection (^6.2)                     
drupal/core             10.0.0      requires         symfony/event-dispatcher (^6.2)                         
drupal/core             10.0.0      requires         symfony/http-foundation (^6.2)                          
drupal/core             10.0.0      requires         symfony/http-kernel (^6.2)                              
drupal/core             10.0.0      requires         symfony/mime (^6.2)                                     
drupal/core             10.0.0      requires         symfony/routing (^6.2)                                  
drupal/core             10.0.0      requires         symfony/serializer (^6.2)                               
drupal/core             10.0.0      requires         symfony/validator (^6.2)                                
drupal/core             10.0.0      requires         symfony/process (^6.2)                                  
drupal/core             10.0.0      requires         symfony/yaml (^6.2)                                     
drupal/core             10.0.0      requires         twig/twig (^3.4.3)                                      
drupal/core             10.0.0      requires         guzzlehttp/guzzle (^7.5)                                
drupal/core             10.0.0      requires         guzzlehttp/psr7 (^2.4)                                  
drupal/core             10.0.0      requires         asm89/stack-cors (^2.1)                                 
drupal/core             10.0.0      requires         psr/log (^3.0)                                          

Further, use the why-not  command to find out specific package compatibility issues using

composer why-not drupal/gtranslate 3.0.0

5. While running the Drupal 10 update command, you may encounter packages that are dependent on each other, thereby blocking the updates. Here, updating one package may cause an error with the other, and vice versa. To resolve this issue, you must specify both package names, which are interdependent, check their correct versions on https://packagist.org/, and then run the composer command.

composer update "drupal/core-*" symfony/dependency-injection:"^6" drupal/drupal-extension symfony/error-handler:"^6" --with-all-dependencies

List out all packages in such a way using space-separated values with the correct versions and this will take care of the update.

Moving from Drupal 7 to 10 requires careful planning, but it's necessary for website security and functionality. By understanding the importance of the upgrade and following the outlined steps, one can successfully perform the update and migrate to Drupal 10 CMS for a modern, intuitive, and secure website.

References:

Written by
Editor
No art workers.
We'd love to talk about your business objectives