Problem/Motivation

The migration of system.mail settings migration (d7_system_mail) assumes that the mail_system variable is always set, and it always has a default-system key. This is not correct. I checked the most recent Drupal 7 codebase, and the only place where it is used (excluding tests) is the drupal_mail_system() function, but that function only reads this variable.

Proposed resolution

Change the interface/default process pipeline: If the mail_system variable is not null, try to explode it first before applying the static_map. The static map should allow bypassing, and have a trailer default value process (with the Drupal 8|9 default value). If the mail_system variable doesn't exist (so it is NULL), then we also have to use the Drupal8|9 default value.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3151980

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

huzooka created an issue. See original summary.

huzooka’s picture

Version: 9.0.x-dev » 9.1.x-dev
Assigned: Unassigned » huzooka
quietone’s picture

Hmm, I grepped Drupal 7 as well and found that mail.inc does set the variable mail_system.

drupal/includes/mail.inc: $configuration = variable_get('mail_system', array('default-system' => 'DefaultMailSystem'));

And even if the variable is not set the source plugin will return NULL. Then the static map will throw MigrateSkipRowException so nothing is written to configuration on the destination.

huzooka’s picture

@quietone, that' is a variable_get() with a default value, not a setter.

huzooka’s picture

I don't really agree with that throwing an error is the right solution.

quietone’s picture

The goal is to migrate the value from the source site. If the source site value is not set then there is no data to migrate and skipping the row is the correct action.

huzooka’s picture

If the source site value is not set then there is no data to migrate and skipping the row is the correct action.

I can't agree.

If the source site value is not set (so when is no data to migrate) then the correct action is to tell that there are zero rows to migrate in this migration and not throwing exceptions and logging errors.

huzooka’s picture

And especially, what should happen if a contrib module wants to provide migration path for its mailing system?..

wim leers’s picture

This seems to be once again the problem that the migration system's handling of the variable table insists on having a single row just to signal migration status, even if there literally is nothing to migrate.

Why can't we use \Drupal\migrate\Plugin\RequirementsInterface for this?

quietone’s picture

@huzooka, I see your point. I am just so used to it being this way.

huzooka’s picture

huzooka’s picture

Status: Needs work » Needs review

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

wim leers’s picture

Status: Needs review » Reviewed & tested by the community

#3152789: Add required variables config to Variable migrate source plugin, and if one of those are missing, return zero rows landed a month ago — no blockers left for this! Been using this for months and it works great 👍

benjifisher’s picture

I do not know why the testbot did not set the status to NW with the failing test.

Just a guess based on the previous comment: this issue may need an update after #3182891: The variables_required setting is a tricky name.

benjifisher’s picture

Status: Reviewed & tested by the community » Needs work
benjifisher’s picture

Issue summary: View changes
Issue tags: +Novice

A quick look at the patch confirms my guess. This update looks like a Novice task, so I am adding the tag and updating the "Remaining tasks" in the issue summary.

wim leers’s picture

Correct :) Thanks for adding the Novice tag!

anmolgoyal74’s picture

Status: Needs work » Needs review
StatusFileSize
new443 bytes
benjifisher’s picture

Status: Needs review » Needs work

@anmolgoyal74:

Thanks for updating a patch!

We now have the option of using merge requests (MRs). Look for the green "Create issue fork" button. But if you continu using the old patch-based approach, then please attach an interdiff along with the patch. See Creating an interdiff.

benjifisher’s picture

Issue summary: View changes
Status: Needs work » Reviewed & tested by the community
Issue tags: -Novice

@anmolgoyal74:

I should have suggested that a Novice task like this is a good time to try something new, like creating a MR, but it looks as though you did not need that nudge.

It seems that creating a MR does not automatically set the issue status to NR. That may change, but for now, please check that when you create a new MR.

Back to RTBC based on #14.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed
alexpott’s picture

Committed and pushed 36b600e480 to 9.2.x and 749fc09ae7 to 9.1.x. Thanks!

  • alexpott committed 36b600e on 9.2.x
    Issue #3151980 by anmolgoyal74, huzooka, benjifisher, Wim Leers,...

  • alexpott committed 749fc09 on 9.1.x
    Issue #3151980 by anmolgoyal74, huzooka, benjifisher, Wim Leers,...
wim leers’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.