When Drupal 7 was released in January 2011 it was a huge achievement for the Drupal community. After a great run, it reaches its end of life (EOL) in November 2023 — a two year extension from its original EOL date. As the EOL approaches, you might be considering how to move from Drupal 7 to Drupal 9.
So, what’s the best way to approach the migration from Drupal 7 to Drupal 9?
Why upgrade to Drupal 9?
Before taking on a migration to Drupal 9, it’s useful to know the benefits of doing so. Obviously, the Drupal 7 EOL is reason enough but, if you need more persuading, take a look at our article on the five key benefits of Drupal 9. The consensus is that Drupal 9 is a breath of fresh air after having used Drupal 7!
One advantage of Drupal 9 is the new core administration theme, Claro, which is a massive improvement from Seven – Drupal 7’s default administration theme. Seven was a bulletproof administration theme, but was developed more than 10 years ago and its age is showing.
The core media library lets you reuse media on your site and sort each type into individual collections, helping you keep the back end organised. There is also media library integration with the new rich text editor in core.
Some features from Drupal 7’s popular contributed modules are also now part of core in Drupal 9. Drupal core has a rigorous development process so anything that makes it into core goes through exhaustive scrutiny and testing. This means that any of the features used from core work very well together.
Views was unincorporated into core to let users fetch content from the database through the UI and display it in a variety of ways. Managing configuration in Drupal 7 was challenging — the Features module would let users export configuration to code but had a lot of problems and could not really be used to import configuration. On the other hand, Drupal 9 comes with Configuration Management, allowing users to easily export and import their entire configuration or individual configuration items.
Another issue with Drupal 7 was that managing workflows wasn’t straightforward as there were multiple competing approaches like Workflow and Workbench Moderation. In Drupal 9, this is no longer an issue — adding highly customisable workflows to your content is a simple task.
Rebuild or migrate Drupal?
Now that we’ve laid out some of the main reasons to upgrade to Drupal 9, it’s important to bear in mind that migration isn’t the best route for every website.
Although a daunting prospect, in some cases it would simply be more efficient to undergo a complete rebuild. Migrations from Drupal 7 to Drupal 9 require a lot of work and careful planning, especially if there are any custom modules or themes. Therefore, take the time to plan thoroughly and weigh up whether migration is the best option or if it would be better to start from scratch.
In the planning process, be sure to assess the entity type’s complexity and the amount of entities that are in scope is key. There could be cases where there are only a few nodes or entities of a particular type and it would be better to recreate them on destination rather than migrate them.
Now is also a good opportunity to review your content. Check for material that doesn’t get much traffic or user created taxonomies that have spun out of control. If the changes to your information architecture are going to be significant and there is a lot of outdated or unwanted content to cull, consider a website rebuild in Drupal 9 instead of a migration so that you can start with a fresh content model.
It’s worth noting that the theme will have to be rebuilt anyway because of the change from PHPTemplate to Twig as the default templating engine. So, while you’re at it, this is also a good time to redesign your website and rebuild the front end with more modern tools and design methodologies, such as Atomic Design.
Leveraging the Atomic Design methodology allows you to break the design into its basic components (atoms and molecules) that make up more complex components (organisms). This makes it easier to implement the designs with a component library like Storybook. Storybook will allow you to build and test your front end components separately from Drupal and open up the possibility to reuse these components in other channels like a mobile app, for example.
Types of Drupal 7 to Drupal 9 migrations
If you decide to migrate rather than rebuild, what type of migration will you need? This could be a simple migration of configuration and content using the core migrate suite of modules or writing custom migrations using the core Migrate API.
You can perform simple migrations using a browser user interface provided by the core Migrate Drupal UI module. Only very simple sites can usually be migrated like this and there will always be some manual steps because Views, for example, would then have to be manually recreated.
For more complex sites, you usually need to write custom migrations using the Migrate Plus suite of modules to extend the core migration framework functionality. Migrations could take a simpler lift and lift approach but, whilst doing the work, it also presents an opportunity to update your content. Writing custom migrations will let you map your entities and transform your source data into new structured and modern content in whatever way you want so it's a good opportunity to review your content model and improve your information architecture.
How to migrate from Drupal 7 to Drupal 9
When going ahead with a migration, you’ll need to perform an audit of your website and build a detailed migration plan. The first step is to start an inventory of all the modules installed on the site. A good way to do this is to install the Upgrade Status module, which will give you a list of all your modules and let you know if they have a Drupal 8 version or if it's been replaced by another module. It also gives you notes on the upgrade to Drupal 8, if available. It’s important to know the migration paths for each module as, in some cases, you will need to move to a different module in Drupal 7 to prepare your site for the Drupal 9 upgrade.
The next step is to perform an audit of all the custom code and document all the custom functionality provided by each custom module. Take this time to review if the custom functionality still provides enough value to warrant the effort of upgrading it or if it can be achieved with a Drupal 9 contributed module. When you’re sure which custom modules you want to upgrade you need to check your code for deprecations. A great tool for this is the Drupal Module Upgrader, which identifies any code that requires updating to Drupal 9 and can even attempt to automatically upgrade your code to Drupal 9. Of course, it will not work in every single case but it will upgrade any code with common deprecations and can be used as a great starting point.
For more automated migrations, Acquia provides a couple of great tools. Flight Path Assessment is a free report that gives you an in depth content migration analysis and is a quick way to have a detailed overview of the scope of your Drupal upgrade. Acquia Migrate Accelerate is an automated migration tool that quickly lets you migrate your Drupal 7 site to Drupal 9. This tool provides an intuitive interface to seamlessly migrate your content and configuration, letting you audit your modules and giving you automatic recommendations and patches for a straightforward migration.
When it comes to upgrading your site from Drupal 7 to Drupal 9, don’t let the technical requirements put you off. As we’ve explored in this article, with some planning and forethought, you can reap the benefits of Drupal 9 without any last minute panic when EOL arrives. Whether you choose a migration or rebuild, our experienced team of Drupal experts are here to support you - get in touch to get your migration underway.
Our recent insights
Serving up multi-cam streaming for the Lawn Tennis Association