Create Files to enable end user to migrate Users from Drupal 7 to Drupal 8.

CommentFileSizeAuthor
#77 interdiff-2414651-75-77.txt2.19 KBphenaproxima
#77 2414651-77.patch80.93 KBphenaproxima
#75 interdiff-2414651-72-75.txt2.91 KBphenaproxima
#75 2414651-75.patch80.77 KBphenaproxima
#72 interdiff-2414651-70-72.txt9.17 KBphenaproxima
#72 2414651-72.patch79.95 KBphenaproxima
#70 interdiff-2414651-67-70.txt14.94 KBphenaproxima
#70 2414651-70.patch76.19 KBphenaproxima
#68 d6_d7_diffs.txt39.61 KBmikeryan
#67 2414651-67.patch61.39 KBphenaproxima
#65 2414651-65.patch70.69 KBquietone
#63 interdiff-60-63.txt8.92 KBquietone
#63 2414651-63.patch60.25 KBquietone
#60 interdiff-2414651-56-60.txt4.49 KBphenaproxima
#60 2414651-60.patch66.27 KBphenaproxima
#56 interdiff-2414651-55-56.txt7.01 KBphenaproxima
#56 2414651-56.patch64.6 KBphenaproxima
#55 interdiff-2414651-53-55.txt17.3 KBphenaproxima
#55 2414651-55.patch60.17 KBphenaproxima
#53 interdiff-2414651-48-53.txt8.6 KBphenaproxima
#53 2414651-53.patch50.16 KBphenaproxima
#48 interdiff-2414651-46-48.txt10.38 KBphenaproxima
#48 2414651-48.patch42.39 KBphenaproxima
#46 2414651-46.patch42.35 KBphenaproxima
#35 interdiff-2414651-32-35.txt403 bytesphenaproxima
#35 2414651-35.patch54.88 KBphenaproxima
#35 2414651-35.patch42.23 KBphenaproxima
#32 interdiff-2414651-30-32.txt3.45 KBquietone
#32 2414651-32.patch54.88 KBquietone
#30 interdiff-2414651-28-30.txt26.1 KBquietone
#30 2414651-30.patch55.51 KBquietone
#28 interdiff-2414651-24-28.txt14.51 KBphenaproxima
#28 2414651-28.patch39.02 KBphenaproxima
#24 2414651-24.patch31.57 KBphenaproxima
#17 2414651-17.patch33.36 KBphenaproxima
#16 2414651-16.patch46.09 KBphenaproxima
#15 2414651-15.patch345.85 KBphenaproxima
#14 2414651-14.patch27.64 KBphenaproxima
#12 2414651-12.patch29.35 KBphenaproxima
#10 2414651-10.patch24.36 KBphenaproxima
#7 2414651-7.patch9.56 KBphenaproxima
#6 2414651-6.patch9.56 KBphenaproxima
#1 migration_files_for-2414651-1.patch9.51 KBmiguelc303

Comments

andypost’s picture

User signatures could go contrib for d8

benjy’s picture

benjy’s picture

miguelc303’s picture

Added organization support to Anexus IT

phenaproxima’s picture

Status: Active » Postponed
StatusFileSize
new9.56 KB

Updated against HEAD and postponed until MigrateDrupal7TestBase lands.

phenaproxima’s picture

Project: IMP » Drupal core
Version: » 8.0.x-dev
Component: Code » migration system
Status: Postponed » Needs review
StatusFileSize
new9.56 KB
phenaproxima’s picture

phenaproxima’s picture

benjy’s picture

There is talk of changing the migrate/user/password stuff over here: https://www.drupal.org/node/1845004#comment-9997759

Might be worth checking out how that will work with this patch.

phenaproxima’s picture

StatusFileSize
new29.35 KB

Updated the patch, and tests. Removed a bunch of stuff relating to mapping filter format permissions to roles; I don't think this will be necessary, because filter formats don't need to be migrated before roles. (Roles will happily save, even if they contain undefined permissions.)

Status: Needs review » Needs work

The last submitted patch, 12: 2414651-12.patch, failed testing.

phenaproxima’s picture

Status: Needs work » Needs review
StatusFileSize
new27.64 KB

Cleaned up MigrateUserTest and a couple of other things.

phenaproxima’s picture

phenaproxima’s picture

StatusFileSize
new46.09 KB

Fixing minor test breaks caused by the removal of the fake DB driver.

I've omitted the interdiff because the patch in #15 accidentally included a bunch of stuff from 8.0.x that has nothing to do with user migration. Whoops :)

phenaproxima’s picture

StatusFileSize
new33.36 KB

Re-rolled because the patch was seriously out of date. Changes were fairly extensive so I'm skipping the interdiff.

mikeryan’s picture

Status: Needs review » Postponed
Related issues: +#2534042: Move module-specific migration support into the user module

Postponed on #2534042: Move module-specific migration support into the user module - let's get everything moved first (which will require rerolling this patch).

Status: Postponed » Needs work

The last submitted patch, 17: 2414651-17.patch, failed testing.

phenaproxima’s picture

Status: Needs work » Postponed
phenaproxima’s picture

Status: Postponed » Needs review

phenaproxima queued 17: 2414651-17.patch for re-testing.

Status: Needs review » Needs work

The last submitted patch, 17: 2414651-17.patch, failed testing.

phenaproxima’s picture

Status: Needs work » Needs review
StatusFileSize
new31.57 KB

And now for something completely similar (re-roll).

The last submitted patch, 6: 2414651-6.patch, failed testing.

The last submitted patch, 1: migration_files_for-2414651-1.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 24: 2414651-24.patch, failed testing.

phenaproxima’s picture

Status: Needs work » Needs review
StatusFileSize
new39.02 KB
new14.51 KB

Let's see how this one does. I consolidated a few migrations which were identical for D6 and D7, so there's a good chance this will fail testing.

Status: Needs review » Needs work

The last submitted patch, 28: 2414651-28.patch, failed testing.

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new55.51 KB
new26.1 KB

Moved test files from Migrate/d6 to Migrate.

Status: Needs review » Needs work

The last submitted patch, 30: 2414651-30.patch, failed testing.

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new54.88 KB
new3.45 KB

There were still some calls to loadDumps and references to d6_user_picture...
Let's try again.

Status: Needs review » Needs work

The last submitted patch, 32: 2414651-32.patch, failed testing.

quietone’s picture

Except for MigrateDrupal6Test, these tests pass locally. This is isn't the first time I've had problems because of the MigrateDrupal6Test. What is the value of MigrateDrupal6Test?

phenaproxima’s picture

Status: Needs work » Needs review
StatusFileSize
new42.23 KB
new54.88 KB
new403 bytes

Should be fixed now. It was one damn line in d6_user.yml...and one of the more emotionally exhausting bugfixes of my career thus far.

EDIT: Uh...hmm, I screwed up that upload. The ~55KB one is correct.

The last submitted patch, 35: 2414651-35.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 35: 2414651-35.patch, failed testing.

quietone’s picture

thx phenaproxima, I looked right at that file a couple of times and missed it. 'Emotionally exhausting' is right!

phenaproxima queued 35: 2414651-35.patch for re-testing.

phenaproxima’s picture

Status: Needs work » Needs review
mikeryan’s picture

Status: Needs review » Needs work

Before doing a full code review, I've tried running this with a real D7 site using migrate_upgrade. Issues I've found:

  1. d7_user_role creates redundant roles - in addition to the default Administrator, Authenticated User, and Anonymous User roles, I end up with administrator, authenticated user, and anonymous user. We need to map those roles to the existing ones rather than recreating them.
  2. d7_user itself dies with "exception 'InvalidArgumentException' with message 'Passed variable is not an array or object, using empty array instead' in /Users/mryan/Sites/d8/core/modules/migrate/src/Plugin/migrate/process/Flatten.php:35". This appears to be happening when mapping the roles using the d7_user_role migration, so may be related to #1.
mikeryan’s picture

Assigned: Unassigned » mikeryan

I'm taking a pass at this atm.

mikeryan’s picture

OK, on the user role issue, applying the user_update_8002 process plugin as we did for D6 maps the anonymous and authenticated roles appropriately. We still get Administrator plus administrator, but that's not a built-in role - it's arguable either way whether it should be automatically consolidated or not - if it should, that would be a separate issue.

With the user role issue fixed, I next hit "Fatal error: Call to a member function getFileUri() on a non-object in /Users/mryan/Sites/IMP2/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php on line 318" (with some tweaking to the user_picture migration). Commenting out the picture migration for now led to successful user import, so we've still got some work to do on the pictures.

phenaproxima’s picture

Status: Needs work » Postponed
phenaproxima’s picture

Issue tags: +Migrate critical, +blocker

This is also the first of the "Big Four" migrations for D7, so it is absolutely Migrate-critical, and it blocks the Node migration since nodes need an author :)

phenaproxima’s picture

StatusFileSize
new42.35 KB

Here it is, folks...the working (I hope) patch for user migration, pulled from the IMP2 sandbox.

phenaproxima’s picture

Status: Postponed » Needs review

Unblorked.

phenaproxima’s picture

StatusFileSize
new42.39 KB
new10.38 KB

Fixed assorted sucktitude and WTFs.

The last submitted patch, 46: 2414651-46.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 48: 2414651-48.patch, failed testing.

benjy’s picture

+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateDrupal6Test.php
@@ -147,10 +147,10 @@ class MigrateDrupal6Test extends MigrateFullDrupalTestBase {
-    'd6_user_picture_entity_display',
-    'd6_user_picture_entity_form_display',
-    'd6_user_picture_field_instance',
-    'd6_user_picture_field',
+    'user_picture_entity_display',
+    'user_picture_entity_form_display',
+    'user_picture_field_instance',
+    'user_picture_field',

Shared migrations, that's cool.

phenaproxima queued 48: 2414651-48.patch for re-testing.

phenaproxima’s picture

Status: Needs work » Needs review
StatusFileSize
new50.16 KB
new8.6 KB

Thar be cruft in them thar tests. Let's try again.

The last submitted patch, 48: 2414651-48.patch, failed testing.

phenaproxima’s picture

StatusFileSize
new60.17 KB
new17.3 KB

Generalized the user_mail migration -- it's identical between D6 and D7 -- and added assertions for it.

phenaproxima’s picture

StatusFileSize
new64.6 KB
new7.01 KB

Fixed failures resulting from #55.

The last submitted patch, 53: 2414651-53.patch, failed testing.

The last submitted patch, 55: 2414651-55.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 56: 2414651-56.patch, failed testing.

phenaproxima’s picture

Status: Needs work » Needs review
StatusFileSize
new66.27 KB
new4.49 KB

Good lord. Once again?

quietone queued 60: 2414651-60.patch for re-testing.

Status: Needs review » Needs work

The last submitted patch, 60: 2414651-60.patch, failed testing.

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new60.25 KB
new8.92 KB

And again. :-)

Status: Needs review » Needs work

The last submitted patch, 63: 2414651-63.patch, failed testing.

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new70.69 KB

Oops, got a knock on the door and didn't check test results before submitting the previous patch.

Since D6 user_mail tokens do not get converted was committed the user mail migration includes all the user_mail_* variables, which by the way, are different than the ones in D7 and that is why #60 fails. D7 has the same user_mail variables as D6 plus one more, user_mail_cancel_*. There is a nifty page showing the differences but I can't find it tonight.

The attached patch separates the user_mail migrations, so that the D8 mail cancel_confirm fields are filled by the D6 user_mail_delete variables (as in #2551631) and for D7 they are filled with the user_mail_cancel variables (as in patch #60).

No interdiff, as it fails.

Status: Needs review » Needs work

The last submitted patch, 65: 2414651-65.patch, failed testing.

phenaproxima’s picture

Status: Needs work » Needs review
StatusFileSize
new61.39 KB

Fixing the failure. Interdiff is being weird for me too, so screw it.

mikeryan’s picture

StatusFileSize
new39.61 KB

Here are the diffs between D6 and D7 files that exist for both, always enlightening.

Meanwhile, ran both a D6 and D7 site through migrate_upgrade with this patch, users look fine in both.

mikeryan’s picture

Just reviewing the diffs between D6 and D7, haven't done a full patch review yet:

  1. +++ b/core/modules/user/migration_templates/d7_user.yml
    @@ -13,25 +15,17 @@ process:
    -  user_picture:
    

    Since the D7 users.picture was a fid, and we're preserving IDs (including fids), shouldn't we able to do

      user_picture: picture
    

    here?

  2. +++ b/core/modules/user/migration_templates/d7_user_mail.yml
    @@ -20,48 +20,20 @@ source:
    -  'status_activated/subject':
    -    plugin: convert_tokens
    -    source: user_mail_status_activated_subject
    ...
    +   'status_activated/subject': user_mail_status_activated_subject
    

    Just to clarify in my mind - tokens changed between D6 and D7, but not between D7 and D8, thus we don't need the conversion here?

phenaproxima’s picture

StatusFileSize
new76.19 KB
new14.94 KB

Added profile support by generalizing the d6_profile_* migrations (except d6_profile_field_values). The d7_user migration uses a builder to merge profile properties directly into the user object.

Status: Needs review » Needs work

The last submitted patch, 70: 2414651-70.patch, failed testing.

phenaproxima’s picture

Status: Needs work » Needs review
StatusFileSize
new79.95 KB
new9.17 KB

Whoops.

quietone’s picture

Re #2 in comment #69.
From working on "D6 user_mail tokens do not get converted" I do believe that the '!' style tokens are only in D6.

Status: Needs review » Needs work

The last submitted patch, 72: 2414651-72.patch, failed testing.

phenaproxima’s picture

Status: Needs work » Needs review
StatusFileSize
new80.77 KB
new2.91 KB

Wat.

mikeryan’s picture

Down to the nits...

  1. +++ b/core/modules/user/migration_templates/d7_user.yml
    @@ -0,0 +1,31 @@
    +  init: init
    

    I still feel the one-line

      user_picture: picture
    

    is worth adding here rather than doing in a followup.

  2. +++ b/core/modules/user/src/Plugin/migrate/builder/d7/User.php
    @@ -0,0 +1,90 @@
    +    try {
    +      $profile_fields = $this->getSourcePlugin('profile_field', $template['source']);
    +      // Ensure that Profile is enabled in the source DB.
    +      $profile_fields->checkRequirements();
    ...
    +    catch (RequirementsException $e) {
    +      // Profile is not enabled in the source DB, so don't do anything.
    +    }
    

    The try only needs to be around the checkRequirements() call.

The rest looks good to me, and manual tests continue to succesfully import users...

phenaproxima’s picture

StatusFileSize
new80.93 KB
new2.19 KB
  1. Added.
  2. It needs to be around the whole thing because I don't even want to try to loop through $profile_fields if it fails the requirements check.
mikeryan’s picture

Status: Needs review » Reviewed & tested by the community

It needs to be around the whole thing because I don't even want to try to loop through $profile_fields if it fails the requirements check.

The getSourcePlugin could be move out of the try, but don't bother unless you're rerolling anyway...

RTBC by my account!

webchick’s picture

Status: Reviewed & tested by the community » Fixed
  1. +abstract class FieldableEntity extends DrupalSqlBase {
    

    This looks like it'll come in handy for other entity migraitons. yay.

  2. +++ b/core/modules/user/src/Plugin/migrate/process/ProfileFieldSettings.php
    @@ -13,15 +13,13 @@
    - *   id = "d6_profile_field_settings"
    + *   id = "profile_field_settings"
    

    A huge chunk of the patch is just doing changes like this; that's awesome that we're able to re-use all of this stuff from the D6 migration. :D

  3. +++ b/core/modules/user/src/Plugin/migrate/process/ProfileFieldSettings.php
    similarity index 85%
    rename from core/modules/user/src/Plugin/migrate/process/d6/UserUpdate8002.php
    
    rename from core/modules/user/src/Plugin/migrate/process/d6/UserUpdate8002.php
    rename to core/modules/user/src/Plugin/migrate/process/UserUpdate8002.php
    

    Not introduced in this patch, but WTF at that class name? :P

Committed and pushed to 8.0.x. YEAH! 1 down, 3 to go. :)

  • webchick committed 2d9a0b9 on 8.0.x
    Issue #2414651 by phenaproxima, quietone, miguelc303, mikeryan, benjy:...
webchick’s picture

Oh, neglected to mention my favourite part which is the new email texts. ;)

Status: Fixed » Closed (fixed)

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