0

I'm currently using Drush to migrate a Drupal 7 site to a fresh copy of Drupal 8. Everything is migrated except the image fields.

I get thousands of these warnings with different ID numbers.

[warning] Missing file with ID 26. ImageItem.php:329
[warning] Missing file with ID 26. ImageItem.php:329
[warning] Missing file with ID 26. ImageItem.php:329

I'm also using WAMP to locally migrate the site and maybe I'm typing the destination public file path incorrectly. Here's some of the commands I tried.

  • drush migrate-upgrade --legacy-db-key=migrate --legacy-root=/wamp64/www/d7 --configure-only

  • drush migrate-upgrade --legacy-db-key=migrate --legacy-root=c:/wamp64/www/d7 --configure-only

  • drush migrate-upgrade --legacy-db-key=migrate --legacy-root=/www/d7 --configure-only

  • drush migrate-upgrade --legacy-db-key=migrate --legacy-root=/d7 --configure-only

What's the command to migrate images too?

Thanks!

2
  • Do you see a d7_file migration generated after your drush migrate-upgrade command? You need to have run the d7_file migration before image fid references can resolve to their new values.
    – Shawn Conn
    Jun 12, 2020 at 0:20
  • You also need to supply the path to your D7 installation where the files reside. In the file migrations generated by migrate upgrade this appears under source: constants: source_base_path. Jun 12, 2020 at 11:04

1 Answer 1

0

Thanks guys for helping out! I figured it out and migrated all my images and files. Here's what I did for anyone who has the same problem:

I'm was using WAMP and WSL Ubuntu, I was setting the legacy--path incorrectly so my source_base_path was incorrect. I had to open up migrate_plus.migration.upgrade_d7_file.yml and used the correct path. Then I ran drush config-import to import the updated file and then ran the migrate.

Here's my file:

uuid: 2a4842a5-0869-4984-aaae-68d6c5814f5d
langcode: en
status: true
dependencies: {  }
id: upgrade_d7_file
class: Drupal\migrate\Plugin\Migration
field_plugin_method: null
cck_plugin_method: null
migration_tags:
  - 'Drupal 7'
  - Content
migration_group: migrate_drupal_7
label: 'Public files'
source:
  plugin: d7_file
  scheme: public
  constants:
    source_base_path: /mnt/c/wamp64/www/d7
process:
  fid:
    -
      plugin: get
      source: fid
  filename:
    -
      plugin: get
      source: filename
  source_full_path:
    -
      plugin: concat
      delimiter: /
      source:
        - constants/source_base_path
        - filepath
    -
      plugin: urlencode
  uri:
    -
      plugin: file_copy
      source:
        - '@source_full_path'
        - uri
  filemime:
    -
      plugin: get
      source: filemime
  status:
    -
      plugin: get
      source: status
  created:
    -
      plugin: get
      source: timestamp
  changed:
    -
      plugin: get
      source: timestamp
  uid:
    -
      plugin: get
      source: uid
destination:
  plugin: 'entity:file'
  source_base_path: /mnt/c/wamp64/www/d7/sites/default/files/
migration_dependencies:
  required: {  }
  optional: {  }

1
  • Does anyone have a reference to how to create the "migrate_plus.migration.upgrade_d7_file.yml" file? A drush config:export does not seem to be creating it for me, and I'm seeing the d7_file migration operate as if the legacy-root is not set.
    – Mark
    Jul 6, 2021 at 1:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.