How to check your Drupal 8 site is compatible with 9 version

Drupal 8 to Drupal 9 Upgrade

Are you worrying about upgrading your Drupal 8 site to Drupal 9? Then this article will help you to upgrade your Drupal 8 site to the Drupal 9 version.

I had worked on one of the projects updated to Drupal 9 from Drupal 8, during the upgrade process I have faced some issues and challenges that I am going to share in this article. Please align with me till the end of this article, I have used one of the contributed module “Upgrade Status” and that module interface provide a status report for the theme, modules compatibility to the Drupal 9 version.

 

D9 upgrade recommended steps

  • Update to Drupal 8.8.x or 8.9.x (if not already on that version) – So you have to update the Drupal core version to the latest 8.9.x version for 9.x compatibility
  • Update all contributed projects and ensure they are Drupal 9 compatible – Likewise, you have to update your contributed module which you have used in your project.
  • Ran update script – You can use either update.php or Drush updatedb to run the update script
  • Then install and enable the Upgrade status module (Will give you the reports of Contrib module compatibility)
  • Then go to this module status report – Here you can get to know a detailed report of the module compatibility. So for each module, this will provide you the detail of whether this module/theme is compatible with Drupal 9 or not. If not this will give you more detail about what API we need to change that kind of detailed information we can get it from this page.
  • Update core codebase to Drupal 9 – Once we stable with the changes then update the core version to 9 and do the run update script. In this stage, we are ready to go with Drupal 9.

Please find the below details about issues we are facing and challenges we had at the time of the upgrade process.

INCOMPATIBLE THEME

The following theme is installed in my setup, but it is incompatible with Drupal 9.0.0. So the update script is not ready for the DB update.

  • Bootstrap Business

So I starts the code fixes from theme, I referred the upgrade status module report for the Theme first.

There I found most of the module we need to add  Core_version_requirement: ^8.8 || ^9 in the info file for or the Drupal 9 compatible then only I am able to proceed further steps.

INCOMPATIBLE MODULE

Likewise we need to follow he same steps for module info file also. Need to add core_version_requirement: ^8.8 || ^9 then based on upgrade status report I have fixed each module. I started with custom module and then contributed module. Mostly we have used function which was deprecated in drupal 8.x. So I have fixed those recommendation from upgrade status module. Then followed by contrib module fixed.

Some modules have more issues for Drupal 9 compatibility like, Devel, mail system, Swift Mailer and External Authentication. So need to fixe the changes in contrib module code base. Some module compatiable once its got update. But above mentioned module needs some code fixes.

Ref:

https://www.drupal.org/docs/updating-drupal/troubleshooting-database-updates

For our reference , please find the below some of the D9 incompatible D8 API functions.

Drupal 8 Drupal 9
path.aliasmanager path_alias.manager
user_load() Drupal\user\Entity\User::load()
pager_default_initialize() \Drupal\Core\Pager\PagerManagerInterface->defaultInitialize()
\Drupal::entityManager()->getStorage(‘taxonomy_term’)->loadTree \Drupal::service(‘entity_type.manager’)->getStorage(“taxonomy_term”)->loadTree
db_and() Condition(‘AND’)
node_load() \Drupal\node\Entity\Node::load()
file_load() \Drupal\file\Entity\File::load()
file_unmanaged_move(). Drupal\Core\File\FileSystemInterface::move()
file_delete() Drupal\Core\Entity\EntityStorageInterface::delete()
db_select() \Drupal::database()->select
drupal_set_message $messenger = \Drupal::messenger(); $messenger ->addMessage($message, $type, $repeat); Ref : https://api.drupal.org/api/drupal/core%21includes%21bootstrap.inc/function/drupal_set_message/8.5.x
   

Leave a Comment