- July 30, 2019
- by Christopher
- Drupal Development, Web Development
- 0 Comments
With Drupal 9 targeted to be released in June of 2020, many people are wondering what they need to do to prepare. The good news is that upgrading from drupal 8 to 9 should be an easy process, provided your drupal 8 site is up to date and not using any deprecated code.
If your site is not using any deprecated code that is scheduled for removal in Drupal 9, your upgrade to Drupal 9 will be easy. In fact, it should be as easy as a minor version upgrade (like upgrading from Drupal 8.6 to Drupal 8.7).
Deprecated code: What is this?
Code in Drupal is marked as “deprecated” when it should no longer be used. Typically, code is deprecated because there is a better, modern alternative that should be used instead.
For example, in Drupal 8.0.0 Drupal::l($text, $url was deprecated. Instead of using Drupal::l(), you should use Link::fromTextAndUrl($text, $url). The Drupal::l() function was marked for removal as part of some clean-up work; Drupal 8 had too many ways to generate links.
Most deprecated code still works in drupal 8.7.0 despite the fact they have been deprecated in drupal 8.0.0 but that won’t be the same in drupal 9. Most deprecated code in drupal 8 will be completely dropped in drupal 9.
In short:
- Any Drupal 8 module that does not use deprecated code will continue to work with Drupal 9.
- Any Drupal 8 module that uses deprecated code needs to be updated before Drupal 9 is released, or upgrading to drupal 9 will be impossible
How to know if your site is using deprecated code
If you work on a Drupal site as a developer, run drupal-check. Drupal-check is a static php analysis tool which you can run against you codebase to check for deprecated code. Drupal-check should be run in an automated fashion as part of your development workflow.
If you are a site owner, install the Upgrade Status module. The module provides a graphical user interface on top of drupal-check. The goal is to provide an easy-to-use readiness assessment for your site’s migration to Drupal 9.
How difficult could updating your code be?
Most deprecation are a matter of search and replace. Although, there are some that required more refactoring . You can check the API documentation for instructions on how to remedy the deprecation.
When to start updating your code
The best and most accurate answer is NOW. When your drupal 8 code is updated to the latest and greatest APIs, you can benefit from those improvements immediately. There is no reason to wait until Drupal 9 is released.
How long you have to update your code?
Drupal 9 is set for release in June 2020, drupal 8 end of life is set for November 2021. In order to be able to upgrade to drupal, all deprecated code must be updated before June 2020.
What about the sites still using Drupal 7?
If your site runs on drupal 7, you should start the process of updating it to drupal 8.7 now, in that way when drupal 9 comes out, it will be an easy step for you to upgrade to it.
Contact us at info@stafflancer.com for how we can help get your site(s) ready for drupal 9.