Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
migration system
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 May 2015 at 23:37 UTC
Updated:
16 Sep 2015 at 16:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
phenaproximaHey, look what the cat dragged in!
Comment #2
phenaproximaComment #6
neclimdulHaving trouble following the code on this failure. Here is the trace for anyone investigating:
Fatal on this code:
Comment #7
quietone commentedSpent some time debugging this and I agree with neclimdul that it is a bit funky to follow. But what I see is that the value returned from the user picture process plugin is the uid not the fid. And that the test, MigrateUserTest always has uid=fid (when there is a picture file), so the test will pass.
I can't get the process plugin to return the correct value. It feels like I am looking right at the solution and not seeing it.
Comment #8
quietone commentedTo get the correct fid, I added a query to the process plugin. I don't know if it the best/preferred way to fix this but it does work locally. Is there a better way?
Comment #10
phenaproxima@quietone: To get the correct fid, we use the migration process plugin, which looks up the destination ID created by a previous migration. Documentation here: https://www.drupal.org/node/2149801
Comment #11
quietone commented@phenaproxima. Hmm. Not sure how the migration process plugin helps when the user picture file doesn't have an fid destination.
Comment #12
quietone commentedRight. Start over. There was an error in my test.
Fresh patch to start again.
Comment #14
quietone commentedDid some debugging.
The skip row process behaves differently than the user picture processor when there is no user picture file. Skip row returns an empty string whereas the user picture processor returns a NULL. When the empty string is returned the error that neclimdul reported occurs. But when running from HEAD with the user picture process that method (preSave) isn't executed.
Not sure where to fix this.
Comment #15
phenaproximaI've refactored this to be, like, sane. This patch introduces a single process plugin for migrating user pictures into an image field, retrieving the fid using the migration process plugin. My hope is that this will stabilize and standardize Migrate Drupal's approach to the notoriously finicky user picture migration.
Comment #16
phenaproximaComment #17
phenaproximaDeleted a bit of extraneous junk.
Comment #18
phenaproxima@mikeryan pointed out that the plugin doesn't need to package the returned value as an image field -- the field system is smart enough to know what to do. But we do need to catch the MigrateSkipRowException that the migration process plugin may throw.
We can remove the plugin when #2487568: Process plugins should not be allowed to skip rows is fixed and use the migration process plugin directly.
Comment #19
phenaproximaPostponed on #2560671: The Migration process plugin should not skip rows. Once that lands, we will not need a dedicated process plugin to wrap the migration plugin.
Comment #20
phenaproximaUnblocked. With #2560671: The Migration process plugin should not skip rows in, we don't need the user_picture plugin at all. Let's axe it -- patch forthcoming.
Comment #21
phenaproximaAh. I sure do like shedding unnecessary LOC.
Comment #22
quietone commentedI can verify this works. Code looks good (but still getting to grips with the standards). Best of all, it is much easier to understand what is happening than before.
+1 RTBC !
Comment #23
quietone commentedAs agreed on IRC
Comment #24
phenaproximaComment #25
phenaproximaComment #26
webchickLess code FTW!
Committed and pushed to 8.0.x. Thanks!