API page: https://api.drupal.org/api/drupal/core%21modules%21file%21migration_temp...

Enter a descriptive title (above) relating to d7_file.yml, then describe the problem you have found:

I followed the instruction and duplicated the file.yml file and added the source_base_path but when i run the import. Not a single file is imprted

Any idea why

Comments

docans created an issue. See original summary.

cilefen’s picture

Component: documentation » migration system
Priority: Critical » Normal
Status: Active » Postponed (maintainer needs more info)
Issue tags: +Needs steps to reproduce

Hi @docans:

The project has a priority scale for issues. This one is normal. I've moved this to the migration system component, tagged it "Needs steps to reproduce", and postponed it on those updates. Please include things like:

  • What instructions did you follow?
  • What does your code look like? We don't know.
docans’s picture

Thanks for the feedback. These are the steps i took.

I went to this link https://www.drupal.org/docs/8/upgrade/upgrade-using-drush and followed the instruction.

First of all i run the code below

drush migrate-upgrade --legacy-db-url=mysql://user:password@server/db --legacy-root=http://example.com --configure-only

Which generated the all the migration scripts and this is the output of the migrate_plus.migration.upgrade_d7_file.yml

langcode: en
status: true
dependencies: {  }
id: upgrade_d7_file
migration_tags:
  - 'Drupal 7'
migration_group: migrate_drupal_7
label: Files
source:
  plugin: d7_file
  scheme: public
  constants:
    source_base_path: ''
process:
  fid: fid
  filename: 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: filemime
  status: status
  created: timestamp
  changed: timestamp
  uid: uid
destination:
  plugin: 'entity:file'
  source_base_path: var/www/www.example.com/
migration_dependencies:
  required: {  }
  optional: {  }

from the upgrade_d7_file it doesn't make sense to me why the "source_base_path: var/www/www.example.com/" should be under destination instead of the source.

When i run the command
drush migrate-import --limit=10 upgrade_d7_file
I got this feedback
Processed 10 items (0 created, 0 updated, 10 failed, 0 ignored) - done with 'upgrade_d7_file'
So to debug i run following command to show me what happened
drush mmsg upgrade_d7_file
and this was the feedback but all the files listed below are available on my drupal 7 site

 source_ids_hash          level                   message
 61498ee526a129         1            File '/sites/default/files/book.png' does not exist
 90304713aa4be5         1            File '/sites/default/files/meet.gif' does not exist
 eacaf701d2256ad         1            File '/sites/default/files/time_0.png' does not exist
 6716890b1f27075        1            File '/sites/default/files/tJan2_0.gif' does not exist
 ef65baa6be4aae6         1            File '/sites/default/files/over.png' does not exist
 032cf7e48cf066ca        1            File '/sites/default/files/meetJohn.gif' does not exist
 a2b77d2477e3249       1            File '/sites/default/files/Family.gif' does not exist
 68a955a65238116       1            File '/sites/default/files/Now.gif' does not exist
 247b62dc96c9ffd2        1           File '/sites/default/files/Problem.gif' does not exist
 f2acf3ffb908e372e        1           File '/sites/default/files/Solution.gif' does not exist

Is there something more i need to add to my script or what am i missing in order to be able to successfully migrate files

cilefen’s picture

Status: Postponed (maintainer needs more info) » Active
Issue tags: -Needs steps to reproduce
docans’s picture

I finally got it to work, i had to update my drupal core to 8.4.2 and also update the migrate_plus, migrate_tools, migrate_upgrade modules to make this work

Secondly

  1. if you are migrating files from a d7 live website to a d8 local/live site use --legacy-root=http://example.com
  2. if you are migrating files from a d7 local website to a d8 localsite use --legacy-root=/var/www/drupal/

I hope this helps someone

docans’s picture

Status: Active » Fixed
crash98’s picture

I had the same problem. With 'drush mmsg upgrade_d7_file' I found that no absolute filepath was used for the migration.
I edited the migration via /devel/config/edit/migrate_plus.migration.upgrade_d7_file and added an absolute path to the source concat plugin:

source:
  plugin: d7_file
  scheme: public
  constants:
    source_base_path: /var/www/html/original

Here is the full migration code:

uuid: 619e72fc-8857-44cd-89ca-6c87fbe34ffd
langcode: de
status: true
dependencies: {  }
id: upgrade_d7_file
class: null
field_plugin_method: null
cck_plugin_method: null
migration_tags:
  - 'Drupal 7'
migration_group: migrate_drupal_7
label: Files
source:
  plugin: d7_file
  scheme: public
  constants:
    source_base_path: /var/www/html/original
process:
  fid: fid
  filename: 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: filemime
  status: status
  created: timestamp
  changed: timestamp
  uid: uid
destination:
  plugin: 'entity:file'
  source_base_path: /var/www/html/original/sites/default/files/
migration_dependencies:
  required: {  }
  optional: {  }

This worked for me after editing and running the migration again.

docans’s picture

Awesome Solution

Status: Fixed » Closed (fixed)

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