From 937d6f775d8a13a42f790f08d9248aea101c41c6 Mon Sep 17 00:00:00 2001 From: David Valdez Date: Wed, 31 Jul 2019 12:03:15 -0500 Subject: [PATCH] Url aliases migration part1. Right now it straight migrate the aliases but the idea is that instead of migrate the aliases migrate them as redirects only if the new site url does not match with the old one. --- .../migrations/upgrade_d7_url_alias.yml | 64 +++++++++++++++++++ .../Plugin/migrate/process/SkipOnMatch.php | 40 ++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 web/modules/custom/geo_upgrade/migrations/upgrade_d7_url_alias.yml create mode 100644 web/modules/custom/geo_upgrade/src/Plugin/migrate/process/SkipOnMatch.php diff --git a/web/modules/custom/geo_upgrade/migrations/upgrade_d7_url_alias.yml b/web/modules/custom/geo_upgrade/migrations/upgrade_d7_url_alias.yml new file mode 100644 index 0000000..79ed93b --- /dev/null +++ b/web/modules/custom/geo_upgrade/migrations/upgrade_d7_url_alias.yml @@ -0,0 +1,64 @@ +langcode: en +status: true +dependencies: { } +id: upgrade_d7_url_alias +class: Drupal\migrate\Plugin\Migration +field_plugin_method: null +cck_plugin_method: null +migration_tags: + - 'Drupal 7' + - Content +migration_group: migrate_drupal_7_geo +label: 'URL aliases' +source: + plugin: d7_url_alias + constants: + slash: / +process: + source: + - + plugin: concat + source: + - constants/slash + - source + alias: + - + plugin: skip_on_match + source: alias + method: row + # Content that wasn't migrated so the alias won't be migrate either. + value: + - 'event/' # Content type Event + - 'issue/' # Taxonomy vocabulary Issue + - 'regular-contributors/' # Regular contributors + - 'geo-volume-2/' + - 'geo-volume-3/' + - 'geo-volume-1/' + - 'ad-groups' + - + plugin: concat + source: + - constants/slash + - alias + langcode: + - + plugin: get + source: language +# node_translation: +# - +# plugin: explode +# source: source +# delimiter: / +# - +# plugin: extract +# default: INVALID_NID +# index: +# - 1 +# - +# plugin: migration_lookup +# migration: { } +destination: + plugin: url_alias +migration_dependencies: + required: { } + optional: { } diff --git a/web/modules/custom/geo_upgrade/src/Plugin/migrate/process/SkipOnMatch.php b/web/modules/custom/geo_upgrade/src/Plugin/migrate/process/SkipOnMatch.php new file mode 100644 index 0000000..5726627 --- /dev/null +++ b/web/modules/custom/geo_upgrade/src/Plugin/migrate/process/SkipOnMatch.php @@ -0,0 +1,40 @@ +