Upgrading from Drupal 7 to Drupal 8: stroll in the park or mountain trek?

You’ve got a Drupal 7 website. You’re aware that support for Drupal 7 will end in November 2021. So, what do you need to plan for? Flip-flops or a pair of sturdy walking boots?

Sometimes upgrading software is a simple one-click operation. Sadly, that’s not the case if you want to upgrade from Drupal 7 to Drupal 8.

Drupal 8 is a completely new codebase built on the Symfony PHP framework, the architecture is fundamentally different, the way you build user interface templates is fundamentally different, and its APIs are different. 

While the administrator and editor user interfaces are fairly similar, Drupal 8 should, in many ways, be treated as a new product. 

In particular, there is no way to upgrade a site in situ. You need to create an empty Drupal 8 site, install the modules you’ll need for the new site, do some configuration, and then start migrating content.

Our experience

We’ve recently completed migrating the VSO International site from Drupal 7 to Drupal 8. It’s a site with many different types of content, tools for building rich campaign landing pages, and two-way integrations with Salesforce.

VSO International home page
VSO International home page

Planning

There’s a lot to consider when planning a site migration.

  • Content types
  • Content Views – listings of content, often filtered or formatted for a specific purpose
  • Taxonomies
  • Forms and form logic
  • Functionality provided by modules. Modules can be part of Drupal’s core software, community-contributed, or custom.
  • Integrations with other systems and services
  • Theme – user interface patterns, templates and components

It’s important to audit what you’ve got to give yourself a list of tasks to work through.

Migrate API

One of the new features of Drupal 8 is that it has an API that’s designed to support migrating to it, the Migrate API.

The Migrate API can be used to populate different parts of a Drupal 8 site programmatically from pre-existing sources. This includes nodes, taxonomy terms, users, files, and images. (Nodes are a fundamental concept in Drupal. Much of the content in a Drupal site is stored in nodes – for example pages, articles, forum topics, blog posts).

The Migrate API has a ‘Highwater marks’ feature which allows the API to track changes so that only content that has been created or updated in the source since the migration was previously executed will be migrated. ‘Rollbacks’ allow migrations to be undone, adjusted, and re-executed.

Migration user interface and command line tools

Drupal 8 has both a user interface and Drush command line tool to help configure data mappings and manage parts of the migration process.

These tools provide listings of what will and will not migrate without manual interventions. They generate YAML configuration files to specify mappings and control migration processes.

We experimented with the tools for the VSO migration project. While Drupal’s migration toolkit works, it is complex and fragile. And the documentation for it is incomplete.

We concluded that scripting our own migration modules in PHP was actually more efficient and gave us more control. This is the approach we use for migrating from a non-Drupal site to a Drupal site.

Modules

Modules need careful attention. Some Drupal 7 modules still don’t have Drupal 8 versions, although most of the important modules do.

If many complex modules need to be updated to Drupal 8 syntax, this will inevitably require a substantial recoding effort.

Templating

Drupal 8 uses the Twig templating language as the basis for building user interfaces.

Twig is a template engine for PHP, and part of the Symfony framework. It is more secure than the Drupal 7 templating engine. It separates template logic and views which helps to improve the reusability of template files, making for more modular, more maintainable code.

Twig is a widely used approach rather than something specific to Drupal.

The bottom line though is that there’s no simple, automated way to go from PHP templates to Twig templates. It is detailed, manual work.

Wins

At this stage you might be asking yourself what the ‘wins’ are from doing an upgrade to Drupal 8.

Here are some of the key benefits as we see them.

Secure and stable platform

It is a good time to move to Drupal 8. Drupal has committed to the transition from Drupal 8 to Drupal 9 being “an easy upgrade”. “The primary goal of the Drupal 9.0.0 release will be to remove deprecated code and update third-party dependencies“ and “we will also make it possible for contributed modules to be compatible with Drupal 8 and Drupal 9 at the same time”.

Consequently, moving to Drupal 8 represents a move to a platform that will be fundamentally stable for many years to come.

And, of course, moving to Drupal 8 will provide peace of mind for owners of Drupal 7 sites who can’t be sure their sites will remain secure after November 2021.

Better maintainability

Drupal 8’s object oriented implementation, and the switch to Twig-based templating in particular, will make for more modular, and more easily maintainable code.

Drupal 8’s use of the Symfony development framework and Composer dependency management software greatly improves control over the updating of modules deployed for a site.

Performance

Drupal 8’s architecture and improved caching provide opportunities for real world performance improvements. We’ve certainly seen improvements for VSO’s redeveloped site.

Editing tools

As well as making it easier to reuse user interface components across different content types, Drupal 8 has a module called Layout Builder which enables editors to create landing pages with custom layouts far more easily than is possible in Drupal 7.

Rationalisation of user interface patterns

While not strictly a benefit of switching to Drupal 8, our project with VSO gave us the opportunity to rationalise the library of user interface patterns for the site.

As a consequence of this we’ve been able to reduce code bloat, improve performance, and improve maintainability.

Conclusions

Like an old car that’s reached the end of the road, a point is sometimes reached when more fixes just won’t give you something that’s fit for purpose any more in the modern world.

And so it is with Drupal 7. By the time support for it ends, nearly eleven years will have passed since its first release.

Drupal’s ‘coming of age’

In many ways Drupal 8 represents a ‘coming of age’ for Drupal. It is now engineered using an object oriented approach on a ’serious’ framework: Symfony. It has a rich set of APIs, so can genuinely claim to provide a content management platform that can be integrated into larger digital ecosystems.

Migration is a major task

There’s no hiding from the fact that updating or, more accurately, migrating from Drupal 7 to Drupal 8 is always going to be a major task. It fundamentally involves a lot of work.

The rewards can be substantial

However, the rewards for migrating can be substantial.

Drupal’s commitment to an easy upgrade from Drupal 8 to Drupal 9 provides stability and longevity that is highly desirable.

Improved maintainability, performance, and some excellent editing tools will benefit website owners, users, and editors.

While switching from Drupal 7 to Drupal 8 might mean dusting off the walking boots, tent and rucksack, the view from the top looks great.

Chris Scott's avatar
Author
Chris Scott
Date
12 March 2020
Categories