Adds migration configs.
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
# Migration configuration for importing image files.
|
||||
id: cdesai_profile_pages_image_files
|
||||
label: Import Profile Page Files
|
||||
migration_group: CDESAI_MEDIA
|
||||
|
||||
source:
|
||||
# The custom CSV source plugin will fetch the source path from configs.
|
||||
# Upload source files at /admin/config/development/cdesai/migrate.
|
||||
plugin: 'cdesai_migrate_csv'
|
||||
source_config_key: cdesai_migrate_profile_pages_source
|
||||
|
||||
delimiter: ','
|
||||
enclosure: '"'
|
||||
header_offset: 0
|
||||
|
||||
constants:
|
||||
DRUPAL_FILE_DIRECTORY: 'public://images/profile/'
|
||||
|
||||
ids:
|
||||
- page
|
||||
|
||||
process:
|
||||
uid:
|
||||
plugin: default_value
|
||||
default_value: 1
|
||||
|
||||
pseudo_destination_filename:
|
||||
# Skips a row if has_images property is set to FALSE.
|
||||
-
|
||||
plugin: skip_on_value
|
||||
equals: true
|
||||
source: has_images
|
||||
value: 'FALSE'
|
||||
method: row
|
||||
-
|
||||
plugin: skip_on_empty
|
||||
method: row
|
||||
message: 'Cannot import image file with an empty url.'
|
||||
-
|
||||
plugin: callback
|
||||
callable: basename
|
||||
source: image_url
|
||||
pseudo_destination_path:
|
||||
-
|
||||
plugin: concat
|
||||
source:
|
||||
- constants/DRUPAL_FILE_DIRECTORY
|
||||
- '@pseudo_destination_filename'
|
||||
uri:
|
||||
-
|
||||
plugin: skip_on_empty
|
||||
method: process
|
||||
source: image_url
|
||||
-
|
||||
plugin: file_copy
|
||||
source:
|
||||
- image_url
|
||||
- '@pseudo_destination_path'
|
||||
file_exists: rename
|
||||
move: false
|
||||
|
||||
destination:
|
||||
plugin: 'entity:file'
|
||||
|
||||
|
||||
# make sure these migration execute before running current migration
|
||||
migration_dependencies: null
|
||||
|
||||
# use forced module dependency so uninstall/reinstall works properly
|
||||
dependencies:
|
||||
enforced:
|
||||
module:
|
||||
- cdesai_migrate
|
||||
Reference in New Issue
Block a user