modules/system/system.install:2079: update_variables_to_config('system.mail'

Thanks in advance for helping many hands to make light work!
See #2181257: [meta] Variables to config migration [d7] for instructions

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fastangel’s picture

Assigned: Unassigned » fastangel

working on this.

fastangel’s picture

Title: Variable to config: system.mail » Variable to config: system.mail [d7]
Status: Active » Postponed

The system mail was introduced in D7. The variable in D8

interface:
 default: 'Drupal\Core\Mail\PhpMail'

Should be mapped with mail_system (D7). For more clarification see https://api.drupal.org/api/drupal/includes!mail.inc/function/drupal_mail...
In D6 this hability only is possible with contrib modules.

chx better the explanation now? ;)

eliza411’s picture

Project: IMP » Drupal core
Version: » 8.x-dev
Component: Code » migration system
Assigned: fastangel » Unassigned

Moving to the core queue to consolidate issues now that we're doing all the work there.

eliza411’s picture

Project: Drupal core » IMP
Version: 8.x-dev »
Component: migration system » Code
Status: Postponed » Active
David Hernández’s picture

Status: Active » Needs review
FileSize
4.31 KB

Hi there,

Here is my first try to work on the migrate project. I'm not sure if I've done it correctly. I followed the steps of a d6 patch of this kind. I'm also not sure about creating a copy of Drupal6DumpCommon for Drupal 7 as it's exactly the same code. Can someone point me if I'm going in the right direction?

Regards,
David.

chx’s picture

Thanks for this. There is no need for a Drupal7DumpCommon.php and also your source plugin is drupal6_variable not drupal7_variable ; we won't write a separate drupal7 plugin when the variable table didn't change.

eliza411’s picture

I tried to update all these issues to point to some D7 specific instructions, but I missed this one, so I'm updating now.

I'll be editing those to make it more clear that we're re-using the drupal6_variable plugin (which the script should accurately be leaving in place.)

eliza411’s picture

Status: Needs review » Needs work

Setting this to needs work for the recommended adjustments, too.

eliza411’s picture

Status: Needs work » Needs review
FileSize
3.16 KB

I tried my hand at making the changes chx suggested. tests pass, but with 9 exceptions:

Drupal\Core\Database\SchemaObjectExistsException: Table variable already exists. in Drupal\Core\Database\Schema->createTable() (line 678 of /var/www/imp/drupal-imp/core/lib/Drupal/Core/Database/Schema.php).

eliza411’s picture

FileSize
3.15 KB
1.58 KB

There was more feedback in irc, below. I've made the first change, but I am unsure about the second and I'm out of time. I'm posting the one change. I hope to use this as an example for the other [d7] variable to config migrations so I'm eager to get it right but also out of my depth.

eliza411: $executable = new MigrateExecutable($migration, new MigrateMessage()); we now use
eliza411: $executable = new MigrateExecutable($migration, $this);
it's not a make-or-break change but the error reporting is much better
eliza411: also, the patch refers to Drupal7SystemMail.php but that's not added to it

eliza411’s picture

FileSize
1.75 KB
3.15 KB

Missed a change I had in the earlier patch.

David Hernández’s picture

Issue tags: +D8SVQ, +SprintWeekend2014
samhassell’s picture

Assigned: Unassigned » samhassell
David Hernández’s picture

@samhassell, still working on this?

javisr’s picture

I'm working on this issue

javisr’s picture

Assigned: samhassell » javisr
javisr’s picture

Assigned: javisr » Unassigned
FileSize
3.13 KB

Re-rolled :)

David Hernández’s picture

Status: Needs review » Needs work
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal7SystemMail.php
@@ -0,0 +1,34 @@
\ No newline at end of file

Drupal7SystemMail needs an empty line at the end of the file.

A part of that, everything looks fine. The tests are passing.

javisr’s picture

FileSize
3.11 KB

Added the empty line at the end of the file

michaellenahan’s picture

Status: Needs work » Reviewed & tested by the community

Patch applied cleanly. Tests run correctly.
I did manual testing of the migration.
On my D7 system I installed mailsystem.

On:
http://imp7.local/admin/config/system/mailsystem
I saved the form, so that there was a variable in the variables table.

$ drush vget mail_system
mail_system: array (
  'default-system' => 'DefaultMailSystem',
)

On the D8 imp system I'm in the drupal7 branch.

First step to actually run the migration with drush is to create a manifest.yml file.

manifest.yml contains one line (the id of the migration we want to run):

- d7_system_mail

In D8 imp make sure that drupal_migrate module is enabled.
(If you have no luck doing this with drush, you may need to do it via the user interface at admin/modules.)

Now you can run the migration.

drush migrate-manifest mysql://imp7:imp7@localhost/imp7 manifest.yml

And to confirm that the value from D7 has been migrated to D8, you can run "drush cget" (see "drush help cget" for the syntax).

$ drush cget system.mail interface
'system.mail:interface':
  default-system: DefaultMailSystem

Now geek out by going to the D7 site:
http://imp7.local/admin/config/system/mailsystem

Change the "Site-wide default MailSystemInterface class"
Save the form in D7.

Now on your command line for your D8 imp site:

$ drush migrate-manifest mysql://imp7:imp7@localhost/imp7 manifest.yml

Confirm that the configuration entity in D8 has now been updated.

$ drush cget system.mail interface                                    
'system.mail:interface':
  default-system: TestingMailSystem

And rejoice in the fact that you have a working migration :)

jcost’s picture

Project: IMP » Drupal core
Version: » 8.0.x-dev
Component: Code » migration system
Status: Reviewed & tested by the community » Needs work

Will need to be submitted again to Core since moving from sandbox.

phenaproxima’s picture

Needs to be merged into the parent issue.

phenaproxima’s picture

Status: Needs work » Closed (won't fix)

Merged with the parent issue.