d7_file.yml 1.65 KB
Newer Older
1
2
# Every migration that references a file by Drupal 7 fid should specify this
# migration as an optional dependency.
3
id: d7_file
4
label: Public files
5
audit: true
6
7
migration_tags:
  - Drupal 7
8
  - Content
9
10
source:
  plugin: d7_file
11
  scheme: public
12
  constants:
13
14
    # The tool configuring this migration must set source_base_path. It
    # represents the fully qualified path relative to which URIs in the files
15
16
17
    # table are specified, and must end with a /. See source_full_path
    # configuration in this migration's process pipeline as an example.
    source_base_path: ''
18
process:
19
20
  # If you are using this file to build a custom migration consider removing
  # the fid field to allow incremental migrations.
21
  fid: fid
22
23
24
25
26
27
28
29
  # File entity module uses file_managed.filename as the entity title, while
  # Drupal 8 expects this to be an actual file name. Therefore, extract the
  # filename from the uri field. Otherwise, the file will migrate but form
  # validation won't pass when editing it.
  filename:
    plugin: callback
    callable: basename
    source: uri
30
31
32
33
34
35
36
37
38
39
40
41
42
43
  source_full_path:
    -
      plugin: concat
      delimiter: /
      source:
        - constants/source_base_path
        - filepath
    -
      plugin: urlencode
  uri:
    plugin: file_copy
    source:
      - '@source_full_path'
      - uri
44
  filemime: filemime
45
  # No need to migrate filesize, it is computed when file entities are saved.
46
47
48
49
50
51
52
53
54
  # filesize: filesize
  status: status
  # Drupal 7 didn't keep track of the file's creation or update time -- all it
  # had was the vague "timestamp" column. So we'll use it for both.
  created: timestamp
  changed: timestamp
  uid: uid
destination:
  plugin: entity:file