From f9db6433cd6e71400a830c25449370903cf54d22 Mon Sep 17 00:00:00 2001 From: David Valdez Date: Tue, 28 Aug 2018 17:15:47 -0500 Subject: [PATCH 1/9] Files migration --- .../agaric_migration/migrations/agaric.yml | 2 +- .../migrations/agaric_files.yml | 45 +++++++++++++++++++ .../{agaric_pages.yml => agaric_page.yml} | 0 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 web/modules/custom/agaric_migration/migrations/agaric_files.yml rename web/modules/custom/agaric_migration/migrations/{agaric_pages.yml => agaric_page.yml} (100%) diff --git a/web/modules/custom/agaric_migration/migrations/agaric.yml b/web/modules/custom/agaric_migration/migrations/agaric.yml index e862892..a57bf8e 100644 --- a/web/modules/custom/agaric_migration/migrations/agaric.yml +++ b/web/modules/custom/agaric_migration/migrations/agaric.yml @@ -8,4 +8,4 @@ shared_configuration: dependencies: enforced: module: - - agaric_migration + - agaric_migration diff --git a/web/modules/custom/agaric_migration/migrations/agaric_files.yml b/web/modules/custom/agaric_migration/migrations/agaric_files.yml new file mode 100644 index 0000000..40bfeb0 --- /dev/null +++ b/web/modules/custom/agaric_migration/migrations/agaric_files.yml @@ -0,0 +1,45 @@ +id: agaric_file +migration_group: agaric +label: Public files +source: + plugin: d7_file + scheme: public +process: + filename: filename + source_full_path: + - + plugin: concat + delimiter: / + source: + - filepath + - + plugin: str_replace + search: 'sites/default/files/' + # The old files must be located at this path: + replace: 'sites/default/import/' + - + plugin: urlencode + uri: + plugin: file_copy + source: + - '@source_full_path' + - uri + filemime: filemime + status: status + created: timestamp + changed: timestamp + uid: + - + plugin: migration_lookup + migration: agaric_user + source: uid + no_stub: true + - + # If the user id does not exists then migrate it as anonymous. + plugin: default_value + default_value: 0 +destination: + plugin: entity:file +migration_dependencies: + required: + - nichq_community_user diff --git a/web/modules/custom/agaric_migration/migrations/agaric_pages.yml b/web/modules/custom/agaric_migration/migrations/agaric_page.yml similarity index 100% rename from web/modules/custom/agaric_migration/migrations/agaric_pages.yml rename to web/modules/custom/agaric_migration/migrations/agaric_page.yml From 14e829fd66f9ca6bfbd540da706c60f4d81b37d8 Mon Sep 17 00:00:00 2001 From: David Valdez Date: Tue, 28 Aug 2018 18:20:36 -0500 Subject: [PATCH 2/9] Add the bio and the gpg field in the users. Also, the user migration was updated to migrate the data of these fields. --- ....entity_form_display.user.user.default.yml | 28 ++++++++++++ ....entity_view_display.user.user.default.yml | 19 ++++++++ .../sync/field.field.user.user.field_bio.yml | 22 ++++++++++ ...d.field.user.user.field_gpg_public_key.yml | 27 ++++++++++++ config/sync/field.storage.user.field_bio.yml | 19 ++++++++ ...ield.storage.user.field_gpg_public_key.yml | 23 ++++++++++ .../migrations/agaric_files.yml | 44 +++++++++---------- .../migrations/agaric_page.yml | 22 +++++----- .../migrations/agaric_user.yml | 27 ++++++++++++ 9 files changed, 198 insertions(+), 33 deletions(-) create mode 100644 config/sync/field.field.user.user.field_bio.yml create mode 100644 config/sync/field.field.user.user.field_gpg_public_key.yml create mode 100644 config/sync/field.storage.user.field_bio.yml create mode 100644 config/sync/field.storage.user.field_gpg_public_key.yml diff --git a/config/sync/core.entity_form_display.user.user.default.yml b/config/sync/core.entity_form_display.user.user.default.yml index e5b9a19..7bc2774 100644 --- a/config/sync/core.entity_form_display.user.user.default.yml +++ b/config/sync/core.entity_form_display.user.user.default.yml @@ -3,11 +3,15 @@ langcode: en status: true dependencies: config: + - field.field.user.user.field_bio + - field.field.user.user.field_gpg_public_key - field.field.user.user.user_picture - image.style.thumbnail module: + - file - image - path + - text - user _core: default_config_hash: cAoTuTfmGrGB_89qPV_cTRlA7NXOWtLCLePKVX4SO3A @@ -19,12 +23,34 @@ content: account: weight: -10 region: content + settings: { } + third_party_settings: { } contact: weight: 5 region: content + settings: { } + third_party_settings: { } + field_bio: + weight: 32 + settings: + rows: 9 + summary_rows: 3 + placeholder: '' + third_party_settings: { } + type: text_textarea_with_summary + region: content + field_gpg_public_key: + weight: 31 + settings: + progress_indicator: throbber + third_party_settings: { } + type: file_generic + region: content language: weight: 0 region: content + settings: { } + third_party_settings: { } path: type: path weight: 30 @@ -34,6 +60,8 @@ content: timezone: weight: 6 region: content + settings: { } + third_party_settings: { } user_picture: type: image_image settings: diff --git a/config/sync/core.entity_view_display.user.user.default.yml b/config/sync/core.entity_view_display.user.user.default.yml index fe992f9..b6673e5 100644 --- a/config/sync/core.entity_view_display.user.user.default.yml +++ b/config/sync/core.entity_view_display.user.user.default.yml @@ -3,10 +3,14 @@ langcode: en status: true dependencies: config: + - field.field.user.user.field_bio + - field.field.user.user.field_gpg_public_key - field.field.user.user.user_picture - image.style.thumbnail module: + - file - image + - text - user _core: default_config_hash: '-spcniWjm5Ez6YM3ccxk3ocvsn52jkdaGEgp0xzPYU8' @@ -15,6 +19,21 @@ targetEntityType: user bundle: user mode: default content: + field_bio: + weight: 2 + label: above + settings: { } + third_party_settings: { } + type: text_default + region: content + field_gpg_public_key: + weight: 1 + label: above + settings: + use_description_as_link_text: true + third_party_settings: { } + type: file_default + region: content user_picture: type: image weight: 0 diff --git a/config/sync/field.field.user.user.field_bio.yml b/config/sync/field.field.user.user.field_bio.yml new file mode 100644 index 0000000..6729913 --- /dev/null +++ b/config/sync/field.field.user.user.field_bio.yml @@ -0,0 +1,22 @@ +uuid: dc19403f-a0a1-47e9-9a98-292f5cc2683f +langcode: en +status: true +dependencies: + config: + - field.storage.user.field_bio + module: + - text + - user +id: user.user.field_bio +field_name: field_bio +entity_type: user +bundle: user +label: Bio +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + display_summary: false +field_type: text_with_summary diff --git a/config/sync/field.field.user.user.field_gpg_public_key.yml b/config/sync/field.field.user.user.field_gpg_public_key.yml new file mode 100644 index 0000000..bdabc46 --- /dev/null +++ b/config/sync/field.field.user.user.field_gpg_public_key.yml @@ -0,0 +1,27 @@ +uuid: f3bac6b8-03b8-4b50-813d-74a0aebdb7ef +langcode: en +status: true +dependencies: + config: + - field.storage.user.field_gpg_public_key + module: + - file + - user +id: user.user.field_gpg_public_key +field_name: field_gpg_public_key +entity_type: user +bundle: user +label: 'GPG public key' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + file_directory: '' + file_extensions: asc + max_filesize: '' + description_field: false + handler: 'default:file' + handler_settings: { } +field_type: file diff --git a/config/sync/field.storage.user.field_bio.yml b/config/sync/field.storage.user.field_bio.yml new file mode 100644 index 0000000..7d3280e --- /dev/null +++ b/config/sync/field.storage.user.field_bio.yml @@ -0,0 +1,19 @@ +uuid: 86ae8bc8-2606-42f0-9cda-da3f6bf63306 +langcode: en +status: true +dependencies: + module: + - text + - user +id: user.field_bio +field_name: field_bio +entity_type: user +type: text_with_summary +settings: { } +module: text +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/config/sync/field.storage.user.field_gpg_public_key.yml b/config/sync/field.storage.user.field_gpg_public_key.yml new file mode 100644 index 0000000..8812d06 --- /dev/null +++ b/config/sync/field.storage.user.field_gpg_public_key.yml @@ -0,0 +1,23 @@ +uuid: ef210af7-b091-46d9-a882-2b15fd240ca1 +langcode: en +status: true +dependencies: + module: + - file + - user +id: user.field_gpg_public_key +field_name: field_gpg_public_key +entity_type: user +type: file +settings: + display_field: false + display_default: false + uri_scheme: public + target_type: file +module: file +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/web/modules/custom/agaric_migration/migrations/agaric_files.yml b/web/modules/custom/agaric_migration/migrations/agaric_files.yml index 40bfeb0..50ba780 100644 --- a/web/modules/custom/agaric_migration/migrations/agaric_files.yml +++ b/web/modules/custom/agaric_migration/migrations/agaric_files.yml @@ -7,18 +7,18 @@ source: process: filename: filename source_full_path: - - - plugin: concat - delimiter: / - source: - - filepath - - - plugin: str_replace - search: 'sites/default/files/' - # The old files must be located at this path: - replace: 'sites/default/import/' - - - plugin: urlencode + - + plugin: concat + delimiter: / + source: + - filepath + - + plugin: str_replace + search: 'sites/default/files/' + # The old files must be located at this path: + replace: 'sites/default/import/' + - + plugin: urlencode uri: plugin: file_copy source: @@ -29,17 +29,17 @@ process: created: timestamp changed: timestamp uid: - - - plugin: migration_lookup - migration: agaric_user - source: uid - no_stub: true - - - # If the user id does not exists then migrate it as anonymous. - plugin: default_value - default_value: 0 + - + plugin: migration_lookup + migration: agaric_user + source: uid + no_stub: true + - + # If the user id does not exists then migrate it as anonymous. + plugin: default_value + default_value: 0 destination: plugin: entity:file migration_dependencies: required: - - nichq_community_user + - agaric_user diff --git a/web/modules/custom/agaric_migration/migrations/agaric_page.yml b/web/modules/custom/agaric_migration/migrations/agaric_page.yml index 9433274..626a0cf 100644 --- a/web/modules/custom/agaric_migration/migrations/agaric_page.yml +++ b/web/modules/custom/agaric_migration/migrations/agaric_page.yml @@ -16,14 +16,14 @@ process: default_value: "und" title: title uid: - - - plugin: migration_lookup - migration: agaric_user - source: node_uid - no_stub: true - - - plugin: skip_on_empty - method: row + - + plugin: migration_lookup + migration: agaric_user + source: node_uid + no_stub: true + - + plugin: skip_on_empty + method: row paragraph_body: plugin: migration migration: agaric_page_paragraph @@ -31,7 +31,7 @@ process: field_body_paragraph: plugin: iterator source: - - '@paragraph_body' + - '@paragraph_body' process: target_id: '0' target_revision_id: '1' @@ -45,5 +45,5 @@ process: revision_timestamp: timestamp migration_dependencies: required: - - agaric_user - - agaric_page_paragraph + - agaric_user + - agaric_page_paragraph diff --git a/web/modules/custom/agaric_migration/migrations/agaric_user.yml b/web/modules/custom/agaric_migration/migrations/agaric_user.yml index afdb7cf..0adb624 100644 --- a/web/modules/custom/agaric_migration/migrations/agaric_user.yml +++ b/web/modules/custom/agaric_migration/migrations/agaric_user.yml @@ -15,6 +15,7 @@ process: status: status timezone: timezone init: init + field_bio: field_bio roles: - plugin: static_map @@ -30,3 +31,29 @@ process: plugin: role_generate entity_type: user_role value_key: id + field_gpg_public_key/target_id: + - + plugin: extract + source: field_gpg_public_key + default: '' + index: + - 0 + - fid + - + plugin: skip_on_empty + method: process + - + plugin: migration_lookup + migration: agaric_file + user_picture: + - + plugin: default_value + source: picture + default_value: null + - + plugin: migration_lookup + migration: agaric_file +migration_dependencies: + optional: + - agaric_file + From dfefedb453d0b94e2909423d5271a84bd5ab50c8 Mon Sep 17 00:00:00 2001 From: David Valdez Date: Tue, 28 Aug 2018 18:25:34 -0500 Subject: [PATCH 3/9] Remove the uuid from the new fields --- config/sync/field.field.user.user.field_bio.yml | 1 - config/sync/field.field.user.user.field_gpg_public_key.yml | 1 - config/sync/field.storage.user.field_bio.yml | 1 - config/sync/field.storage.user.field_gpg_public_key.yml | 1 - 4 files changed, 4 deletions(-) diff --git a/config/sync/field.field.user.user.field_bio.yml b/config/sync/field.field.user.user.field_bio.yml index 6729913..5e38bc2 100644 --- a/config/sync/field.field.user.user.field_bio.yml +++ b/config/sync/field.field.user.user.field_bio.yml @@ -1,4 +1,3 @@ -uuid: dc19403f-a0a1-47e9-9a98-292f5cc2683f langcode: en status: true dependencies: diff --git a/config/sync/field.field.user.user.field_gpg_public_key.yml b/config/sync/field.field.user.user.field_gpg_public_key.yml index bdabc46..6894e74 100644 --- a/config/sync/field.field.user.user.field_gpg_public_key.yml +++ b/config/sync/field.field.user.user.field_gpg_public_key.yml @@ -1,4 +1,3 @@ -uuid: f3bac6b8-03b8-4b50-813d-74a0aebdb7ef langcode: en status: true dependencies: diff --git a/config/sync/field.storage.user.field_bio.yml b/config/sync/field.storage.user.field_bio.yml index 7d3280e..72f817a 100644 --- a/config/sync/field.storage.user.field_bio.yml +++ b/config/sync/field.storage.user.field_bio.yml @@ -1,4 +1,3 @@ -uuid: 86ae8bc8-2606-42f0-9cda-da3f6bf63306 langcode: en status: true dependencies: diff --git a/config/sync/field.storage.user.field_gpg_public_key.yml b/config/sync/field.storage.user.field_gpg_public_key.yml index 8812d06..8eb4809 100644 --- a/config/sync/field.storage.user.field_gpg_public_key.yml +++ b/config/sync/field.storage.user.field_gpg_public_key.yml @@ -1,4 +1,3 @@ -uuid: ef210af7-b091-46d9-a882-2b15fd240ca1 langcode: en status: true dependencies: From 71d407fefd90e2c215c4760d2af2767e67b58780 Mon Sep 17 00:00:00 2001 From: David Valdez Date: Thu, 30 Aug 2018 12:53:40 -0500 Subject: [PATCH 4/9] Migrate the field_file and field_image in the pages. --- ....entity_form_display.node.page.default.yml | 20 ++++++++++ ....entity_view_display.node.page.default.yml | 25 +++++++++++- .../sync/field.field.node.page.field_file.yml | 27 +++++++++++++ .../field.field.node.page.field_image.yml | 38 +++++++++++++++++++ config/sync/field.storage.node.field_file.yml | 23 +++++++++++ .../sync/field.storage.node.field_image.yml | 4 +- .../migrations/agaric_page.yml | 21 ++++++++++ 7 files changed, 155 insertions(+), 3 deletions(-) create mode 100644 config/sync/field.field.node.page.field_file.yml create mode 100644 config/sync/field.field.node.page.field_image.yml create mode 100644 config/sync/field.storage.node.field_file.yml diff --git a/config/sync/core.entity_form_display.node.page.default.yml b/config/sync/core.entity_form_display.node.page.default.yml index 135c222..03be2f3 100644 --- a/config/sync/core.entity_form_display.node.page.default.yml +++ b/config/sync/core.entity_form_display.node.page.default.yml @@ -5,11 +5,16 @@ dependencies: config: - field.field.node.page.body - field.field.node.page.field_body_paragraph + - field.field.node.page.field_file + - field.field.node.page.field_image - field.field.node.page.field_meta_tags - field.field.node.page.field_storyline - field.field.node.page.field_summary + - image.style.thumbnail - node.type.page module: + - file + - image - metatag - paragraphs - path @@ -39,6 +44,21 @@ content: third_party_settings: { } type: entity_reference_paragraphs region: content + field_file: + weight: 27 + settings: + progress_indicator: throbber + third_party_settings: { } + type: file_generic + region: content + field_image: + weight: 26 + settings: + progress_indicator: throbber + preview_image_style: thumbnail + third_party_settings: { } + type: image_image + region: content field_meta_tags: weight: 6 settings: { } diff --git a/config/sync/core.entity_view_display.node.page.default.yml b/config/sync/core.entity_view_display.node.page.default.yml index c9b0549..9ad788f 100644 --- a/config/sync/core.entity_view_display.node.page.default.yml +++ b/config/sync/core.entity_view_display.node.page.default.yml @@ -5,11 +5,16 @@ dependencies: config: - field.field.node.page.body - field.field.node.page.field_body_paragraph + - field.field.node.page.field_file + - field.field.node.page.field_image - field.field.node.page.field_meta_tags + - field.field.node.page.field_storyline - field.field.node.page.field_summary - node.type.page module: - ds + - file + - image - user third_party_settings: ds: @@ -34,10 +39,28 @@ id: node.page.default targetEntityType: node bundle: page mode: default -content: { } +content: + field_file: + weight: 2 + label: above + settings: + use_description_as_link_text: true + third_party_settings: { } + type: file_default + region: content + field_image: + weight: 1 + label: above + settings: + image_style: '' + image_link: '' + third_party_settings: { } + type: image + region: content hidden: body: true field_body_paragraph: true field_meta_tags: true + field_storyline: true field_summary: true links: true diff --git a/config/sync/field.field.node.page.field_file.yml b/config/sync/field.field.node.page.field_file.yml new file mode 100644 index 0000000..f1c58e3 --- /dev/null +++ b/config/sync/field.field.node.page.field_file.yml @@ -0,0 +1,27 @@ +uuid: f2978e92-efe9-45a5-b412-5e3e5ac98681 +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_file + - node.type.page + module: + - file +id: node.page.field_file +field_name: field_file +entity_type: node +bundle: page +label: file +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + file_directory: '[date:custom:Y]-[date:custom:m]' + file_extensions: 'txt pdf svg rtf odt odp ppt' + max_filesize: '' + description_field: false + handler: 'default:file' + handler_settings: { } +field_type: file diff --git a/config/sync/field.field.node.page.field_image.yml b/config/sync/field.field.node.page.field_image.yml new file mode 100644 index 0000000..8d66b2c --- /dev/null +++ b/config/sync/field.field.node.page.field_image.yml @@ -0,0 +1,38 @@ +uuid: 16782cd7-a9f3-4cf1-8e5b-eba74b6f239c +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_image + - node.type.page + module: + - image +id: node.page.field_image +field_name: field_image +entity_type: node +bundle: page +label: Image +description: '' +required: false +translatable: true +default_value: { } +default_value_callback: '' +settings: + file_directory: '[date:custom:Y]-[date:custom:m]' + file_extensions: 'png gif jpg jpeg' + max_filesize: '' + max_resolution: '' + min_resolution: '' + alt_field: true + alt_field_required: true + title_field: false + title_field_required: false + default_image: + uuid: '' + alt: '' + title: '' + width: null + height: null + handler: 'default:file' + handler_settings: { } +field_type: image diff --git a/config/sync/field.storage.node.field_file.yml b/config/sync/field.storage.node.field_file.yml new file mode 100644 index 0000000..719e8c4 --- /dev/null +++ b/config/sync/field.storage.node.field_file.yml @@ -0,0 +1,23 @@ +uuid: 84ea971d-b192-4165-8178-ebf05f57662b +langcode: en +status: true +dependencies: + module: + - file + - node +id: node.field_file +field_name: field_file +entity_type: node +type: file +settings: + display_field: true + display_default: false + uri_scheme: public + target_type: file +module: file +locked: false +cardinality: -1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/config/sync/field.storage.node.field_image.yml b/config/sync/field.storage.node.field_image.yml index 8d8dfd4..5b87be8 100644 --- a/config/sync/field.storage.node.field_image.yml +++ b/config/sync/field.storage.node.field_image.yml @@ -15,7 +15,7 @@ type: image settings: uri_scheme: public default_image: - uuid: null + uuid: '' alt: '' title: '' width: null @@ -25,7 +25,7 @@ settings: display_default: false module: image locked: false -cardinality: 1 +cardinality: -1 translatable: true indexes: target_id: diff --git a/web/modules/custom/agaric_migration/migrations/agaric_page.yml b/web/modules/custom/agaric_migration/migrations/agaric_page.yml index 626a0cf..714644a 100644 --- a/web/modules/custom/agaric_migration/migrations/agaric_page.yml +++ b/web/modules/custom/agaric_migration/migrations/agaric_page.yml @@ -35,6 +35,27 @@ process: process: target_id: '0' target_revision_id: '1' + field_image: + - + plugin: iterator + source: field_image + process: + target_id: + plugin: migration_lookup + migration: agaric_file + source: fid + alt: alt + title: title + height: height + width: width + field_file: + - + plugin: iterator + source: field_file + process: + target_id: + plugin: migration_lookup + source: fid status: status created: created changed: changed From 2948dacdb4055831f6fd969ea5636270827027e4 Mon Sep 17 00:00:00 2001 From: David Valdez Date: Thu, 30 Aug 2018 14:36:52 -0500 Subject: [PATCH 5/9] The blog migration --- .../migrations/agaric_blog.yml | 62 +++++++++++++++++++ .../migrations/agaric_blog_paragraph.yml | 30 +++++++++ 2 files changed, 92 insertions(+) create mode 100644 web/modules/custom/agaric_migration/migrations/agaric_blog.yml create mode 100644 web/modules/custom/agaric_migration/migrations/agaric_blog_paragraph.yml diff --git a/web/modules/custom/agaric_migration/migrations/agaric_blog.yml b/web/modules/custom/agaric_migration/migrations/agaric_blog.yml new file mode 100644 index 0000000..c47d2c3 --- /dev/null +++ b/web/modules/custom/agaric_migration/migrations/agaric_blog.yml @@ -0,0 +1,62 @@ +id: agaric_blog +migration_group: agaric +label: Agaric Blog +source: + plugin: d7_node + node_type: blog +destination: + plugin: entity:node +process: + type: + plugin: default_value + default_value: blog + langcode: + plugin: default_value + source: language + default_value: "und" + title: title + uid: + - + plugin: migration_lookup + migration: agaric_user + source: node_uid + no_stub: true + - + plugin: skip_on_empty + method: row + paragraph_body: + plugin: migration + migration: agaric_blog_paragraph + source: nid + field_body_paragraph: + plugin: iterator + source: + - '@paragraph_body' + process: + target_id: '0' + target_revision_id: '1' + field_image: + - + plugin: iterator + source: field_image + process: + target_id: + plugin: migration_lookup + migration: agaric_file + source: fid + alt: alt + title: title + height: height + width: width + status: status + created: created + changed: changed + promote: promote + sticky: sticky + revision_uid: revision_uid + revision_log: log + revision_timestamp: timestamp +migration_dependencies: + required: + - agaric_user + - agaric_blog_paragraph diff --git a/web/modules/custom/agaric_migration/migrations/agaric_blog_paragraph.yml b/web/modules/custom/agaric_migration/migrations/agaric_blog_paragraph.yml new file mode 100644 index 0000000..953270b --- /dev/null +++ b/web/modules/custom/agaric_migration/migrations/agaric_blog_paragraph.yml @@ -0,0 +1,30 @@ +id: agaric_blog_paragraph +migration_group: agaric +label: Blog Body paragraph +source: + plugin: d7_node + node_type: blog +process: + uid: + - + plugin: migration_lookup + migration: agaric_user + source: node_uid + no_stub: true + - + plugin: skip_on_empty + method: row + status: status + created: created + parent_type: "node" + field_text: body +destination: + plugin: 'entity_reference_revisions:paragraph' + default_bundle: text +dependencies: + enforced: + module: + - paragraphs +migration_dependencies: + required: + - agaric_user From 55e5f22249eb68365692f2f6a888fa6e88bafead Mon Sep 17 00:00:00 2001 From: David Valdez Date: Wed, 5 Sep 2018 00:49:06 -0500 Subject: [PATCH 6/9] Comments migration`: --- .../migrations/agaric_comment.yml | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 web/modules/custom/agaric_migration/migrations/agaric_comment.yml diff --git a/web/modules/custom/agaric_migration/migrations/agaric_comment.yml b/web/modules/custom/agaric_migration/migrations/agaric_comment.yml new file mode 100644 index 0000000..67d060c --- /dev/null +++ b/web/modules/custom/agaric_migration/migrations/agaric_comment.yml @@ -0,0 +1,81 @@ +id: agaric_comment +migration_group: agaric +label: Agaric Comments +source: + plugin: d7_comment + constants: + entity_type: node + comment_type: comment +process: + pid: + - + plugin: migration_lookup + migration: agaric_comment + source: pid + no_stub: true + - + plugin: skip_on_empty + method: row + entity_id: + - + plugin: migration_lookup + migration: + - agaric_page + - agaric_blog + source_ids: + agaric_page: + - nid + agaric_blog: + - nid + no_stub: true + - + plugin: skip_on_empty + method: row + entity_type: 'constants/entity_type' + comment_type: 'constants/comment_type' + field_name: '@comment_type' + subject: subject + uid: + - + plugin: migration_lookup + migration: agaric_user + source: uid + no_stub: true + - + plugin: default_value + default_value: "0" + struct: true + name: name + mail: mail + homepage: homepage + hostname: hostname + created: created + changed: changed + status: status + thread: thread + comment_body/format: + - + plugin: extract + source: comment_body + index: + - 0 + - format + - + plugin: static_map + map: + filtered_html: 'basic_html' + bypass: TRUE + comment_body/value: + - + plugin: extract + source: comment_body + index: + - 0 + - value +destination: + plugin: entity:comment + default_bundle: comment +migration_dependencies: + required: + - agaric_blog + - agaric_page From e730f92584b06276c9039472e3e193f5e44be638 Mon Sep 17 00:00:00 2001 From: David Valdez Date: Wed, 5 Sep 2018 14:44:47 -0500 Subject: [PATCH 7/9] Import the last 4 missing comments --- .../custom/agaric_migration/migrations/agaric_comment.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/web/modules/custom/agaric_migration/migrations/agaric_comment.yml b/web/modules/custom/agaric_migration/migrations/agaric_comment.yml index 67d060c..1c37f97 100644 --- a/web/modules/custom/agaric_migration/migrations/agaric_comment.yml +++ b/web/modules/custom/agaric_migration/migrations/agaric_comment.yml @@ -14,8 +14,8 @@ process: source: pid no_stub: true - - plugin: skip_on_empty - method: row + plugin: default_value + method: 0 entity_id: - plugin: migration_lookup @@ -43,8 +43,7 @@ process: no_stub: true - plugin: default_value - default_value: "0" - struct: true + default_value: 0 name: name mail: mail homepage: homepage From 54c3ac9b469a3abb242d03172ac84e7801ca0776 Mon Sep 17 00:00:00 2001 From: David Valdez Date: Wed, 5 Sep 2018 21:18:29 -0500 Subject: [PATCH 8/9] Fix a bug in the MigrationLookup migration. The migrations with ID were being skipped by the MigrationLookup plugin. More info here: https://www.drupal.org/project/drupal/issues/2751825 --- .../migrations/agaric_comment.yml | 4 +- .../process/MigrationLookupWithZero.php | 44 +++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 web/modules/custom/agaric_migration/src/Plugin/migrate/process/MigrationLookupWithZero.php diff --git a/web/modules/custom/agaric_migration/migrations/agaric_comment.yml b/web/modules/custom/agaric_migration/migrations/agaric_comment.yml index 1c37f97..98f6fb6 100644 --- a/web/modules/custom/agaric_migration/migrations/agaric_comment.yml +++ b/web/modules/custom/agaric_migration/migrations/agaric_comment.yml @@ -9,7 +9,7 @@ source: process: pid: - - plugin: migration_lookup + plugin: migration_lookup_with_zero migration: agaric_comment source: pid no_stub: true @@ -37,7 +37,7 @@ process: subject: subject uid: - - plugin: migration_lookup + plugin: migration_lookup_with_zero migration: agaric_user source: uid no_stub: true diff --git a/web/modules/custom/agaric_migration/src/Plugin/migrate/process/MigrationLookupWithZero.php b/web/modules/custom/agaric_migration/src/Plugin/migrate/process/MigrationLookupWithZero.php new file mode 100644 index 0000000..875380a --- /dev/null +++ b/web/modules/custom/agaric_migration/src/Plugin/migrate/process/MigrationLookupWithZero.php @@ -0,0 +1,44 @@ + Date: Wed, 5 Sep 2018 21:25:46 -0500 Subject: [PATCH 9/9] Flatten all threads in the comments --- .../agaric_migration/migrations/agaric_comment.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/web/modules/custom/agaric_migration/migrations/agaric_comment.yml b/web/modules/custom/agaric_migration/migrations/agaric_comment.yml index 98f6fb6..5a08bfb 100644 --- a/web/modules/custom/agaric_migration/migrations/agaric_comment.yml +++ b/web/modules/custom/agaric_migration/migrations/agaric_comment.yml @@ -6,16 +6,10 @@ source: constants: entity_type: node comment_type: comment + default_pid: 0 process: - pid: - - - plugin: migration_lookup_with_zero - migration: agaric_comment - source: pid - no_stub: true - - - plugin: default_value - method: 0 + # All the threads are going to be flatten. + pid: 'constants/default_pid' entity_id: - plugin: migration_lookup