d7_file.yml

Same filename in other branches
  1. 9 core/modules/file/migrations/d7_file.yml
  2. 8.9.x core/modules/file/migrations/d7_file.yml
  3. 10 core/modules/file/migrations/d7_file.yml
core/modules/file/migrations/d7_file.yml

File

core/modules/file/migrations/d7_file.yml

View source
  1. # Every migration that references a file by Drupal 7 fid should specify this
  2. # migration as an optional dependency.
  3. id: d7_file
  4. label: Public files
  5. audit: true
  6. migration_tags:
  7. - Drupal 7
  8. - Content
  9. source:
  10. plugin: d7_file
  11. scheme: public
  12. constants:
  13. # The tool configuring this migration must set source_base_path. It
  14. # represents the fully qualified path relative to which URIs in the files
  15. # table are specified. This can be a local file directory containing the
  16. # source site, e.g. /var/www/docroot, or the site address,
  17. # e.g. https://example.com. This value will be concatenated with the file
  18. # path (typically sites/default/files) and used as the source location for
  19. # the files.
  20. #
  21. # Suppose that the source files have been moved by other means to a location
  22. # on the destination site.
  23. # Source site:
  24. # Location of files: /var/www/html/legacy/sites/default/files
  25. # Public scheme: sites/default/files
  26. # In this example, source_base_path should be '/var/www/html/legacy'.
  27. #
  28. # Suppose that the source site is a multisite installation at
  29. # https://example.com, and you plan to copy the files from there.
  30. # Source site:
  31. # Location of files: https://example.com/sites/example.com/files
  32. # Public scheme: sites/example.com/files
  33. # In this example, source_base_path should be 'https://example.com'.
  34. #
  35. # See the configuration for the source_full_path property in the process
  36. # section below.
  37. source_base_path: ''
  38. process:
  39. # If you are using this file to build a custom migration consider removing
  40. # the fid field to allow incremental migrations.
  41. fid: fid
  42. filename: filename
  43. source_full_path:
  44. -
  45. plugin: concat
  46. delimiter: /
  47. source:
  48. - constants/source_base_path
  49. - filepath
  50. -
  51. plugin: urlencode
  52. uri:
  53. plugin: file_copy
  54. source:
  55. - '@source_full_path'
  56. - uri
  57. filemime: filemime
  58. # No need to migrate filesize, it is computed when file entities are saved.
  59. # filesize: filesize
  60. status: status
  61. # Drupal 7 didn't keep track of the file's creation or update time -- all it
  62. # had was the vague "timestamp" column. So we'll use it for both.
  63. created: timestamp
  64. changed: timestamp
  65. uid: uid
  66. destination:
  67. plugin: entity:file

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.