reverted: --- b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user.yml +++ a/core/modules/migrate_drupal/config/install/migrate.migration.d6_user.yml @@ -23,13 +23,8 @@ migration: d6_user_role source: roles user_picture: + plugin: d6_user_picture + source: uid - - - plugin: skip_process_on_empty - source: picture - - - plugin: migration - migration: d6_user_picture_file - source: uid destination: plugin: entity:user md5_passwords: true reverted: --- /dev/null +++ a/core/modules/migrate_drupal/src/Plugin/migrate/process/d6/UserPicture.php @@ -0,0 +1,63 @@ +migration = $migration; + $this->migrationPlugin = $migration_plugin; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) { + return new static( + $configuration, + $plugin_id, + $plugin_definition, + $migration, + $container->get('plugin.manager.migrate.process')->createInstance('migration', array('migration' => 'd6_user_picture_file'), $migration) + ); + } + + /** + * {@inheritdoc} + */ + public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { + return $row->getSourceProperty('picture') ? $this->migrationPlugin->transform($value, $migrate_executable, $row, $destination_property) : NULL; + } + +} only in patch2: unchanged: --- a/core/modules/user/src/Plugin/migrate/process/d6/UserPicture.php +++ b/core/modules/user/src/Plugin/migrate/process/d6/UserPicture.php @@ -57,7 +57,12 @@ public static function create(ContainerInterface $container, array $configuratio * {@inheritdoc} */ public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { - return $row->getSourceProperty('picture') ? $this->migrationPlugin->transform($value, $migrate_executable, $row, $destination_property) : NULL; + $fname = basename($row->getSourceProperty('picture')); + $fids = \Drupal::entityQuery('file') + ->condition('uid', $value, '=') + ->condition('filename', $fname, 'LIKE') + ->execute(); + return (count($fids) == 1) ? reset($fids) : NULL; } } only in patch2: unchanged: --- a/core/modules/user/src/Tests/Migrate/d6/MigrateUserTest.php +++ b/core/modules/user/src/Tests/Migrate/d6/MigrateUserTest.php @@ -60,7 +60,7 @@ protected function setUp() { ))->save(); $file = entity_create('file', array( - 'fid' => 2, + 'fid' => 12, 'uid' => 2, 'filename' => 'image-test.jpg', 'uri' => "public://image-test.jpg", @@ -74,7 +74,7 @@ protected function setUp() { $file->save(); $file = entity_create('file', array( - 'fid' => 8, + 'fid' => 18, 'uid' => 8, 'filename' => 'image-test.png', 'uri' => "public://image-test.png",