Skip to content
Snippets Groups Projects
Commit b395fce5 authored by Fran Garcia-Linares's avatar Fran Garcia-Linares
Browse files

Issue #3455915: Try local file first, otherwise remote.

parent 4cb1ce34
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,9 @@ function drupalorg_migrate_migration_plugins_alter(array &$migrations) {
if (!empty($paths['source'])) {
$migrations[$id]['source']['constants']['source_base_path'] = $paths['source'];
}
if (!empty($paths['remote'])) {
$migrations[$id]['remote']['constants']['remote_base_path'] = $paths['remote'];
}
}
}
}
......
......@@ -15,7 +15,8 @@ source:
constants:
# Path changed via hook_migration_plugins_alter
# and set via $config['drupalorg_migrate']['project_files']['source']
source_base_path: 'https://www.drupal.org'
source_base_path: '/var/www/html/web/files/d7-files'
remote_base_path: 'https://www.drupal.org'
destination:
plugin: entity:file
......@@ -25,15 +26,38 @@ process:
# the fid field to allow incremental migrations.
# fid: fid
filename: filename
source_full_path:
local_temp_path:
plugin: concat
delimiter: /
source:
- constants/source_base_path
- filepath
local_full_path:
-
plugin: callback
callable: file_exists
source: '@local_temp_path'
-
plugin: skip_on_empty
method: process
-
plugin: get
source: '@local_temp_path'
remote_full_path:
-
plugin: concat
delimiter: /
source:
- constants/source_base_path
- constants/remote_base_path
- filepath
-
plugin: urlencode
source_full_path:
-
plugin: null_coalesce
source:
- '@local_full_path'
- '@remote_full_path'
uri:
plugin: file_copy
source:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment