diff --git a/drupalorg_migrate.module b/drupalorg_migrate.module index af933ab9b7be444ec3af7349e4ee0ebd9a6a91b1..b09c46f042ff7c1258384e4727f93ee1b65836e1 100644 --- a/drupalorg_migrate.module +++ b/drupalorg_migrate.module @@ -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']; + } } } } diff --git a/migrations/drupalorg_migrate_project_files.yml b/migrations/drupalorg_migrate_project_files.yml index 648589535e13fb66ddc084df5ce43f4bb951de7c..2c37211b3564f3768c1b0773a9fa99cbba533bec 100644 --- a/migrations/drupalorg_migrate_project_files.yml +++ b/migrations/drupalorg_migrate_project_files.yml @@ -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: