D6NodeDeriver calls checkRequirements() when building migration plugin definitions

Created on 9 December 2020, over 4 years ago
Updated 23 May 2025, about 1 month ago

Problem/Motivation

The D6NodeDeriver calls checkRequirements() when building migration plugin definitions:

    $node_types = static::getSourcePlugin('d6_node_type');
    try {
      $node_types->checkRequirements();
    }
    catch (RequirementsException $e) {
      // If the d6_node_type requirements failed, that means we do not have a
      // Drupal source database configured - there is nothing to generate.
      return $this->derivatives;
    }

This causes a check of the database connection, because checkRequirements() does that.

If there is a node migration which depends on a database connection that's not available, then the attempt to get that connection will time out.

This means that the whole migration system is unusable, because migration tasks such as 'drush ms MIGRATION' load all migration definitions.

Workaround: override the database settings in settings.local.php.

Steps to reproduce

Run `drush ms MIGRATION` on a system with a node migration that uses a connection that's not available.

Proposed resolution

The reason for calling checkRequirements() is given in the comments in the catch block:

      // If the d6_node_type requirements failed, that means we do not have a
      // Drupal source database configured - there is nothing to generate.

Use another way to check the connection is configured which will not cause a timeout.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Postponed

Version

11.0 🔥

Component

migration system

Created by

🇬🇧United Kingdom joachim

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024