B A C K
Preparing for Drupal 9: A Comprehensive Migration Guide

Preparing for Drupal 9: A Comprehensive Migration Guide

Knowledge

As we approach the release of Drupal 9 (June 3rd, 2020), it's crucial to understand that this upgrade represents a significant yet manageable transition in the Drupal ecosystem. The key to a smooth migration lies in maintaining current Drupal 8 sites with up-to-date dependencies, libraries, and modules.

Why is Drupal 9 Different?

The transition to Drupal 9 marks a fundamental shift in how Drupal handles major version upgrades. This change is primarily driven by Symfony 3's approaching end-of-life in November 2021. Drupal 9 will adopt Symfony 4, ensuring the platform remains secure and modern.

Key Technical Requirements

System Requirements

  1. Symfony version 4 or higher will be required.
  2. PHP 7.2 or newer will be mandatory, as specified in Symfony's documentation.

Module Changes

Several core modules will undergo significant changes:

  • The action module will become action_ui.
  • block_place will be integrated into the block module.
  • field_layout will transition to layout_builder.
  • simpletest will be renamed to phpunit_ui.

Code Updates

A significant change involves the deprecation of various functions. For example, the file_unmanaged_copy() function will be replaced with a more robust service-based approach.

Previous implementation:

function file_unmanaged_copy($source, $destination = NULL, $replace = FILE_EXISTS_RENAME) {
  @trigger_error('file_unmanaged_copy() is deprecated in Drupal 8.7.0 and will be removed
    before Drupal 9.0.0. Use \Drupal\Core\File\FileSystemInterface::copy().
    See https://www.drupal.org/node/3006851.', E_USER_DEPRECATED);
  // ... implementation details
}

New service-based approach:

\Drupal::service('file_system')->copy($source, $destination);

This change embraces dependency injection through the container, promoting better architectural practices.

Migration Planning

Timeline Considerations

  • Drupal 8.8 represents the final version that will introduce deprecations for Drupal 9.
  • Existing Drupal 7 sites can migrate directly to Drupal 9, as it maintains feature parity with Drupal 8.

Tools and Resources

The drupal-check tool (available at github.com/mglaman/drupal-check) helps identify:

  • Deprecated code usage.
  • Potential compatibility issues.
  • Code that needs updating before migration.

Best Practices for Migration

  1. Keep current Drupal 8 sites updated with the latest minor version.
  2. Regularly audit and update contributed modules.
  3. Use development tools to identify deprecated code.
  4. Test extensively in a staging environment.
  5. Plan for adequate testing time before production deployment.

Future Outlook

As Dries Buytaert, Drupal's project lead, emphasizes: "The first release of Drupal 9 will closely mirror the final minor release of Drupal 8. The primary changes focus on removing deprecated code and updating third-party dependencies."

For detailed migration documentation and updates, visit drupal.org/docs/9.

This structured approach to migration ensures that organizations can transition smoothly to Drupal 9 while maintaining site functionality and performance. By following these guidelines and keeping current with updates, the migration process becomes a manageable evolution rather than a dramatic overhaul.