From 2336e172a34973a6710b5d2124117f5298798053 Mon Sep 17 00:00:00 2001 From: Michael Stenta Date: Tue, 22 Aug 2023 11:08:35 -0400 Subject: [PATCH] Issue #3382616: Remove v1 migrations from farmOS 3.x --- CHANGELOG.md | 4 + docs/hosting/migration.md | 8 +- mkdocs.yml | 2 +- modules/core/migrate/composer.json | 9 - ...gration.farm_migrate_area_field_parent.yml | 46 -- ...ration.farm_migrate_asset_field_parent.yml | 44 -- ...grate_plus.migration.farm_migrate_file.yml | 64 --- ...us.migration.farm_migrate_file_private.yml | 64 --- ...migration.farm_migrate_quantity_system.yml | 28 - ...lus.migration.farm_migrate_system_date.yml | 38 -- ...grate_plus.migration.farm_migrate_user.yml | 71 --- ...plus.migration_group.farm_migrate_area.yml | 83 --- ...lus.migration_group.farm_migrate_asset.yml | 106 ---- ...ration_group.farm_migrate_asset_parent.yml | 12 - ...us.migration_group.farm_migrate_config.yml | 12 - ...plus.migration_group.farm_migrate_file.yml | 12 - ..._plus.migration_group.farm_migrate_log.yml | 182 ------ ...plus.migration_group.farm_migrate_plan.yml | 88 --- ....migration_group.farm_migrate_quantity.yml | 12 - ...plus.migration_group.farm_migrate_role.yml | 32 -- ...gration_group.farm_migrate_sensor_data.yml | 12 - ....migration_group.farm_migrate_taxonomy.yml | 37 -- ...plus.migration_group.farm_migrate_user.yml | 12 - ..._plus.migration.farm_migrate_area_land.yml | 39 -- ..._plus.migration.farm_migrate_area_none.yml | 32 -- ....migration.farm_migrate_area_structure.yml | 35 -- ...plus.migration.farm_migrate_area_water.yml | 30 - ...us.migration.farm_migrate_asset_animal.yml | 81 --- ...s.migration.farm_migrate_asset_compost.yml | 33 -- ...migration.farm_migrate_asset_equipment.yml | 43 -- ...lus.migration.farm_migrate_asset_group.yml | 33 -- ...lus.migration.farm_migrate_asset_plant.yml | 52 -- ...us.migration.farm_migrate_asset_sensor.yml | 33 -- ...ion.farm_migrate_asset_sensor_listener.yml | 48 -- ..._plus.migration.farm_migrate_inventory.yml | 61 -- ...us.migration.farm_migrate_log_activity.yml | 37 -- ..._plus.migration.farm_migrate_log_birth.yml | 46 -- ...lus.migration.farm_migrate_log_harvest.yml | 41 -- ..._plus.migration.farm_migrate_log_input.yml | 74 --- ...us.migration.farm_migrate_log_lab_test.yml | 71 --- ...migration.farm_migrate_log_maintenance.yml | 37 -- ...lus.migration.farm_migrate_log_medical.yml | 41 -- ...migration.farm_migrate_log_observation.yml | 37 -- ...lus.migration.farm_migrate_log_seeding.yml | 44 -- ...gration.farm_migrate_log_transplanting.yml | 37 -- ...gration.farm_migrate_quantity_standard.yml | 47 -- ...grate_plus.migration.farm_migrate_role.yml | 32 -- ...m_migrate_sensor_listener_data_streams.yml | 43 -- ..._migrate_sensor_listener_notifications.yml | 129 ----- ...tion.farm_migrate_taxonomy_animal_type.yml | 46 -- ...tion.farm_migrate_taxonomy_crop_family.yml | 46 -- ...ion.farm_migrate_taxonomy_log_category.yml | 46 -- ...on.farm_migrate_taxonomy_material_type.yml | 46 -- ...ation.farm_migrate_taxonomy_plant_type.yml | 85 --- ...migration.farm_migrate_taxonomy_season.yml | 46 -- ...s.migration.farm_migrate_taxonomy_unit.yml | 46 -- modules/core/migrate/drush.services.yml | 6 - modules/core/migrate/farm_migrate.info.yml | 4 - modules/core/migrate/farm_migrate.module | 22 - .../core/migrate/farm_migrate.post_update.php | 312 ++-------- .../core/migrate/farm_migrate.services.yml | 7 - .../src/Commands/FarmMigrateCommands.php | 98 ---- .../FarmMigrationSubscriber.php | 543 ------------------ .../migrate/process/FarmMigrateGetLab.php | 42 -- .../process/FarmMigrationGroupLookup.php | 115 ---- .../Plugin/migrate/process/SkipMapOnEmpty.php | 40 -- .../Plugin/migrate/source/d7/AnimalAsset.php | 71 --- .../src/Plugin/migrate/source/d7/FarmArea.php | 52 -- .../Plugin/migrate/source/d7/FarmAsset.php | 44 -- .../src/Plugin/migrate/source/d7/FarmLog.php | 330 ----------- .../Plugin/migrate/source/d7/Inventory.php | 81 --- .../src/Plugin/migrate/source/d7/Quantity.php | 91 --- .../Plugin/migrate/source/d7/SensorAsset.php | 77 --- .../source/d7/SensorListenerDataNames.php | 56 -- .../migrate/src/Traits/FarmQuickEntity.php | 77 --- 75 files changed, 73 insertions(+), 4570 deletions(-) delete mode 100644 modules/core/migrate/composer.json delete mode 100644 modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_area_field_parent.yml delete mode 100644 modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_asset_field_parent.yml delete mode 100644 modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_file.yml delete mode 100644 modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_file_private.yml delete mode 100644 modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_quantity_system.yml delete mode 100644 modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_system_date.yml delete mode 100644 modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_user.yml delete mode 100644 modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_area.yml delete mode 100644 modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_asset.yml delete mode 100644 modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_asset_parent.yml delete mode 100644 modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_config.yml delete mode 100644 modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_file.yml delete mode 100644 modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_log.yml delete mode 100644 modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_plan.yml delete mode 100644 modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_quantity.yml delete mode 100644 modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_role.yml delete mode 100644 modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_sensor_data.yml delete mode 100644 modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_taxonomy.yml delete mode 100644 modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_user.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_area_land.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_area_none.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_area_structure.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_area_water.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_animal.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_compost.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_equipment.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_group.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_plant.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_sensor.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_sensor_listener.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_inventory.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_activity.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_birth.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_harvest.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_input.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_lab_test.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_maintenance.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_medical.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_observation.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_seeding.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_transplanting.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_quantity_standard.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_role.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_sensor_listener_data_streams.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_sensor_listener_notifications.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_animal_type.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_crop_family.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_log_category.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_material_type.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_plant_type.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_season.yml delete mode 100644 modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_unit.yml delete mode 100644 modules/core/migrate/drush.services.yml delete mode 100644 modules/core/migrate/farm_migrate.module delete mode 100644 modules/core/migrate/farm_migrate.services.yml delete mode 100644 modules/core/migrate/src/Commands/FarmMigrateCommands.php delete mode 100644 modules/core/migrate/src/EventSubscriber/FarmMigrationSubscriber.php delete mode 100644 modules/core/migrate/src/Plugin/migrate/process/FarmMigrateGetLab.php delete mode 100644 modules/core/migrate/src/Plugin/migrate/process/FarmMigrationGroupLookup.php delete mode 100644 modules/core/migrate/src/Plugin/migrate/process/SkipMapOnEmpty.php delete mode 100644 modules/core/migrate/src/Plugin/migrate/source/d7/AnimalAsset.php delete mode 100644 modules/core/migrate/src/Plugin/migrate/source/d7/FarmArea.php delete mode 100644 modules/core/migrate/src/Plugin/migrate/source/d7/FarmAsset.php delete mode 100644 modules/core/migrate/src/Plugin/migrate/source/d7/FarmLog.php delete mode 100644 modules/core/migrate/src/Plugin/migrate/source/d7/Inventory.php delete mode 100644 modules/core/migrate/src/Plugin/migrate/source/d7/Quantity.php delete mode 100644 modules/core/migrate/src/Plugin/migrate/source/d7/SensorAsset.php delete mode 100644 modules/core/migrate/src/Plugin/migrate/source/d7/SensorListenerDataNames.php delete mode 100644 modules/core/migrate/src/Traits/FarmQuickEntity.php diff --git a/CHANGELOG.md b/CHANGELOG.md index afdeb2f8a..4f40a56c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- [Issue #3382616: Remove v1 migrations from farmOS 3.x](https://www.drupal.org/project/farm/issues/3382616) + ## [2.2.2] 2023-10-25 ### Changed diff --git a/docs/hosting/migration.md b/docs/hosting/migration.md index 64dd604bf..9a4839716 100644 --- a/docs/hosting/migration.md +++ b/docs/hosting/migration.md @@ -1,6 +1,10 @@ -# Migrating from farmOS 1.x to 2.x +# Migrating from farmOS v1 -The upgrade path from farmOS 1.x to 2.x is performed via a database migration. +**Note: Migrating directly from farmOS v1 to v3+ is not supported. Migrate from +v1 to v2 first, then *update* to future versions using the normal +[update process](update).** + +The upgrade path from farmOS v1 to v2 is performed via a database migration. farmOS 2.x includes a **farmOS Migrate** module that leverage's Drupal core's [Migrate API](https://drupal.org/docs/drupal-apis/migrate-api) to provide migrations for each asset type, log type, etc. These migrations are defined in diff --git a/mkdocs.yml b/mkdocs.yml index 2d72548f0..b8d1cb7c9 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -64,7 +64,7 @@ nav: - Composer: hosting/composer.md - Email: hosting/email.md - Translations: hosting/localization.md - - 1.x Migration: hosting/migration.md + - v1 Migration: hosting/migration.md theme: name: material palette: diff --git a/modules/core/migrate/composer.json b/modules/core/migrate/composer.json deleted file mode 100644 index 0564acba9..000000000 --- a/modules/core/migrate/composer.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extra": { - "drush": { - "services": { - "drush.services.yml": "^10" - } - } - } -} diff --git a/modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_area_field_parent.yml b/modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_area_field_parent.yml deleted file mode 100644 index 4eb98fc12..000000000 --- a/modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_area_field_parent.yml +++ /dev/null @@ -1,46 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - asset - - farm_migrate -id: farm_migrate_area_field_parent -label: 'Area parent references' -migration_group: farm_migrate_asset_parent -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_farm_area - area_type: any -destination: - plugin: 'entity:asset' -process: - # Look up assets created by type-specific migrations. - id: - - - plugin: farm_migration_group_lookup - migration_group: farm_migrate_area - source: tid - no_stub: true - # If no asset was found in previous migrations, skip the row. - - - plugin: skip_on_empty - method: row - parent: - - - plugin: skip_on_empty - method: process - source: parent - - - plugin: farm_migration_group_lookup - migration_group: farm_migrate_area - source: parent - no_stub: true -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_asset_field_parent.yml b/modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_asset_field_parent.yml deleted file mode 100644 index a26143ae1..000000000 --- a/modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_asset_field_parent.yml +++ /dev/null @@ -1,44 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - asset - - farm_migrate -id: farm_migrate_asset_field_parent -label: 'Asset parent references' -migration_group: farm_migrate_asset_parent -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_asset -destination: - plugin: 'entity:asset' -process: - # Look up assets created by type-specific migrations. - id: - - - plugin: farm_migration_group_lookup - migration_group: farm_migrate_asset - source: id - no_stub: true - # If no asset was found in previous migrations, skip the row. - - - plugin: skip_on_empty - method: row - parent: - plugin: sub_process - source: field_farm_parent - process: - target_id: - plugin: farm_migration_group_lookup - migration_group: farm_migrate_asset - source: target_id - no_stub: true -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_file.yml b/modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_file.yml deleted file mode 100644 index bba25d9d6..000000000 --- a/modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_file.yml +++ /dev/null @@ -1,64 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate -id: farm_migrate_file -label: 'Public files' -migration_group: farm_migrate_file -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_file - scheme: public - constants: - source_base_path: '/' -destination: - plugin: 'entity:file' -process: - fid: - plugin: get - source: fid - filename: - plugin: get - source: filename - source_full_path: - plugin: str_replace - source: uri - search: 'public://' - replace: 'public://migrate/' - uri: - plugin: file_copy - source: - - '@source_full_path' - - uri - filemime: - plugin: get - source: filemime - status: - plugin: get - source: status - created: - plugin: get - source: timestamp - changed: - plugin: get - source: timestamp - uid: - - - plugin: migration_lookup - migration: farm_migrate_user - source: uid - no_stub: true - - - plugin: default_value - default_value: 1 -migration_dependencies: - required: - - farm_migrate_user - optional: { } diff --git a/modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_file_private.yml b/modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_file_private.yml deleted file mode 100644 index 4d9cfca96..000000000 --- a/modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_file_private.yml +++ /dev/null @@ -1,64 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate -id: farm_migrate_file_private -label: 'Private files' -migration_group: farm_migrate_file -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_file - scheme: private - constants: - source_base_path: '/' -destination: - plugin: 'entity:file' -process: - fid: - plugin: get - source: fid - filename: - plugin: get - source: filename - source_full_path: - plugin: str_replace - source: uri - search: 'private://' - replace: 'private://migrate/' - uri: - plugin: file_copy - source: - - '@source_full_path' - - uri - filemime: - plugin: get - source: filemime - status: - plugin: get - source: status - created: - plugin: get - source: timestamp - changed: - plugin: get - source: timestamp - uid: - - - plugin: migration_lookup - migration: farm_migrate_user - source: uid - no_stub: true - - - plugin: default_value - default_value: 1 -migration_dependencies: - required: - - farm_migrate_user - optional: { } diff --git a/modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_quantity_system.yml b/modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_quantity_system.yml deleted file mode 100644 index bb9416ae5..000000000 --- a/modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_quantity_system.yml +++ /dev/null @@ -1,28 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate -id: farm_migrate_quantity_system -label: 'Quantity system of measurement' -migration_group: farm_migrate_config -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: variable - variables: - - farm_quantity_unit_system - source_module: farm_quantity -destination: - plugin: config - config_name: quantity.settings -process: - system_of_measurement: farm_quantity_unit_system -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_system_date.yml b/modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_system_date.yml deleted file mode 100644 index 37f264d1f..000000000 --- a/modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_system_date.yml +++ /dev/null @@ -1,38 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate -id: farm_migrate_system_date -label: 'System date configuration' -migration_group: farm_migrate_config -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: variable - variables: - - site_default_country - - date_first_day - - date_default_timezone - - configurable_timezones - - empty_timezone_message - - user_default_timezone - source_module: system -destination: - plugin: config - config_name: system.date -process: - 'country/default': site_default_country - first_day: date_first_day - 'timezone/default': date_default_timezone - 'timezone/user/configurable': configurable_timezones - 'timezone/user/warn': empty_timezone_message - 'timezone/user/default': user_default_timezone -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_user.yml b/modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_user.yml deleted file mode 100644 index e2ac9439c..000000000 --- a/modules/core/migrate/config/install/migrate_plus.migration.farm_migrate_user.yml +++ /dev/null @@ -1,71 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate -id: farm_migrate_user -label: 'User accounts' -migration_group: farm_migrate_user -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\user\Plugin\migrate\User -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_user -destination: - plugin: 'entity:user' -process: - uid: - plugin: get - source: uid - name: - plugin: get - source: name - pass: - plugin: get - source: pass - mail: - plugin: get - source: mail - created: - plugin: get - source: created - access: - plugin: get - source: access - login: - plugin: get - source: login - status: - plugin: get - source: status - timezone: - plugin: get - source: timezone - langcode: - plugin: user_langcode - source: entity_language - fallback_to_site_default: false - preferred_langcode: - plugin: user_langcode - source: language - fallback_to_site_default: true - preferred_admin_langcode: - plugin: user_langcode - source: language - fallback_to_site_default: true - init: - plugin: get - source: init - roles: - plugin: farm_migration_group_lookup - migration_group: farm_migrate_role - source: roles - no_stub: true -migration_dependencies: - required: { } - optional: - - farm_migrate_system_date diff --git a/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_area.yml b/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_area.yml deleted file mode 100644 index 104e629a7..000000000 --- a/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_area.yml +++ /dev/null @@ -1,83 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate -id: farm_migrate_area -label: 'farmOS 1.x Area Migration' -description: 'Migrates areas from farmOS 1.x to farmOS 2.x' -source_type: 'farmOS 1.x' -module: null -shared_configuration: - destination: - validate: true - process: - name: - plugin: get - source: name - uid: - plugin: default_value - default_value: 1 - status: - plugin: default_value - default_value: active - notes: - plugin: sub_process - source: description - process: - value: - plugin: get - source: value - format: - plugin: static_map - source: format - map: - farm_format: default - plain_text: plain_text - default_value: default - intrinsic_geometry: - plugin: geofield_d7d8 - source: field_farm_geofield - is_location: - plugin: default_value - default_value: 1 - is_fixed: - plugin: default_value - default_value: 1 - flag: - plugin: get - source: field_farm_flags - file: - plugin: sub_process - source: field_farm_files - process: - target_id: - plugin: migration_lookup - migration: - - farm_migrate_file - - farm_migrate_file_private - no_stub: true - source: fid - display: display - description: description - image: - plugin: sub_process - source: field_farm_images - process: - target_id: - plugin: migration_lookup - migration: - - farm_migrate_file - - farm_migrate_file_private - no_stub: true - source: fid - alt: alt - title: title - width: width - height: height - migration_dependencies: - required: - - farm_migrate_file - - farm_migrate_file_private - optional: { } diff --git a/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_asset.yml b/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_asset.yml deleted file mode 100644 index 70eea92da..000000000 --- a/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_asset.yml +++ /dev/null @@ -1,106 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate -id: farm_migrate_asset -label: 'farmOS 1.x Asset Migration' -description: 'Migrates assets from farmOS 1.x to farmOS 2.x' -source_type: 'farmOS 1.x' -module: null -shared_configuration: - destination: - validate: true - process: - name: - plugin: get - source: name - uid: - - - plugin: migration_lookup - migration: farm_migrate_user - source: uid - no_stub: true - - - plugin: default_value - default_value: 1 - created: - plugin: get - source: created - changed: - plugin: get - source: changed - # Map the old archived value to both an archived timestamp and a status. - # If the old value is 0, status is active. Otherwise, it is archived. - archived: - - - plugin: skip_on_empty - method: process - source: archived - - - plugin: get - source: archived - status: - plugin: static_map - source: archived - map: - 0: active - default_value: archived - notes: - plugin: sub_process - source: field_farm_description - process: - value: - plugin: get - source: value - format: - plugin: static_map - source: format - map: - farm_format: default - plain_text: plain_text - default_value: default - data: - plugin: get - source: field_farm_data - flag: - plugin: get - source: field_farm_flags - file: - plugin: sub_process - source: field_farm_files - process: - target_id: - plugin: migration_lookup - migration: - - farm_migrate_file - - farm_migrate_file_private - no_stub: true - source: fid - display: display - description: description - image: - plugin: sub_process - source: field_farm_images - process: - target_id: - plugin: migration_lookup - migration: - - farm_migrate_file - - farm_migrate_file_private - no_stub: true - source: fid - alt: alt - title: title - width: width - height: height - quick: - plugin: get - source: quick - migration_dependencies: - required: - - farm_migrate_file - - farm_migrate_file_private - - farm_migrate_user - optional: { } diff --git a/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_asset_parent.yml b/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_asset_parent.yml deleted file mode 100644 index 38f36d3ff..000000000 --- a/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_asset_parent.yml +++ /dev/null @@ -1,12 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate -id: farm_migrate_asset_parent -label: 'farmOS 1.x Asset Parents' -description: 'Migrates asset parent references from farmOS 1.x to farmOS 2.x' -source_type: 'farmOS 1.x' -module: null -shared_configuration: null diff --git a/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_config.yml b/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_config.yml deleted file mode 100644 index 6ec3c10db..000000000 --- a/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_config.yml +++ /dev/null @@ -1,12 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate -id: farm_migrate_config -label: 'farmOS 1.x Config Migration' -description: 'Migrate config from farmOS 1.x to 2.x' -source_type: 'farmOS 1.x' -module: null -shared_configuration: null diff --git a/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_file.yml b/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_file.yml deleted file mode 100644 index be93fe34a..000000000 --- a/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_file.yml +++ /dev/null @@ -1,12 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate -id: farm_migrate_file -label: 'farmOS 1.x File Migration' -description: 'Migrates files from farmOS 1.x to farmOS 2.x' -source_type: 'farmOS 1.x' -module: null -shared_configuration: null diff --git a/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_log.yml b/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_log.yml deleted file mode 100644 index 28cf01d8f..000000000 --- a/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_log.yml +++ /dev/null @@ -1,182 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate -id: farm_migrate_log -label: 'farmOS 1.x Log Migration' -description: 'Migrates logs from farmOS 1.x to farmOS 2.x' -source_type: 'farmOS 1.x' -module: null -shared_configuration: - destination: - validate: true - process: - name: - plugin: get - source: name - uid: - - - plugin: migration_lookup - migration: farm_migrate_user - source: uid - no_stub: true - - - plugin: default_value - default_value: 1 - timestamp: - plugin: get - source: timestamp - created: - plugin: get - source: created - changed: - plugin: get - source: changed - status: - plugin: static_map - source: done - map: - 0: pending - 1: done - notes: - plugin: sub_process - source: field_farm_notes - process: - value: - plugin: get - source: value - format: - plugin: static_map - source: format - map: - farm_format: default - plain_text: plain_text - default_value: default - data: - plugin: get - source: field_farm_data - asset: - plugin: sub_process - source: field_farm_asset - process: - target_id: - plugin: farm_migration_group_lookup - migration_group: farm_migrate_asset - source: target_id - location: - plugin: sub_process - source: field_farm_area - process: - target_id: - plugin: farm_migration_group_lookup - migration_group: farm_migrate_area - source: tid - geometry: - plugin: geofield_d7d8 - source: field_farm_geofield - is_movement: - plugin: get - source: is_movement - # Equipment used field. - # This is added by the farm_equipment_field module in farmOS 1.x, and the - # farm_equipment module in farmOS 2.x. - equipment: - plugin: sub_process - source: field_farm_equipment - process: - target_id: - plugin: migration_lookup - migration: farm_migrate_asset_equipment - source: target_id - # Group reference field. - # This is added by the farm_group module in farmOS, which is required in - # 1.x and optional in 2.x. - group: - plugin: sub_process - source: log_groups - process: - target_id: - plugin: migration_lookup - migration: farm_migrate_asset_group - source: target_id - is_group_assignment: - plugin: get - source: is_group_assignment - category: - plugin: sub_process - source: field_farm_log_category - process: - target_id: - plugin: migration_lookup - migration: farm_migrate_taxonomy_log_category - source: tid - flag: - plugin: get - source: field_farm_flags - owner: - plugin: sub_process - source: field_farm_log_owner - process: - target_id: - plugin: migration_lookup - migration: farm_migrate_user - source: target_id - no_stub: true - file: - plugin: sub_process - source: field_farm_files - process: - target_id: - plugin: migration_lookup - migration: - - farm_migrate_file - - farm_migrate_file_private - no_stub: true - source: fid - display: display - description: description - image: - plugin: sub_process - source: field_farm_images - process: - target_id: - plugin: migration_lookup - migration: - - farm_migrate_file - - farm_migrate_file_private - no_stub: true - source: fid - alt: alt - title: title - width: width - height: height - # Save quantities as a pseudo field and let log types migrate themselves. - _log_quantities: - - - plugin: farm_migration_group_lookup - migration_group: farm_migrate_quantity - source: log_quantities - no_stub: true - - - plugin: skip_on_empty - method: process - - - plugin: sub_process - process: - target_id: '0' - target_revision_id: '1' - quick: - plugin: get - source: quick - migration_dependencies: - required: - - farm_migrate_file - - farm_migrate_file_private - - farm_migrate_user - - farm_migrate_taxonomy_log_category - - farm_migrate_quantity_standard - optional: - - farm_migrate_asset_equipment - - farm_migrate_asset_group diff --git a/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_plan.yml b/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_plan.yml deleted file mode 100644 index cebd003eb..000000000 --- a/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_plan.yml +++ /dev/null @@ -1,88 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate -id: farm_migrate_plan -label: 'farmOS 1.x Plan Migration' -description: 'Migrates plans from farmOS 1.x to farmOS 2.x' -source_type: 'farmOS 1.x' -module: null -shared_configuration: - destination: - validate: true - process: - name: - plugin: get - source: name - uid: - - - plugin: migration_lookup - migration: farm_migrate_user - source: uid - no_stub: true - - - plugin: default_value - default_value: 1 - created: - plugin: get - source: created - changed: - plugin: get - source: changed - status: - plugin: static_map - source: archived - map: - 0: archived - 1: active - default_value: archived - notes: - plugin: sub_process - source: field_farm_notes - process: - value: - plugin: get - source: value - format: - plugin: static_map - source: format - map: - farm_format: default - plain_text: plain_text - default_value: default - file: - plugin: sub_process - source: field_farm_files - process: - target_id: - plugin: migration_lookup - migration: - - farm_migrate_file - - farm_migrate_file_private - no_stub: true - source: fid - display: display - description: description - image: - plugin: sub_process - source: field_farm_images - process: - target_id: - plugin: migration_lookup - migration: - - farm_migrate_file - - farm_migrate_file_private - no_stub: true - source: fid - alt: alt - title: title - width: width - height: height - migration_dependencies: - required: - - farm_migrate_file - - farm_migrate_file_private - - farm_migrate_user - optional: { } diff --git a/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_quantity.yml b/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_quantity.yml deleted file mode 100644 index 8c53bbecd..000000000 --- a/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_quantity.yml +++ /dev/null @@ -1,12 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate -id: farm_migrate_quantity -label: 'farmOS 1.x Quantity Migration' -description: 'Migrates quantity measurements from farmOS 1.x to farmOS 2.x' -source_type: 'farmOS 1.x' -module: null -shared_configuration : null diff --git a/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_role.yml b/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_role.yml deleted file mode 100644 index a464ef50b..000000000 --- a/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_role.yml +++ /dev/null @@ -1,32 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate -id: farm_migrate_role -label: 'farmOS 1.x Role Migration' -description: 'Migrates roles from farmOS 1.x to farmOS 2.x' -source_type: 'farmOS 1.x' -module: null -shared_configuration: - process: - # This role field is a placeholder, and should be replaced in the specific - # migration process configuration. This makes it easier for custom/contrib - # modules to provide role migrations. See the farm_migrate_user migration - # for an example that can be copied. - role: - - plugin: default_value - default_value: false - id: - - - plugin: get - source: '@role' - - - plugin: entity_lookup - value_key: id - entity_type: user_role - ignore_case: true - - - plugin: skip_map_on_empty - method: row diff --git a/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_sensor_data.yml b/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_sensor_data.yml deleted file mode 100644 index 737a84f47..000000000 --- a/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_sensor_data.yml +++ /dev/null @@ -1,12 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate -id: farm_migrate_sensor_data -label: 'farmOS 1.x Sensor Data Migration' -description: 'Migrates sensor data from farmOS 1.x to farmOS 2.x' -source_type: 'farmOS 1.x' -module: null -shared_configuration: null diff --git a/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_taxonomy.yml b/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_taxonomy.yml deleted file mode 100644 index a86122a26..000000000 --- a/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_taxonomy.yml +++ /dev/null @@ -1,37 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate -id: farm_migrate_taxonomy -label: 'farmOS 1.x Taxonomy Migration' -description: 'Migrates taxonomy terms from farmOS 1.x to farmOS 2.x' -source_type: 'farmOS 1.x' -module: null -shared_configuration: - destination: - validate: true - process: - name: - plugin: get - source: name - description/value: - plugin: get - source: description - description/format: - plugin: static_map - source: format - map: - farm_format: default - plain_text: plain_text - default_value: default - weight: - plugin: get - source: weight - langcode: - plugin: get - source: language - migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_user.yml b/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_user.yml deleted file mode 100644 index 630e10cd4..000000000 --- a/modules/core/migrate/config/install/migrate_plus.migration_group.farm_migrate_user.yml +++ /dev/null @@ -1,12 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate -id: farm_migrate_user -label: 'farmOS 1.x User Migration' -description: 'Migrates users from farmOS 1.x to farmOS 2.x' -source_type: 'farmOS 1.x' -module: null -shared_configuration: null diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_area_land.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_area_land.yml deleted file mode 100644 index 060c1fc0d..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_area_land.yml +++ /dev/null @@ -1,39 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate - - farm_land - - farm_land_types -id: farm_migrate_area_land -label: 'Land assets (from areas)' -migration_group: farm_migrate_area -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_farm_area - area_type: - - property - - field - - bed - - paddock - - landmark - - other -destination: - plugin: 'entity:asset' -process: - # Hard-code the bundle. - type: - plugin: default_value - default_value: land - land_type: - plugin: get - source: field_farm_area_type -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_area_none.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_area_none.yml deleted file mode 100644 index cf821f241..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_area_none.yml +++ /dev/null @@ -1,32 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate - - farm_land -id: farm_migrate_area_none -label: 'Areas of unknown type' -migration_group: farm_migrate_area -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_farm_area -destination: - plugin: 'entity:asset' -process: - # Hard-code the bundle. - type: - plugin: default_value - default_value: land - # Hard-code the land type to "other". - land_type: - plugin: default_value - default_value: other -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_area_structure.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_area_structure.yml deleted file mode 100644 index 7a9c77e6f..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_area_structure.yml +++ /dev/null @@ -1,35 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate - - farm_structure - - farm_structure_types -id: farm_migrate_area_structure -label: 'Structure assets (from areas)' -migration_group: farm_migrate_area -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_farm_area - area_type: - - building - - greenhouse -destination: - plugin: 'entity:asset' -process: - # Hard-code the bundle. - type: - plugin: default_value - default_value: structure - structure_type: - plugin: get - source: field_farm_area_type -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_area_water.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_area_water.yml deleted file mode 100644 index 95ba749b6..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_area_water.yml +++ /dev/null @@ -1,30 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate - - farm_water -id: farm_migrate_area_water -label: 'Water assets (from areas)' -migration_group: farm_migrate_area -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_farm_area - area_type: - - water -destination: - plugin: 'entity:asset' -process: - # Hard-code the bundle. - type: - plugin: default_value - default_value: water -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_animal.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_animal.yml deleted file mode 100644 index 47a795cbd..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_animal.yml +++ /dev/null @@ -1,81 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_animal - - farm_migrate -id: farm_migrate_asset_animal -label: 'Assets (Animals)' -migration_group: farm_migrate_asset -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_animal_asset - bundle: animal -destination: - plugin: 'entity:asset' -process: - # Hard-code the bundle. - type: - plugin: default_value - default_value: animal - # Maintain the asset ID. - id: - plugin: get - source: id - # Animal specific fields. - animal_type: - plugin: sub_process - source: field_farm_animal_type - process: - target_id: - plugin: migration_lookup - migration: farm_migrate_taxonomy_animal_type - source: tid - birthdate: - plugin: get - source: field_farm_date - nickname: - plugin: get - source: field_farm_animal_nicknames - sex: - plugin: get - source: field_farm_animal_sex - is_castrated: - plugin: get - source: field_farm_animal_castrated - id_tag: - plugin: sub_process - source: animal_tags - process: - id: - plugin: get - source: id - type: - - - plugin: skip_on_empty - source: type - method: process - - - plugin: static_map - source: type - map: - Brand: brand - Ear tag: ear_tag - Tattoo: tattoo - Leg band: leg_band - Chip: eid - Other: other - default_value: other - location: - plugin: get - source: location -migration_dependencies: - required: - - farm_migrate_taxonomy_animal_type - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_compost.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_compost.yml deleted file mode 100644 index bcf76cf43..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_compost.yml +++ /dev/null @@ -1,33 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_compost - - farm_migrate -id: farm_migrate_asset_compost -label: 'Assets (Compost)' -migration_group: farm_migrate_asset -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_farm_asset - bundle: compost -destination: - plugin: 'entity:asset' -process: - # Hard-code the bundle. - type: - plugin: default_value - default_value: compost - # Maintain the asset ID. - id: - plugin: get - source: id -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_equipment.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_equipment.yml deleted file mode 100644 index cb8ba61e1..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_equipment.yml +++ /dev/null @@ -1,43 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_equipment - - farm_migrate -id: farm_migrate_asset_equipment -label: 'Assets (Equipment)' -migration_group: farm_migrate_asset -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_farm_asset - bundle: equipment -destination: - plugin: 'entity:asset' -process: - # Hard-code the bundle. - type: - plugin: default_value - default_value: equipment - # Maintain the asset ID. - id: - plugin: get - source: id - # Equipment specific fields. - manufacturer: - plugin: get - source: field_farm_manufacturer - model: - plugin: get - source: field_farm_model - serial_number: - plugin: get - source: field_farm_serial_number -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_group.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_group.yml deleted file mode 100644 index 31525de2b..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_group.yml +++ /dev/null @@ -1,33 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_group - - farm_migrate -id: farm_migrate_asset_group -label: 'Assets (Groups)' -migration_group: farm_migrate_asset -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_farm_asset - bundle: group -destination: - plugin: 'entity:asset' -process: - # Hard-code the bundle. - type: - plugin: default_value - default_value: group - # Maintain the asset ID. - id: - plugin: get - source: id -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_plant.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_plant.yml deleted file mode 100644 index 825edc172..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_plant.yml +++ /dev/null @@ -1,52 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate - - farm_plant -id: farm_migrate_asset_plant -label: 'Assets (Plants)' -migration_group: farm_migrate_asset -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_farm_asset - bundle: planting -destination: - plugin: 'entity:asset' -process: - # Hard-code the bundle. - type: - plugin: default_value - default_value: plant - # Maintain the asset ID. - id: - plugin: get - source: id - # Plant specific fields. - plant_type: - plugin: sub_process - source: field_farm_crop - process: - target_id: - plugin: migration_lookup - migration: farm_migrate_taxonomy_plant_type - source: tid - season: - plugin: sub_process - source: field_farm_season - process: - target_id: - plugin: migration_lookup - migration: farm_migrate_taxonomy_season - source: tid -migration_dependencies: - required: - - farm_migrate_taxonomy_plant_type - - farm_migrate_taxonomy_season - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_sensor.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_sensor.yml deleted file mode 100644 index f34edb4d8..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_sensor.yml +++ /dev/null @@ -1,33 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate - - farm_sensor -id: farm_migrate_asset_sensor -label: 'Assets (Sensors)' -migration_group: farm_migrate_asset -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_sensor_asset - sensor_type: '' -destination: - plugin: 'entity:asset' -process: - # Hard-code the bundle. - type: - plugin: default_value - default_value: sensor - # Maintain the asset ID. - id: - plugin: get - source: id -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_sensor_listener.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_sensor_listener.yml deleted file mode 100644 index 0c8f00e7a..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_asset_sensor_listener.yml +++ /dev/null @@ -1,48 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate - - farm_sensor - - farm_sensor_listener -id: farm_migrate_asset_sensor_listener -label: 'Assets (Listener sensors)' -migration_group: farm_migrate_asset -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_sensor_asset - sensor_type: 'listener' -destination: - plugin: 'entity:asset' -process: - # Hard-code the bundle. - type: - plugin: default_value - default_value: sensor - # Maintain the asset ID. - id: - plugin: get - source: id - # Extract the private_key from sensor settings. - private_key: - plugin: extract - source: sensor_settings - default: '' - index: - - private_key - # Extract the public_key from sensor settings. - public_key: - plugin: extract - source: sensor_settings - default: '' - index: - - public_key -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_inventory.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_inventory.yml deleted file mode 100644 index 1ed599cb1..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_inventory.yml +++ /dev/null @@ -1,61 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate - - farm_inventory -id: farm_migrate_inventory -label: 'Inventories' -migration_group: farm_migrate_quantity -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_farm_inventory -destination: - plugin: 'entity_reference_revisions:quantity' -process: - # Hard-code the bundle. - type: - plugin: default_value - default_value: standard - # Hard-code the measure. - measure: - plugin: default_value - default_value: count - # The inventory value should always be positive because we only - # migrate increment or decrement adjustments. - value/numerator: - plugin: callback - callable: abs - source: value_numerator - value/denominator: value_denominator - uid: - - - plugin: migration_lookup - migration: farm_migrate_user - source: uid - no_stub: true - - - plugin: default_value - default_value: 1 - inventory_asset: - plugin: farm_migration_group_lookup - migration_group: farm_migrate_asset - source: inventory_asset - inventory_adjustment: - plugin: static_map - source: inventory_value_sign - map: - -1: decrement - 0: increment - 1: increment -migration_dependencies: - required: - - farm_migrate_user - - farm_migrate_taxonomy_unit - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_activity.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_activity.yml deleted file mode 100644 index ed479fa00..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_activity.yml +++ /dev/null @@ -1,37 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_activity - - farm_migrate -id: farm_migrate_log_activity -label: 'Logs (Activities)' -migration_group: farm_migrate_log -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_farm_log - bundle: farm_activity -destination: - plugin: 'entity:log' -process: - # Hard-code the bundle. - type: - plugin: default_value - default_value: activity - # Maintain the log ID. - id: - plugin: get - source: id - # Migrate log quantities. - quantity: - plugin: get - source: '@_log_quantities' -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_birth.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_birth.yml deleted file mode 100644 index c2d90d0c9..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_birth.yml +++ /dev/null @@ -1,46 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_birth - - farm_migrate -id: farm_migrate_log_birth -label: 'Logs (Birth)' -migration_group: farm_migrate_log -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_farm_log - bundle: farm_birth -destination: - plugin: 'entity:log' -process: - # Hard-code the bundle. - type: - plugin: default_value - default_value: birth - # Maintain the log ID. - id: - plugin: get - source: id - # Migrate log quantities. - quantity: - plugin: get - source: '@_log_quantities' - # Birth specific fields. - mother: - plugin: sub_process - source: field_farm_mother - process: - target_id: - plugin: farm_migration_group_lookup - migration_group: farm_migrate_asset - source: target_id -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_harvest.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_harvest.yml deleted file mode 100644 index 4269be8dd..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_harvest.yml +++ /dev/null @@ -1,41 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_harvest - - farm_migrate -id: farm_migrate_log_harvest -label: 'Logs (Harvests)' -migration_group: farm_migrate_log -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_farm_log - bundle: farm_harvest -destination: - plugin: 'entity:log' -process: - # Hard-code the bundle. - type: - plugin: default_value - default_value: harvest - # Maintain the log ID. - id: - plugin: get - source: id - # Migrate log quantities. - quantity: - plugin: get - source: '@_log_quantities' - # Harvest specific fields. - lot_number: - plugin: get - source: field_farm_lot_number -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_input.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_input.yml deleted file mode 100644 index 3ea85c339..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_input.yml +++ /dev/null @@ -1,74 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_input - - farm_migrate -id: farm_migrate_log_input -label: 'Logs (Inputs)' -migration_group: farm_migrate_log -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_farm_log - bundle: farm_input -destination: - plugin: 'entity:log' -process: - # Hard-code the bundle. - type: - plugin: default_value - default_value: input - # Maintain the log ID. - id: - plugin: get - source: id - # Input specific fields. - lot_number: - plugin: get - source: field_farm_lot_number - method: - plugin: get - source: field_farm_input_method - purchase_date: - plugin: get - source: field_farm_date_purchase - source: - plugin: get - source: field_farm_input_source - # Save the material_type in a pseudo field. - _material_type: - plugin: sub_process - source: field_farm_material - process: - target_id: - plugin: migration_lookup - migration: farm_migrate_taxonomy_material_type - source: tid - # Migrate the field_farm_material term reference into a material quantity. - _material_quantities: - # Build the quantity. - plugin: create_quantity - source: '@_material_type' - default_values: - type: 'material' - values: - uid: '@uid' - created: '@created' - changed: '@changed' - material_type: target_id - # Merge the material quantity with other log quantities. - quantity: - plugin: merge - source: - - '@_log_quantities' - - '@_material_quantities' -migration_dependencies: - required: - - farm_migrate_taxonomy_material_type - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_lab_test.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_lab_test.yml deleted file mode 100644 index 3a65a47d6..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_lab_test.yml +++ /dev/null @@ -1,71 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_lab_test - - farm_migrate -id: farm_migrate_log_lab_test -label: 'Logs (Lab tests)' -migration_group: farm_migrate_log -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_farm_log - bundle: - - farm_soil_test - - farm_water_test -destination: - plugin: 'entity:log' -process: - # Hard-code the bundle. - type: - plugin: default_value - default_value: lab_test - # Maintain the log ID. - id: - plugin: get - source: id - # Migrate log quantities. - quantity: - plugin: get - source: '@_log_quantities' - # Lab test specific fields. - lab: - - - plugin: get_lab - - - plugin: skip_on_empty - method: process - - - plugin: entity_generate - value_key: name - entity_type: taxonomy_term - bundle_key: vid - bundle: lab - lab_test_type: - plugin: static_map - source: type - map: - farm_soil_test: soil - farm_water_test: water - # Concatenate the 1.x "Soil names" field summary into Notes. - notes/0/value: - plugin: concat - source: - - field_farm_notes/0/value - - soil_name_summary - notes/0/format: - plugin: static_map - source: field_farm_notes/0/format - map: - farm_format: default - plain_text: plain_text - default_value: default -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_maintenance.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_maintenance.yml deleted file mode 100644 index 326461d4f..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_maintenance.yml +++ /dev/null @@ -1,37 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_maintenance - - farm_migrate -id: farm_migrate_log_maintenance -label: 'Logs (Maintenance)' -migration_group: farm_migrate_log -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_farm_log - bundle: farm_maintenance -destination: - plugin: 'entity:log' -process: - # Hard-code the bundle. - type: - plugin: default_value - default_value: maintenance - # Maintain the log ID. - id: - plugin: get - source: id - # Migrate log quantities. - quantity: - plugin: get - source: '@_log_quantities' -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_medical.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_medical.yml deleted file mode 100644 index 8e9b03c31..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_medical.yml +++ /dev/null @@ -1,41 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_medical - - farm_migrate -id: farm_migrate_log_medical -label: 'Logs (Medical)' -migration_group: farm_migrate_log -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_farm_log - bundle: farm_medical -destination: - plugin: 'entity:log' -process: - # Hard-code the bundle. - type: - plugin: default_value - default_value: medical - # Maintain the log ID. - id: - plugin: get - source: id - # Medical specific fields. - vet: - plugin: get - source: field_farm_vet - # Migrate log quantities. - quantity: - plugin: get - source: '@_log_quantities' -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_observation.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_observation.yml deleted file mode 100644 index 7ceedb6f3..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_observation.yml +++ /dev/null @@ -1,37 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate - - farm_observation -id: farm_migrate_log_observation -label: 'Logs (Observations)' -migration_group: farm_migrate_log -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_farm_log - bundle: farm_observation -destination: - plugin: 'entity:log' -process: - # Hard-code the bundle. - type: - plugin: default_value - default_value: observation - # Maintain the log ID. - id: - plugin: get - source: id - # Migrate log quantities. - quantity: - plugin: get - source: '@_log_quantities' -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_seeding.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_seeding.yml deleted file mode 100644 index 19d8b4a14..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_seeding.yml +++ /dev/null @@ -1,44 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate - - farm_seeding -id: farm_migrate_log_seeding -label: 'Logs (Seedings)' -migration_group: farm_migrate_log -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_farm_log - bundle: farm_seeding -destination: - plugin: 'entity:log' -process: - # Hard-code the bundle. - type: - plugin: default_value - default_value: seeding - # Maintain the log ID. - id: - plugin: get - source: id - # Migrate log quantities. - quantity: - plugin: get - source: '@_log_quantities' - # Seeding specific fields. - lot_number: - plugin: get - source: field_farm_lot_number - source: - plugin: get - source: field_farm_seed_source -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_transplanting.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_transplanting.yml deleted file mode 100644 index 5c75a2383..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_transplanting.yml +++ /dev/null @@ -1,37 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate - - farm_transplanting -id: farm_migrate_log_transplanting -label: 'Logs (Transplantings)' -migration_group: farm_migrate_log -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_farm_log - bundle: farm_transplanting -destination: - plugin: 'entity:log' -process: - # Hard-code the bundle. - type: - plugin: default_value - default_value: transplanting - # Maintain the log ID. - id: - plugin: get - source: id - # Migrate log quantities. - quantity: - plugin: get - source: '@_log_quantities' -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_quantity_standard.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_quantity_standard.yml deleted file mode 100644 index baed17b9f..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_quantity_standard.yml +++ /dev/null @@ -1,47 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate - - farm_quantity_standard -id: farm_migrate_quantity_standard -label: 'Quantities (Standard)' -migration_group: farm_migrate_quantity -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_farm_quantity -destination: - plugin: 'entity_reference_revisions:quantity' -process: - # Hard-code the bundle. - type: - plugin: default_value - default_value: standard - measure: measure - value/numerator: value_numerator - value/denominator: value_denominator - units: - plugin: migration_lookup - migration: farm_migrate_taxonomy_unit - source: units - label: label - uid: - - - plugin: migration_lookup - migration: farm_migrate_user - source: uid - no_stub: true - - - plugin: default_value - default_value: 1 -migration_dependencies: - required: - - farm_migrate_user - - farm_migrate_taxonomy_unit - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_role.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_role.yml deleted file mode 100644 index 3fe3340dc..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_role.yml +++ /dev/null @@ -1,32 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate - - farm_role_roles -id: farm_migrate_role -label: 'Roles' -migration_group: farm_migrate_role -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_user_role -destination: - plugin: 'entity:user_role' -process: - role: - plugin: static_map - source: name - map: - Farm Manager: farm_manager - Farm Worker: farm_worker - Farm Viewer: farm_viewer - bypass: true -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_sensor_listener_data_streams.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_sensor_listener_data_streams.yml deleted file mode 100644 index 410cdcd66..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_sensor_listener_data_streams.yml +++ /dev/null @@ -1,43 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate - - data_stream - - farm_sensor - - farm_sensor_listener -id: farm_migrate_sensor_listener_data_streams -label: 'Listener sensor data streams' -migration_group: farm_migrate_sensor_data -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_sensor_listener_data_names -destination: - plugin: data_stream -process: - # Hard-code the data stream bundle. - type: - plugin: default_value - default_value: basic - # Use the old sensor ID to find the migrated sensor ID. - providing_asset: - - plugin: farm_migration_group_lookup - migration_group: farm_migrate_asset - source: id - no_stub: true - - plugin: skip_on_empty - method: row - # Build a name for the data stream. - name: - plugin: get - source: name -migration_dependencies: - required: - - farm_migrate_asset_sensor_listener - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_sensor_listener_notifications.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_sensor_listener_notifications.yml deleted file mode 100644 index 760559831..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_sensor_listener_notifications.yml +++ /dev/null @@ -1,129 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate - - data_stream - - data_stream_notification - - farm_sensor - - farm_sensor_listener -id: farm_migrate_sensor_listener_notifications -label: 'Listener sensor notifications' -migration_group: farm_migrate_sensor_data -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_sensor_asset - sensor_type: 'listener' - constants: - NOTIFICATION_ID_PREFIX: 'sensor' - NOTIFICATION_LABEL_SEPARATOR: ': ' -destination: - plugin: 'entity:data_stream_notification' -process: - # Do not create a notification if there are no configured notifications. - # In practice there will only be one notification, but it is stored as an array. - _notifications: - - plugin: extract - source: sensor_settings - default: false - index: - - notifications - - plugin: skip_on_empty - method: row - # Save the first notification value name as a pseudo field. - _value_name: - - plugin: extract - source: '@_notifications' - default: false - index: - - 0 - - name - - plugin: skip_on_empty - method: row - # Build an id of the format sensor_{asset_id}_{value name} - id: - plugin: concat - delimiter: '_' - source: - - constants/NOTIFICATION_ID_PREFIX - - id - - '@_value_name' - # Build a label of the format {Sensor name}: {value name} - label: - plugin: concat - source: - - name - - constants/NOTIFICATION_LABEL_SEPARATOR - - '@_value_name' - # Lookup the data stream to reference. - # Use the sensor asset id and notification value name as source ids. - data_stream: - - plugin: migration_lookup - migration: farm_migrate_sensor_listener_data_streams - no_stub: true - source_ids: - farm_migrate_sensor_listener_data_streams: - - id - - '@_value_name' - - plugin: skip_on_empty - method: row - # Configure default values. - # Only send an email the first time a threshold is crossed. - activation_threshold: - plugin: default_value - default_value: 1 - deactivation_threshold: - plugin: default_value - default_value: 1 - condition_operator: - plugin: default_value - default_value: or - delivery_interval: - plugin: default_value - default_value: 0 - # Build numeric condition. - condition: - plugin: sub_process - source: '@_notifications' - process: - type: - plugin: default_value - default_value: numeric - negagte: - plugin: default_value - default_value: false - condition: - - plugin: get - source: condition - - plugin: skip_on_empty - method: row - threshold: - - plugin: get - source: threshold - - plugin: skip_on_empty - method: row - # Build email delivery. - delivery: - plugin: sub_process - source: '@_notifications' - process: - type: - plugin: default_value - default_value: email - email: - - plugin: get - source: email - - plugin: skip_on_empty - method: row - - plugin: explode - delimiter: ',' -migration_dependencies: - required: - - farm_migrate_sensor_listener_data_streams - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_animal_type.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_animal_type.yml deleted file mode 100644 index c27092023..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_animal_type.yml +++ /dev/null @@ -1,46 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate - - farm_animal -id: farm_migrate_taxonomy_animal_type -label: 'Taxonomy terms (Animal type)' -migration_group: farm_migrate_taxonomy -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_taxonomy_term - bundle: farm_animal_types -destination: - plugin: 'entity:taxonomy_term' -process: - # Hard-code the vocabulary. - vid: - plugin: default_value - default_value: animal_type - # Maintain the term ID. - tid: - plugin: get - source: tid - # Term parent. - parent_id: - - - plugin: skip_on_empty - method: process - source: parent - - - plugin: migration_lookup - migration: farm_migrate_taxonomy_animal_type - parent: - plugin: default_value - default_value: 0 - source: '@parent_id' -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_crop_family.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_crop_family.yml deleted file mode 100644 index 044471aee..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_crop_family.yml +++ /dev/null @@ -1,46 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate - - farm_plant -id: farm_migrate_taxonomy_crop_family -label: 'Taxonomy terms (Crop family)' -migration_group: farm_migrate_taxonomy -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_taxonomy_term - bundle: farm_crop_families -destination: - plugin: 'entity:taxonomy_term' -process: - # Hard-code the vocabulary. - vid: - plugin: default_value - default_value: crop_family - # Maintain the term ID. - tid: - plugin: get - source: tid - # Term parent. - parent_id: - - - plugin: skip_on_empty - method: process - source: parent - - - plugin: migration_lookup - migration: farm_migrate_taxonomy_crop_family - parent: - plugin: default_value - default_value: 0 - source: '@parent_id' -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_log_category.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_log_category.yml deleted file mode 100644 index 282de704e..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_log_category.yml +++ /dev/null @@ -1,46 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_log_category - - farm_migrate -id: farm_migrate_taxonomy_log_category -label: 'Taxonomy terms (Log categories)' -migration_group: farm_migrate_taxonomy -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_taxonomy_term - bundle: farm_log_categories -destination: - plugin: 'entity:taxonomy_term' -process: - # Hard-code the vocabulary. - vid: - plugin: default_value - default_value: log_category - # Maintain the term ID. - tid: - plugin: get - source: tid - # Term parent. - parent_id: - - - plugin: skip_on_empty - method: process - source: parent - - - plugin: migration_lookup - migration: farm_migrate_taxonomy_log_category - parent: - plugin: default_value - default_value: 0 - source: '@parent_id' -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_material_type.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_material_type.yml deleted file mode 100644 index ea88a8be4..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_material_type.yml +++ /dev/null @@ -1,46 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_material_type - - farm_migrate -id: farm_migrate_taxonomy_material_type -label: 'Taxonomy terms (Material types)' -migration_group: farm_migrate_taxonomy -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_taxonomy_term - bundle: farm_materials -destination: - plugin: 'entity:taxonomy_term' -process: - # Hard-code the vocabulary. - vid: - plugin: default_value - default_value: material_type - # Maintain the term ID. - tid: - plugin: get - source: tid - # Term parent. - parent_id: - - - plugin: skip_on_empty - method: process - source: parent - - - plugin: migration_lookup - migration: farm_migrate_taxonomy_material_type - parent: - plugin: default_value - default_value: 0 - source: '@parent_id' -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_plant_type.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_plant_type.yml deleted file mode 100644 index 1b7bb9583..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_plant_type.yml +++ /dev/null @@ -1,85 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate - - farm_plant -id: farm_migrate_taxonomy_plant_type -label: 'Taxonomy terms (Plant type)' -migration_group: farm_migrate_taxonomy -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_taxonomy_term - bundle: farm_crops -destination: - plugin: 'entity:taxonomy_term' -process: - # Hard-code the vocabulary. - vid: - plugin: default_value - default_value: plant_type - # Maintain the term ID. - tid: - plugin: get - source: tid - # Term parent. - parent_id: - - - plugin: skip_on_empty - method: process - source: parent - - - plugin: migration_lookup - migration: farm_migrate_taxonomy_plant_type - parent: - plugin: default_value - default_value: 0 - source: '@parent_id' - # Plant type specific fields. - companions: - plugin: sub_process - source: field_farm_companions - process: - target_id: - plugin: migration_lookup - migration: farm_migrate_taxonomy_plant_type - source: tid - crop_family: - plugin: sub_process - source: field_farm_crop_family - process: - target_id: - plugin: migration_lookup - migration: farm_migrate_taxonomy_crop_family - source: tid - transplant_days: - plugin: get - source: field_farm_transplant_days - maturity_days: - plugin: get - source: field_farm_maturity_days - image: - plugin: sub_process - source: field_farm_images - process: - target_id: - plugin: migration_lookup - migration: - - farm_migrate_file - - farm_migrate_file_private - no_stub: true - source: fid - alt: alt - title: title - width: width - height: height -migration_dependencies: - required: - - farm_migrate_taxonomy_crop_family - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_season.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_season.yml deleted file mode 100644 index 3fde39bc8..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_season.yml +++ /dev/null @@ -1,46 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate - - farm_season -id: farm_migrate_taxonomy_season -label: 'Taxonomy terms (Seasons)' -migration_group: farm_migrate_taxonomy -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_taxonomy_term - bundle: farm_season -destination: - plugin: 'entity:taxonomy_term' -process: - # Hard-code the vocabulary. - vid: - plugin: default_value - default_value: season - # Maintain the term ID. - tid: - plugin: get - source: tid - # Term parent. - parent_id: - - - plugin: skip_on_empty - method: process - source: parent - - - plugin: migration_lookup - migration: farm_migrate_taxonomy_season - parent: - plugin: default_value - default_value: 0 - source: '@parent_id' -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_unit.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_unit.yml deleted file mode 100644 index b5ae66b42..000000000 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_unit.yml +++ /dev/null @@ -1,46 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_migrate - - farm_unit -id: farm_migrate_taxonomy_unit -label: 'Taxonomy terms (Units)' -migration_group: farm_migrate_taxonomy -migration_tags: - - 'Drupal 7' - - 'farmOS 1.x' -class: Drupal\migrate\Plugin\Migration -field_plugin_method: null -cck_plugin_method: null -source: - plugin: d7_taxonomy_term - bundle: farm_quantity_units -destination: - plugin: 'entity:taxonomy_term' -process: - # Hard-code the vocabulary. - vid: - plugin: default_value - default_value: unit - # Maintain the term ID. - tid: - plugin: get - source: tid - # Term parent. - parent_id: - - - plugin: skip_on_empty - method: process - source: parent - - - plugin: migration_lookup - migration: farm_migrate_taxonomy_unit - parent: - plugin: default_value - default_value: 0 - source: '@parent_id' -migration_dependencies: - required: { } - optional: { } diff --git a/modules/core/migrate/drush.services.yml b/modules/core/migrate/drush.services.yml deleted file mode 100644 index d2790d36d..000000000 --- a/modules/core/migrate/drush.services.yml +++ /dev/null @@ -1,6 +0,0 @@ -services: - farm_migrate.commands: - class: Drupal\farm_migrate\Commands\FarmMigrateCommands - arguments: ['@plugin.manager.migration', '@date.formatter', '@entity_type.manager', '@keyvalue'] - tags: - - { name: drush.command } diff --git a/modules/core/migrate/farm_migrate.info.yml b/modules/core/migrate/farm_migrate.info.yml index c987722b0..fb8c6fba4 100644 --- a/modules/core/migrate/farm_migrate.info.yml +++ b/modules/core/migrate/farm_migrate.info.yml @@ -5,8 +5,4 @@ package: farmOS core_version_requirement: ^9 dependencies: - drupal:migrate - - drupal:migrate_drupal - - farm:asset - - log:log - migrate_plus:migrate_plus - - migrate_tools:migrate_tools diff --git a/modules/core/migrate/farm_migrate.module b/modules/core/migrate/farm_migrate.module deleted file mode 100644 index 60361bce8..000000000 --- a/modules/core/migrate/farm_migrate.module +++ /dev/null @@ -1,22 +0,0 @@ -get('farm_migrate_allow_file_referencing')) { - return AccessResult::allowed(); - } -} diff --git a/modules/core/migrate/farm_migrate.post_update.php b/modules/core/migrate/farm_migrate.post_update.php index c46add9b8..14ae96792 100644 --- a/modules/core/migrate/farm_migrate.post_update.php +++ b/modules/core/migrate/farm_migrate.post_update.php @@ -5,260 +5,72 @@ * Post update hooks for the farm_migrate module. */ -use Drupal\Core\Database\Database; -use Drupal\Core\Site\Settings; -use Drupal\Core\Utility\UpdateException; - /** - * Fix migrated input log quantity materials. + * Uninstall farmOS v1 migrations. */ -function farm_migrate_post_update_fix_input_log_quantity_materials(&$sandbox) { +function farm_migrate_post_update_uninstall_v1_migrations(&$sandbox) { - // For more information see https://github.com/farmOS/farmOS/issues/579. - - // This update can be skipped by adding: - // $settings['farm_migrate_skip_input_log_migration_fix'] = TRUE; - // to settings.php. - if (Settings::get('farm_migrate_skip_input_log_migration_fix', FALSE) === TRUE) { - return t("Skipping automatic fix of input log material quantities because of this line in settings.php: \$settings['farm_migrate_skip_input_log_migration_fix'] = TRUE;"); + // Delete migration and migration_group configurations. + $configurations = [ + 'migrate_plus.migration.farm_migrate_area_land', + 'migrate_plus.migration.farm_migrate_area_none', + 'migrate_plus.migration.farm_migrate_area_structure', + 'migrate_plus.migration.farm_migrate_area_water', + 'migrate_plus.migration.farm_migrate_asset_animal', + 'migrate_plus.migration.farm_migrate_asset_compost', + 'migrate_plus.migration.farm_migrate_asset_equipment', + 'migrate_plus.migration.farm_migrate_asset_group', + 'migrate_plus.migration.farm_migrate_asset_plant', + 'migrate_plus.migration.farm_migrate_asset_sensor', + 'migrate_plus.migration.farm_migrate_asset_sensor_listener', + 'migrate_plus.migration.farm_migrate_inventory', + 'migrate_plus.migration.farm_migrate_log_activity', + 'migrate_plus.migration.farm_migrate_log_birth', + 'migrate_plus.migration.farm_migrate_log_harvest', + 'migrate_plus.migration.farm_migrate_log_input', + 'migrate_plus.migration.farm_migrate_log_lab_test', + 'migrate_plus.migration.farm_migrate_log_maintenance', + 'migrate_plus.migration.farm_migrate_log_medical', + 'migrate_plus.migration.farm_migrate_log_observation', + 'migrate_plus.migration.farm_migrate_log_seeding', + 'migrate_plus.migration.farm_migrate_log_transplanting', + 'migrate_plus.migration.farm_migrate_quantity_standard', + 'migrate_plus.migration.farm_migrate_role', + 'migrate_plus.migration.farm_migrate_sensor_listener_data_streams', + 'migrate_plus.migration.farm_migrate_sensor_listener_notifications', + 'migrate_plus.migration.farm_migrate_taxonomy_animal_type', + 'migrate_plus.migration.farm_migrate_taxonomy_crop_family', + 'migrate_plus.migration.farm_migrate_taxonomy_log_category', + 'migrate_plus.migration.farm_migrate_taxonomy_material_type', + 'migrate_plus.migration.farm_migrate_taxonomy_plant_type', + 'migrate_plus.migration.farm_migrate_taxonomy_season', + 'migrate_plus.migration.farm_migrate_taxonomy_unit', + 'migrate_plus.migration.farm_migrate_area_field_parent', + 'migrate_plus.migration.farm_migrate_asset_field_parent', + 'migrate_plus.migration.farm_migrate_file', + 'migrate_plus.migration.farm_migrate_file_private', + 'migrate_plus.migration.farm_migrate_quantity_system', + 'migrate_plus.migration.farm_migrate_system_date', + 'migrate_plus.migration.farm_migrate_user', + 'migrate_plus.migration_group.farm_migrate_area', + 'migrate_plus.migration_group.farm_migrate_asset', + 'migrate_plus.migration_group.farm_migrate_asset_parent', + 'migrate_plus.migration_group.farm_migrate_config', + 'migrate_plus.migration_group.farm_migrate_file', + 'migrate_plus.migration_group.farm_migrate_log', + 'migrate_plus.migration_group.farm_migrate_plan', + 'migrate_plus.migration_group.farm_migrate_quantity', + 'migrate_plus.migration_group.farm_migrate_role', + 'migrate_plus.migration_group.farm_migrate_sensor_data', + 'migrate_plus.migration_group.farm_migrate_taxonomy', + 'migrate_plus.migration_group.farm_migrate_user', + ]; + foreach ($configurations as $name) { + \Drupal::configFactory()->getEditable($name)->delete(); } - // This function will run as a batch operation, so ensure that the initial - // setup only runs once. - if (!isset($sandbox['current_log'])) { - - // If the material quantity module is not enabled, there is nothing to fix. - if (!\Drupal::moduleHandler()->moduleExists('farm_quantity_material')) { - return NULL; - } - - // Check to see if there are logs that suffer from the issue described in - // https://github.com/farmOS/farmOS/issues/579 (logs with multiple material - // quantities that all reference the same material term). - $database = \Drupal::database(); - $query = $database->select('log', 'l'); - $query->addField('l', 'id'); - $query->join('log__quantity', 'lq', 'l.id = lq.entity_id AND l.revision_id = lq.revision_id'); - $query->join('quantity', 'q', 'lq.quantity_target_id = q.id'); - $query->join('quantity__material_type', 'mt', 'q.id = mt.entity_id AND q.revision_id = mt.revision_id AND mt.deleted = 0'); - $query->condition('l.type', 'input'); - $query->condition('lq.deleted', 0); - $query->condition('q.type', 'material'); - $query->groupBy('l.id'); - $query->groupBy('mt.material_type_target_id'); - $query->having('COUNT(lq.quantity_target_id) > 1'); - $log_ids = $query->execute()->fetchCol(); - - // If there are no affected logs, bail. - if (empty($log_ids)) { - return NULL; - } - - // Query the mapping of v1 to v2 input logs, filtering out logs that are - // not in the affected list. This serves to ensure that the only logs we - // act upon are those that a) are currently affected, and b) were migrated. - // We do not want to act upon logs that were not migrated. This also serves - // to throw an exception if the migrate mapping table is missing from the - // database. - $log_map = []; - $result = $database->query("SELECT sourceid1, destid1 FROM {migrate_map_farm_migrate_log_input} WHERE destid1 IN (:ids[])", [':ids[]' => $log_ids])->fetchAll(); - foreach ($result as $row) { - if (!empty($row->sourceid1) && !empty($row->destid1)) { - $log_map[$row->sourceid1] = $row->destid1; - } - } - - // If there are no logs in the mapping, bail. - if (empty($log_map)) { - return NULL; - } - - // Take a moment to explain what is happening, and how to skip this update - // from running. - \Drupal::logger('farm_migrate')->notice(t("This update will attempt to fix an issue with the migration of input log material data from farmOS v1. To skip this update, add this line to settings.php: \$settings['farm_migrate_skip_input_log_migration_fix'] = TRUE;")); - \Drupal::logger('farm_migrate')->notice(t('There are @count logs affected by this issue.', ['@count' => count($log_map)])); - - // Check to see if a 1.x database connection is available. - // This assumes that the site admin followed the recommended steps in the - // migration docs. - try { - $migrate_database = Database::getConnection('default', 'migrate'); - $migrate_database->query("SELECT COUNT(*) FROM {log} WHERE type = 'farm_input'")->fetchField(); - } - catch (\Exception $e) { - throw new UpdateException('Could not connect to the farmOS v1 database. Add `migrate` database to settings.php and re-run this update to continue.'); - } - - // Build a map of v1 log IDs to their v1 material term IDs. - // Order by the original v1 deltas. - // Create an index of term IDs that were affected. - $material_tids = []; - $v1_log_materials = []; - $result = $migrate_database->query("SELECT entity_id as log_id, field_farm_material_tid as tid FROM {field_data_field_farm_material} WHERE entity_type = 'log' AND bundle = 'farm_input' AND entity_id IN (:ids[]) ORDER BY delta ASC", [':ids[]' => array_keys($log_map)])->fetchAll(); - foreach ($result as $row) { - if (!empty($row->tid) && !empty($row->log_id)) { - $material_tids[] = $row->tid; - $v1_log_materials[$row->log_id][] = $row->tid; - } - } - - // Build a map of migrated v1 to v2 term IDs. - $material_map = []; - $result = $database->query('SELECT sourceid1, destid1 FROM {migrate_map_farm_migrate_taxonomy_material_type} WHERE sourceid1 IN (:ids[])', [':ids[]' => $material_tids])->fetchAll(); - foreach ($result as $row) { - if (!empty($row->sourceid1) && !empty($row->destid1)) { - $material_map[$row->sourceid1] = $row->destid1; - } - } - - // Build a map of v2 log IDs to their expected v2 material term IDs. - $v2_log_materials = []; - foreach ($v1_log_materials as $v1_log_id => $v1_tids) { - foreach ($v1_tids as $v1_tid) { - $v2_log_materials[$log_map[$v1_log_id]][] = $material_map[$v1_tid]; - } - } - - // Save maps to the sandbox for future iterations. - $sandbox['log_map'] = $log_map; - $sandbox['material_map'] = $material_map; - $sandbox['v1_log_materials'] = $v1_log_materials; - $sandbox['v2_log_materials'] = $v2_log_materials; - - // Keep track of which logs are skipped. - // In some situations, we need to be careful about our assumptions, and - // err on the side of caution. Things may have changed since the migration, - // so we'll look for a few hints and skip the log if there is any doubt. - $sandbox['skipped_logs'] = []; - - // Track progress. - $sandbox['current_log'] = 0; - $sandbox['#finished'] = 0; + // Uninstall the migrate_drupal module. + if (\Drupal::service('module_handler')->moduleExists('migrate_drupal')) { + \Drupal::service('module_installer')->uninstall(['migrate_drupal']); } - - // Iterate over logs, 10 at a time. - $log_ids = array_values($sandbox['log_map']); - $log_count = count($log_ids); - $end_log = $sandbox['current_log'] + 10; - $end_log = $end_log > $log_count ? $log_count : $end_log; - for ($i = $sandbox['current_log']; $i < $end_log; $i++) { - - // Iterate the global counter. - $sandbox['current_log']++; - - // Load the log. - $id = $log_ids[$i]; - $log = \Drupal::service('entity_type.manager')->getStorage('log')->load($id); - - // If the log didn't load, throw an update exception. - if (empty($log)) { - throw new UpdateException('Could not load log. ID: @id', ['@id' => $id]); - } - - // Load log quantities and filter out all but material quantities. - /** @var \Drupal\quantity\Entity\QuantityInterface[] $quantities */ - $quantities = $log->get('quantity')->referencedEntities(); - /** @var \Drupal\quantity\Entity\QuantityInterface[] $material_quantities */ - $material_quantities = array_filter($quantities, function ($quantity) { - return $quantity->bundle() == 'material'; - }); - - // If the number of material quantities does not match the number of - // material terms that were referenced on the v1 log, skip the log. - if (count($material_quantities) != count($sandbox['v1_log_materials'][$id])) { - $sandbox['skipped_logs'][] = $id; - continue; - } - - // Iterate over the material quantities and perform some rough checks to be - // confident that this log has not been touched since migration. If there is - // any doubt, we skip it. - foreach ($material_quantities as $quantity) { - - // If the quantity label, value, or units are not empty, skip the log. - // Material quantities created by the migration ONLY fill in the material - // term reference. If any other quantity fields are filled it, it would - // indicate that this quantity has been edited by the user afterwards. - // If this is the case we can't be sure we know what the term should be. - if (!($quantity->get('label')->isEmpty() && $quantity->get('value')->isEmpty() && $quantity->get('units')->isEmpty())) { - $sandbox['skipped_logs'][] = $id; - continue 2; - } - - // Load the referenced material term. If empty, skip the log. - $material_term = $quantity->get('material_type')->referencedEntities()[0]; - if (empty($material_term)) { - $sandbox['skipped_logs'][] = $id; - continue 2; - } - - // If the term is not in the list of expected terms, skip the log. - if (!in_array($material_term->id(), $sandbox['v2_log_materials'][$id])) { - $sandbox['skipped_logs'][] = $id; - continue 2; - } - } - - // Now that we are confident that we can proceed, iterate over the material - // quantities again. This time we will update them. We do this in a - // separate loop to ensure that we only start updating quantities when we - // are sure all of them passed the tests above. - // Keep track of which quantities get updated, and the delta order. - $quantities_updated = []; - $delta = 0; - foreach ($material_quantities as $quantity) { - - // Load the currently referenced material term. - /** @var \Drupal\taxonomy\TermInterface $current_term */ - $current_term = $quantity->get('material_type')->referencedEntities()[0]; - - // Load the expected material term. - $expected_tid = $sandbox['v2_log_materials'][$id][$delta]; - /** @var \Drupal\taxonomy\TermInterface $expected_term */ - $expected_term = \Drupal::service('entity_type.manager')->getStorage('taxonomy_term')->load($expected_tid); - - // If the quantity's material term ID does not match the expected value, - // update it and save a new revision. - if ($current_term->id() != $expected_term->id()) { - $quantity->set('material_type', $expected_term); - $quantity->setNewRevision(TRUE); - $quantity->setRevisionLogMessage(t('Changed @old_term to @new_term. See: https://github.com/farmOS/farmOS/issues/579', ['@old_term' => $current_term->label(), '@new_term' => $expected_term->label()])); - $quantity->save(); - $quantities_updated[$quantity->id()] = $quantity; - } - - // Increment the delta. - $delta++; - } - - // If none of the quantities were updated, mark the log as skipped. - if (empty($quantities_updated)) { - $sandbox['skipped_logs'][] = $id; - continue; - } - - // Update the log's entity reference revision IDs for updated quantities. - foreach ($log->get('quantity') as $qty_ref) { - if (array_key_exists($qty_ref->target_id, $quantities_updated)) { - $qty_ref->setValue($quantities_updated[$qty_ref->target_id]); - } - } - - // Save a new revision of the log. - $log->setNewRevision(TRUE); - $log->setRevisionLogMessage(t('Automatically fixed quantity material term references. See: https://github.com/farmOS/farmOS/issues/579')); - $log->save(); - - // Declare that the log has been fixed. - \Drupal::logger('farm_migrate')->notice(t('Log @id has been fixed.', ['@id' => $id])); - } - - // Update progress. - $sandbox['#finished'] = $sandbox['current_log'] / count($sandbox['log_map']); - - // Log the list of IDs that were skipped at the end. - if ($sandbox['#finished'] == 1 && !empty($sandbox['skipped_logs'])) { - \Drupal::logger('farm_migrate')->warning(t('The following logs were skipped: @log_ids', ['@log_ids' => implode(', ', $sandbox['skipped_logs'])])); - } - return NULL; } diff --git a/modules/core/migrate/farm_migrate.services.yml b/modules/core/migrate/farm_migrate.services.yml deleted file mode 100644 index 9d850c26b..000000000 --- a/modules/core/migrate/farm_migrate.services.yml +++ /dev/null @@ -1,7 +0,0 @@ -services: - farm_migrate_event_subscriber: - class: Drupal\farm_migrate\EventSubscriber\FarmMigrationSubscriber - arguments: - [ '@database', '@datetime.time', '@entity_type.manager', '@config.factory', '@state', '@plugin.manager.migration' ] - tags: - - { name: 'event_subscriber' } diff --git a/modules/core/migrate/src/Commands/FarmMigrateCommands.php b/modules/core/migrate/src/Commands/FarmMigrateCommands.php deleted file mode 100644 index c9b739b64..000000000 --- a/modules/core/migrate/src/Commands/FarmMigrateCommands.php +++ /dev/null @@ -1,98 +0,0 @@ -executeFarmMigrations(); - } - - /** - * Rollback a 1.x data migration. - * - * @command farm_migrate:rollback - * - * @usage farm_migrate:rollback - */ - public function farmRollback() { - $this->executeFarmRollback(); - } - - /** - * Define the farmOS migration groups in the order they should be executed. - * - * @return array - * Array of migration group names. - */ - protected function farmMigrationGroups() { - return [ - 'farm_migrate_config', - 'farm_migrate_role', - 'farm_migrate_user', - 'farm_migrate_file', - 'farm_migrate_taxonomy', - 'farm_migrate_asset', - 'farm_migrate_area', - 'farm_migrate_asset_parent', - 'farm_migrate_sensor_data', - 'farm_migrate_quantity', - 'farm_migrate_log', - 'farm_migrate_plan', - ]; - } - - /** - * Executes all farmOS migrations. - * - * @throws \Exception - * If some migrations failed during execution. - */ - protected function executeFarmMigrations() { - $groups = $this->farmMigrationGroups(); - foreach ($groups as $group) { - $options = [ - 'group' => $group, - ]; - $this->logger()->notice('Importing migration group: ' . $group); - $this->import('', $options); - } - } - - /** - * Rollback all farmOS migrations. - * - * @throws \Exception - * If some rollbacks failed during execution. - */ - protected function executeFarmRollback() { - $groups = $this->farmMigrationGroups(); - $groups = array_reverse($groups); - foreach ($groups as $group) { - $options = [ - 'group' => $group, - ]; - $this->logger()->notice('Rolling back migration group: ' . $group); - $this->rollback('', $options); - } - } - -} diff --git a/modules/core/migrate/src/EventSubscriber/FarmMigrationSubscriber.php b/modules/core/migrate/src/EventSubscriber/FarmMigrationSubscriber.php deleted file mode 100644 index d3b7c2e7b..000000000 --- a/modules/core/migrate/src/EventSubscriber/FarmMigrationSubscriber.php +++ /dev/null @@ -1,543 +0,0 @@ -database = $database; - $this->time = $time; - $this->entityTypeManager = $entity_type_manager; - $this->configFactory = $config_factory; - $this->state = $state; - $this->migrationPluginManager = $migration_plugin_manager; - } - - /** - * Get subscribed events. - * - * @inheritdoc - */ - public static function getSubscribedEvents() { - $events[MigrateEvents::PRE_IMPORT][] = ['onMigratePreImport']; - $events[MigrateEvents::POST_IMPORT][] = ['onMigratePostImport']; - $events[MigrateEvents::POST_ROW_SAVE][] = ['onMigratePostRowSave']; - $events[MigrateEvents::PRE_ROW_DELETE][] = ['onMigratePreRowDelete']; - return $events; - } - - /** - * Run pre-migration logic. - * - * @param \Drupal\migrate\Event\MigrateImportEvent $event - * The import event object. - */ - public function onMigratePreImport(MigrateImportEvent $event) { - $this->unblockUsers($event); - $this->grantTextFormatPermission($event); - $this->allowPrivateFileReferencing($event); - } - - /** - * Run post-migration logic. - * - * @param \Drupal\migrate\Event\MigrateImportEvent $event - * The import event object. - */ - public function onMigratePostImport(MigrateImportEvent $event) { - $this->blockUsers($event); - $this->revokeTextFormatPermission($event); - $this->preventPrivateFileReferencing($event); - $this->addRevisionLogMessage($event); - } - - /** - * Run row post-save logic. - * - * @param \Drupal\migrate\Event\MigratePostRowSaveEvent $event - * The row save event object. - */ - public function onMigratePostRowSave(MigratePostRowSaveEvent $event) { - $this->migrateSensorListenerData($event); - } - - /** - * Run row pre-deletion logic. - * - * @param \Drupal\migrate\Event\MigrateRowDeleteEvent $event - * The row delete event object. - */ - public function onMigratePreRowDelete(MigrateRowDeleteEvent $event) { - $this->deleteAssetParentReferences($event); - $this->deleteLogQuantityReferences($event); - $this->deleteTermParentReferences($event); - $this->deletePlantTypeCompanionReferences($event); - $this->deleteSensorDataStreamReferences($event); - } - - /** - * Unblock users that were blocked in the 1.x instance. - * - * @param \Drupal\migrate\Event\MigrateImportEvent $event - * The import event object. - */ - public function unblockUsers(MigrateImportEvent $event) { - - // When records are migrated, Drupal will switch to the user that created - // them in order to perform validation. If that user was blocked, then it - // the record will not validate, and will not be migrated. To work around - // this we will temporarily unblock all users, and then block them again - // after the migration finishes. We use Drupal's state system to remember - // which users need to be blocked. - // @see blockUsers() - $migration = $event->getMigration(); - if ($migration->migration_group == 'farm_migrate_user') { - return; - } - $user_settings = $this->configFactory->getEditable('user.settings'); - $status_activated = $user_settings->get('notify.status_activated'); - $user_settings->set('notify.status_activated', FALSE)->save(); - $storage = $this->entityTypeManager->getStorage('user'); - $user_ids = $storage->getQuery()->condition('status', FALSE)->accessCheck(FALSE)->execute(); - $this->state->set('farm_migrate_blocked_users', $user_ids); - foreach ($user_ids as $id) { - if (!empty($id)) { - $user = $storage->load($id); - $user->activate(); - $user->save(); - } - } - $user_settings->set('notify.status_activated', $status_activated)->save(); - } - - /** - * Block users that were unblocked via unblockUsers(). - * - * @param \Drupal\migrate\Event\MigrateImportEvent $event - * The import event object. - */ - public function blockUsers(MigrateImportEvent $event) { - - // Block users that were temporarily unblocked. - // @see unblockUsers() - $migration = $event->getMigration(); - if ($migration->migration_group == 'farm_migrate_user') { - return; - } - $storage = $this->entityTypeManager->getStorage('user'); - $user_ids = $this->state->get('farm_migrate_blocked_users', []); - foreach ($user_ids as $id) { - if (!empty($id)) { - $user = $storage->load($id); - $user->block(); - $user->save(); - } - } - $this->state->delete('farm_migrate_blocked_users'); - } - - /** - * Grant default text format permission to anonymous role. - * - * @param \Drupal\migrate\Event\MigrateImportEvent $event - * The import event object. - */ - public function grantTextFormatPermission(MigrateImportEvent $event) { - - // If the migration is in the farm_migrate_taxonomy migration group, - // grant the 'use text format default' permission to anonymous role. - // This allows entity validation to pass even when the migration is run - // via Drush (which runs as the anonymous user). The permission is revoked - // in post-migration. - // @see revokeTextFormatPermission() - $migration = $event->getMigration(); - if (isset($migration->migration_group) && $migration->migration_group == 'farm_migrate_taxonomy') { - $storage = $this->entityTypeManager->getStorage('user_role'); - $anonymous = $storage->load('anonymous'); - $anonymous->grantPermission('use text format default'); - $anonymous->save(); - } - } - - /** - * Revoke default text format permission from anonymous role. - * - * @param \Drupal\migrate\Event\MigrateImportEvent $event - * The import event object. - */ - public function revokeTextFormatPermission(MigrateImportEvent $event) { - - // If the migration is in the farm_migrate_taxonomy migration group, - // revoke the 'use text format default' permission to anonymous role. - // This permission was added in pre-migration. - // @see grantTextFormatPermission() - $migration = $event->getMigration(); - if (isset($migration->migration_group) && $migration->migration_group == 'farm_migrate_taxonomy') { - $storage = $this->entityTypeManager->getStorage('user_role'); - $anonymous = $storage->load('anonymous'); - $anonymous->revokePermission('use text format default'); - $anonymous->save(); - } - } - - /** - * Temporarily allow private files to be referenced by entities. - * - * @param \Drupal\migrate\Event\MigrateImportEvent $event - * The import event object. - */ - public function allowPrivateFileReferencing(MigrateImportEvent $event) { - - // During farmOS 1.x -> 2.x migrations, Drupal's FileAccessControlHandler - // will not allow file entities to be referenced unless they were originally - // uploaded by the same user that created the entity that references them. - // In farmOS, it is common for an entity to be created by one user, and - // photos to be uploaded to it later by a different user. With entity - // validation enabled on the migration, this throws a validation error and - // doesn't allow the file to be referenced. - // We work around this by setting a Drupal state variable during our - // migrations, and check for it in hook_ENTITY_TYPE_access(), so we can - // explicitly grant access to the files. - // This state is removed post-migration. - // @see \Drupal\file\FileAccessControlHandler - // @see farm_migrate_file_access() - // @see preventPrivateFileReferencing() - $migration_groups = [ - 'farm_migrate_area', - 'farm_migrate_asset', - 'farm_migrate_log', - 'farm_migrate_plan', - 'farm_migrate_taxonomy', - ]; - $migration = $event->getMigration(); - if (isset($migration->migration_group) && in_array($migration->migration_group, $migration_groups)) { - $this->state->set('farm_migrate_allow_file_referencing', TRUE); - } - } - - /** - * Prevent private files from being referenced by entities. - * - * @param \Drupal\migrate\Event\MigrateImportEvent $event - * The import event object. - */ - public function preventPrivateFileReferencing(MigrateImportEvent $event) { - - // Unset the Drupal state variable that was set to temporarily allow private - // files to be referenced by entities. - // @see farm_migrate_file_access() - // @see allowPrivateFileReferencing() - $this->state->delete('farm_migrate_allow_file_referencing'); - } - - /** - * Add a revision log message to imported entities. - * - * @param \Drupal\migrate\Event\MigrateImportEvent $event - * The import event object. - */ - public function addRevisionLogMessage(MigrateImportEvent $event) { - - // Define the migration groups that we will post-process and their - // corresponding entity revision tables. - $groups_revision_tables = [ - 'farm_migrate_asset' => 'asset_revision', - 'farm_migrate_area' => 'asset_revision', - 'farm_migrate_log' => 'log_revision', - 'farm_migrate_plan' => 'plan_revision', - 'farm_migrate_quantity' => 'quantity_revision', - 'farm_migrate_taxonomy' => 'taxonomy_term_revision', - ]; - $migration = $event->getMigration(); - if (isset($migration->migration_group) && array_key_exists($migration->migration_group, $groups_revision_tables)) { - - // Define the entity id column name. This will be "id" in all cases - // except taxonomy_terms, which use "tid". - $id_column = 'id'; - if ($migration->migration_group == 'farm_migrate_taxonomy') { - $id_column = 'tid'; - } - - // Build a query to set the revision log message. - $revision_table = $groups_revision_tables[$migration->migration_group]; - $migration_id = $migration->id(); - $query = "UPDATE {$revision_table} - SET revision_log_message = :revision_log_message - WHERE revision_id IN ( - SELECT r.revision_id - FROM {migrate_map_$migration_id} mm - INNER JOIN {$revision_table} r ON mm.destid1 = r.$id_column - )"; - $args = [ - ':revision_log_message' => 'Migrated from farmOS 1.x on ' . date('Y-m-d', $this->time->getRequestTime()), - ]; - $this->database->query($query, $args); - } - } - - /** - * Migrate sensor listener data. - * - * @param \Drupal\migrate\Event\MigratePostRowSaveEvent $event - * The post row save migrate event. - */ - public function migrateSensorListenerData(MigratePostRowSaveEvent $event) { - - $migration = $event->getMigration(); - $migration_id = $migration->id(); - - // Migrate listener sensor data for each data stream. - if ($migration_id === "farm_migrate_sensor_listener_data_streams") { - - // Get values to identify the source data. - $migration_row = $event->getRow(); - $source_id = $migration_row->getSourceProperty('id'); - $source_name = $migration_row->getSourceProperty('name'); - - // Get the destination data stream ID. - $destination_id = $event->getDestinationIdValues()[0]; - - // Query the source for data. Override the ID field that is returned with - // each row to be the ID of the migrated data stream. - $query = "SELECT :id as id, timestamp, value_numerator, value_denominator - FROM {farm_sensor_data} fsd - WHERE fsd.id = :sensor_id and fsd.name = :name - "; - $args = [ - 'id' => $destination_id, - 'sensor_id' => $source_id, - 'name' => $source_name, - ]; - $source_db = Database::getConnection('default', 'migrate'); - $source_data = $source_db->query($query, $args); - $source_data->setFetchMode(\PDO::FETCH_ASSOC); - - // Start an insert statement. - $insert = $this->database->insert('data_stream_basic') - ->fields(['id', 'timestamp', 'value_numerator', 'value_denominator']); - - // Loop through the source data and insert in batches. - $batch_size = 10000; - $count = 0; - foreach ($source_data as $data) { - $insert->values($data); - $count++; - if ($count >= $batch_size) { - $insert->execute(); - $count = 0; - $insert = $this->database->insert('data_stream_basic') - ->fields(['id', 'timestamp', 'value_numerator', 'value_denominator']); - } - } - $insert->execute(); - } - } - - /** - * Delete references to quantities from logs. - * - * @param \Drupal\migrate\Event\MigrateRowDeleteEvent $event - * The row delete event object. - */ - public function deleteLogQuantityReferences(MigrateRowDeleteEvent $event) { - - // If the migration is in the farm_migrate_log migration group, delete all - // references to quantity entities from the log that is being deleted. - // This prevents the quantity entity itself from being deleted by - // LogEventSubscriber in the farm_log_quantity module. - // We limit this to quantities that were created via migrations in the - // farm_migrate_quantity migration group to ensure that quantities created - // via the create_quantity process plugin can be deleted normally with logs. - // @see \Drupal\farm_log_quantity\EventSubscriber\LogEventSubscriber - $migration = $event->getMigration(); - if (isset($migration->migration_group) && $migration->migration_group == 'farm_migrate_log') { - $id_values = $event->getDestinationIdValues(); - if (!empty($id_values['id'])) { - $migration_plugins = $this->migrationPluginManager->createInstances([]); - foreach ($migration_plugins as $migration_id => $migration_plugin) { - if (isset($migration_plugin->migration_group) && $migration_plugin->migration_group == 'farm_migrate_quantity') { - $table = 'migrate_map_' . $migration_id; - $this->database->query('DELETE FROM {log__quantity} WHERE entity_id = :id AND quantity_target_id IN (SELECT destid1 FROM ' . $table . ')', [':id' => $id_values['id']]); - $this->database->query('DELETE FROM {log_revision__quantity} WHERE entity_id = :id AND quantity_target_id IN (SELECT destid1 FROM ' . $table . ')', [':id' => $id_values['id']]); - } - } - } - } - } - - /** - * Delete parent references from assets. - * - * @param \Drupal\migrate\Event\MigrateRowDeleteEvent $event - * The row delete event object. - */ - public function deleteAssetParentReferences(MigrateRowDeleteEvent $event) { - - // If the migration is in the farm_migrate_asset or farm_migrate_area - // migration groups, delete all parent references to the destination asset. - // This is necessary because the field is populated by migrations in the - // farm_migrate_asset_parent group, which ONLY set the parent field on - // existing assets, and rolling back those migrations does not remove the - // parent references. This causes entity reference integrity constraint - // errors if an attempt is made to roll back assets that are referenced as - // parents. - $migration = $event->getMigration(); - if (isset($migration->migration_group) && in_array($migration->migration_group, ['farm_migrate_asset', 'farm_migrate_area'])) { - $id_values = $event->getDestinationIdValues(); - if (!empty($id_values['id'])) { - $this->database->query('DELETE FROM {asset__parent} WHERE parent_target_id = :id', [':id' => $id_values['id']]); - $this->database->query('DELETE FROM {asset_revision__parent} WHERE parent_target_id = :id', [':id' => $id_values['id']]); - } - } - } - - /** - * Delete parent references to taxonomy pterms. - * - * @param \Drupal\migrate\Event\MigrateRowDeleteEvent $event - * The row delete event object. - */ - public function deleteTermParentReferences(MigrateRowDeleteEvent $event) { - - // If the migration is in the farm_migrate_taxonomy migration group, delete - // all parent references to the destination term. - // This is necessary to prevent entity reference integrity constraint errors - // if an attempt is made to roll back terms that are referenced as parents. - $migration = $event->getMigration(); - if (isset($migration->migration_group) && $migration->migration_group == 'farm_migrate_taxonomy') { - $id_values = $event->getDestinationIdValues(); - if (!empty($id_values['tid'])) { - $this->database->query('DELETE FROM {taxonomy_term__parent} WHERE parent_target_id = :tid', [':tid' => $id_values['tid']]); - $this->database->query('DELETE FROM {taxonomy_term_revision__parent} WHERE parent_target_id = :tid', [':tid' => $id_values['tid']]); - } - } - } - - /** - * Delete companion references to plant type terms. - * - * @param \Drupal\migrate\Event\MigrateRowDeleteEvent $event - * The row delete event object. - */ - public function deletePlantTypeCompanionReferences(MigrateRowDeleteEvent $event) { - - // If this is the farm_migrate_taxonomy_plant_type migration, delete all - // companion references to the destination term. - // This is necessary to prevent entity reference integrity constraint errors - // if an attempt is made to roll back terms that are referenced as - // companions. - $migration = $event->getMigration(); - if ($migration->id() == 'farm_migrate_taxonomy_plant_type') { - $id_values = $event->getDestinationIdValues(); - if (!empty($id_values['tid'])) { - $this->database->query('DELETE FROM {taxonomy_term__companions} WHERE companions_target_id = :tid', [':tid' => $id_values['tid']]); - $this->database->query('DELETE FROM {taxonomy_term_revision__companions} WHERE companions_target_id = :tid', [':tid' => $id_values['tid']]); - } - } - } - - /** - * Delete data stream references from sensor assets. - * - * @param \Drupal\migrate\Event\MigrateRowDeleteEvent $event - * The row delete event object. - */ - public function deleteSensorDataStreamReferences(MigrateRowDeleteEvent $event) { - - // If this is the farm_migrate_sensor_listener_data_streams migration, - // delete all references to the destination data_stream from sensor assets. - // This is necessary to prevent entity reference integrity constraint errors - // if an attempt is made to roll back data_streams that are referenced by - // sensor assets. During migration, these references are created by the - // DataStream migrate destination plugin, so they will be recreated if this - // migration is imported again after rollback. - // @see \Drupal\data_stream\Plugin\migrate\destination\DataStream - $migration = $event->getMigration(); - if ($migration->id() == 'farm_migrate_sensor_listener_data_streams') { - $id_values = $event->getDestinationIdValues(); - if (!empty($id_values['id'])) { - $this->database->query('DELETE FROM {asset__data_stream} WHERE data_stream_target_id = :id', [':id' => $id_values['id']]); - $this->database->query('DELETE FROM {asset_revision__data_stream} WHERE data_stream_target_id = :id', [':id' => $id_values['id']]); - } - } - } - -} diff --git a/modules/core/migrate/src/Plugin/migrate/process/FarmMigrateGetLab.php b/modules/core/migrate/src/Plugin/migrate/process/FarmMigrateGetLab.php deleted file mode 100644 index 050c61cbb..000000000 --- a/modules/core/migrate/src/Plugin/migrate/process/FarmMigrateGetLab.php +++ /dev/null @@ -1,42 +0,0 @@ -get('field_farm_soil_lab'); - - // If that failed, try to get a water lab. - if (empty($lab)) { - $lab = $row->get('field_farm_water_lab'); - } - - // If a lab was found, return it. - if (!empty($lab[0]['value'])) { - return $lab[0]['value']; - } - return ''; - } - -} diff --git a/modules/core/migrate/src/Plugin/migrate/process/FarmMigrationGroupLookup.php b/modules/core/migrate/src/Plugin/migrate/process/FarmMigrationGroupLookup.php deleted file mode 100644 index 0543bf76a..000000000 --- a/modules/core/migrate/src/Plugin/migrate/process/FarmMigrationGroupLookup.php +++ /dev/null @@ -1,115 +0,0 @@ -migrationPluginManager = $migation_plugin_manager; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $migration, - $container->get('migrate.lookup'), - $container->get('migrate.stub'), - $container->get('plugin.manager.migration'), - ); - } - - /** - * {@inheritdoc} - */ - public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { - - // Get the migration group ID from the process configuration. - $lookup_migration_group_id = $this->configuration['migration_group']; - - // Load all migrations. - $migrations = $this->migrationPluginManager->createInstances([]); - - // Filter by group. - $group_migrations = []; - foreach ($migrations as $id => $migration) { - $definition = $migration->getPluginDefinition(); - if ($definition['migration_group'] == $lookup_migration_group_id) { - $group_migrations[] = $id; - } - } - - // Set the migration configuration and delegate processing to the parent - // MigrationLookup::transform() method. - $this->configuration['migration'] = $group_migrations; - return parent::transform($value, $migrate_executable, $row, $destination_property); - } - -} diff --git a/modules/core/migrate/src/Plugin/migrate/process/SkipMapOnEmpty.php b/modules/core/migrate/src/Plugin/migrate/process/SkipMapOnEmpty.php deleted file mode 100644 index 0b98c7a27..000000000 --- a/modules/core/migrate/src/Plugin/migrate/process/SkipMapOnEmpty.php +++ /dev/null @@ -1,40 +0,0 @@ -configuration['message']) ? $this->configuration['message'] : ''; - throw new MigrateSkipRowException($message, FALSE); - } - return $value; - } - -} diff --git a/modules/core/migrate/src/Plugin/migrate/source/d7/AnimalAsset.php b/modules/core/migrate/src/Plugin/migrate/source/d7/AnimalAsset.php deleted file mode 100644 index 2c7baacf4..000000000 --- a/modules/core/migrate/src/Plugin/migrate/source/d7/AnimalAsset.php +++ /dev/null @@ -1,71 +0,0 @@ -getSourceProperty('id'); - - // Get animal tag field values. - $animal_tag_values = $this->getFieldValues('farm_asset', 'field_farm_animal_tag', $id); - - // Iterate through tag field values to collect field collection item IDs. - $field_collection_item_ids = []; - foreach ($animal_tag_values as $animal_tag_value) { - if (!empty($animal_tag_value['value'])) { - $field_collection_item_ids[] = $animal_tag_value['value']; - } - } - - // Iterate through the field collection IDs and load values. - $animal_tags = []; - foreach ($field_collection_item_ids as $item_id) { - - // Query the animal tag information from the field collection. - $query = $this->select('field_collection_item', 'fci') - ->condition('fci.item_id', $item_id) - ->condition('fci.field_name', 'field_farm_animal_tag'); - - // Join the tag ID field. - $query->leftJoin('field_data_field_farm_animal_tag_id', 'fdffati', 'fdffati.entity_id = fci.item_id AND fdffati.deleted = 0'); - $query->addField('fdffati', 'field_farm_animal_tag_id_value', 'id'); - - // Join the tag type field. - $query->leftJoin('field_data_field_farm_animal_tag_type', 'fdffatt', 'fdffatt.entity_id = fci.item_id AND fdffatt.deleted = 0'); - $query->addField('fdffatt', 'field_farm_animal_tag_type_value', 'type'); - - // Join the tag location field. - $query->leftJoin('field_data_field_farm_animal_tag_location', 'fdffatl', 'fdffatl.entity_id = fci.item_id AND fdffatl.deleted = 0'); - $query->addField('fdffatl', 'field_farm_animal_tag_location_value', 'location'); - - // Execute the query. - $animal_tags[] = $query->execute()->fetchAssoc(); - } - - // Add the ID tags to the row for future processing. - $row->setSourceProperty('animal_tags', $animal_tags); - - return parent::prepareRow($row); - } - -} diff --git a/modules/core/migrate/src/Plugin/migrate/source/d7/FarmArea.php b/modules/core/migrate/src/Plugin/migrate/source/d7/FarmArea.php deleted file mode 100644 index 672bb126d..000000000 --- a/modules/core/migrate/src/Plugin/migrate/source/d7/FarmArea.php +++ /dev/null @@ -1,52 +0,0 @@ -configuration['bundle'] = 'farm_areas'; - - // Get the parent class query. - $query = parent::query(); - - // Join the "area type" field. - $query->leftJoin('field_data_field_farm_area_type', 'fdffat', 'td.tid = fdffat.entity_id AND fdffat.deleted = 0'); - - // If "area_type" is defined, filter by field_farm_area_type. - if (!empty($this->configuration['area_type'])) { - - // If "area_type" is "any", don't filter. - if ($this->configuration['area_type'] != 'any') { - $query->condition('fdffat.field_farm_area_type_value', (array) $this->configuration['area_type'], 'IN'); - } - } - - // Otherwise, filter by field_farm_area_type IS NULL. - else { - $query->isNull('fdffat.field_farm_area_type_value'); - } - - return $query; - } - -} diff --git a/modules/core/migrate/src/Plugin/migrate/source/d7/FarmAsset.php b/modules/core/migrate/src/Plugin/migrate/source/d7/FarmAsset.php deleted file mode 100644 index 10e219a71..000000000 --- a/modules/core/migrate/src/Plugin/migrate/source/d7/FarmAsset.php +++ /dev/null @@ -1,44 +0,0 @@ -prepareQuickEntityRow($row, 'asset'); - - // Return success. - return TRUE; - } - -} diff --git a/modules/core/migrate/src/Plugin/migrate/source/d7/FarmLog.php b/modules/core/migrate/src/Plugin/migrate/source/d7/FarmLog.php deleted file mode 100644 index b71455343..000000000 --- a/modules/core/migrate/src/Plugin/migrate/source/d7/FarmLog.php +++ /dev/null @@ -1,330 +0,0 @@ -prepareMovement($row); - - // Prepare group assignment information. - $this->prepareGroup($row); - - // Prepare quantity information. - $this->prepareQuantity($row); - - // Prepare soil test information (only applicable to soil test logs). - $this->prepareSoilTest($row); - - // Prepare reference to the quick form that created this entity. - $this->prepareQuickEntityRow($row, 'log'); - - // Return success. - return TRUE; - } - - /** - * Prepare a log's movement information. - * - * @param \Drupal\migrate\Row $row - * The row object. - */ - protected function prepareMovement(Row $row) { - $id = $row->getSourceProperty('id'); - - // Determine if we will allow overwriting "Areas" and "Geometry" fields on - // the log with "Move to" and "Movement geometry" fields. - $allow_overwrite = Settings::get('farm_migrate_allow_movement_overwrite', FALSE); - - // By default, logs are not movements. - $is_movement = FALSE; - - // Get movement field values. - $movement_values = $this->getFieldValues('log', 'field_farm_movement', $id); - - // If the log has a movement, load the Field Collection. - if (!empty($movement_values)) { - - // Iterate through movement field values to collect field collection item - // IDs. - $field_collection_item_ids = []; - foreach ($movement_values as $movement_value) { - if (!empty($movement_value['value'])) { - $field_collection_item_ids[] = $movement_value['value']; - } - } - - // There should only be one movement field collection associated with a - // log, so take the first. - $fcid = reset($field_collection_item_ids); - - // Query the movement area references. - $query = $this->select('field_collection_item', 'fci'); - $query->leftJoin('field_data_field_farm_move_to', 'fdffmt', "fdffmt.entity_id = fci.item_id AND fdffmt.entity_type = 'field_collection_item' AND fdffmt.bundle = 'field_farm_movement' AND fdffmt.deleted = 0"); - $query->addField('fdffmt', 'field_farm_move_to_tid', 'tid'); - $query->condition('fci.item_id', $fcid); - $result = $query->execute()->fetchCol(); - $movement_areas = FALSE; - if (!empty($result)) { - foreach ($result as $col) { - if (!empty($col)) { - $movement_areas[] = ['tid' => $col]; - } - } - } - - // Query the movement geometry. - $query = $this->select('field_collection_item', 'fci'); - $query->leftJoin('field_data_field_farm_geofield', 'fdffg', "fdffg.entity_id = fci.item_id AND fdffg.entity_type = 'field_collection_item' AND fdffg.bundle = 'field_farm_movement' AND fdffg.deleted = 0"); - $query->addField('fdffg', 'field_farm_geofield_geom', 'geom'); - $query->condition('fci.item_id', $fcid); - $result = $query->execute()->fetchField(); - $movement_geometry = FALSE; - if (!empty($result)) { - $movement_geometry = [['geom' => $result]]; - } - - // Get any areas/geometry stored on the log itself. - $log_areas = $this->getFieldValues('log', 'field_farm_area', $id); - $log_geometry = $this->getFieldValues('log', 'field_farm_geofield', $id); - - // If the log has movement areas, then the log is a movement. - if (!empty($movement_areas)) { - $is_movement = TRUE; - } - - // If the log has a movement geometry, but no movement areas, throw an - // exception. - if (empty($movement_areas) && !empty($movement_geometry)) { - $message = 'Movement has a geometry but no areas (log ' . $id . ').'; - $this->idMap->saveMessage(['id' => $id], $message, MigrationInterface::MESSAGE_WARNING); - } - - // If the log has area references and movement areas, and they are - // different, throw an exception or print a warning, depending on whether - // or not we are allowing overwrites. - if (!empty($log_areas) && !empty($movement_areas) && $log_areas != $movement_areas) { - $message = 'Log ' . $id . ' has both area references and movement area references. See https://github.com/farmOS/farmOS/blob/2.x/docs/hosting/migration.md#movement-logs'; - if (!$allow_overwrite) { - throw new MigrateException($message); - } - else { - $this->idMap->saveMessage(['id' => $id], $message, MigrationInterface::MESSAGE_WARNING); - } - } - - // If the log has a geometry and a movement geometry, and they are - // different, throw an exception or print a warning, depending on whether - // or not we are allowing overwrites. - if (!empty($log_geometry[0]['geom']) && !empty($movement_geometry[0]['geom']) && $log_geometry[0]['geom'] != $movement_geometry[0]['geom']) { - $message = 'Log ' . $id . ' has both a geometry and a movement geometry. See https://github.com/farmOS/farmOS/blob/2.x/docs/hosting/migration.md#movement-logs'; - if (!$allow_overwrite) { - throw new MigrateException($message); - } - else { - $this->idMap->saveMessage(['id' => $id], $message, MigrationInterface::MESSAGE_WARNING); - } - } - - // If the log has movement areas, copy them to the log itself. - // This will overwrite existing area references, but an exception should - // be thrown above unless overwriting is explicitly allowed. - if (!empty($movement_areas)) { - $row->setSourceProperty('field_farm_area', $movement_areas); - } - - // If the log has a movement geometry, copy it to the log itself. - // This will overwrite an existing geometry, but an exception should - // be thrown above unless overwriting is explicitly allowed. - if (!empty($movement_geometry)) { - $row->setSourceProperty('field_farm_geofield', $movement_geometry); - } - } - - // Set the "is_movement" property for use in migrations. - $row->setSourceProperty('is_movement', $is_movement); - } - - /** - * Prepare a log's group assignment information. - * - * @param \Drupal\migrate\Row $row - * The row object. - */ - protected function prepareGroup(Row $row) { - $id = $row->getSourceProperty('id'); - - // By default, logs are not group assignments. - $is_group_assignment = FALSE; - - // Get membership field values. - $membership_values = $this->getFieldValues('log', 'field_farm_membership', $id); - - // If the log has a membership assignment, load the Field Collection. - if (!empty($membership_values)) { - - // Iterate through membership field values to collect field collection - // item IDs. - $field_collection_item_ids = []; - foreach ($membership_values as $membership_value) { - if (!empty($membership_value['value'])) { - $field_collection_item_ids[] = $membership_value['value']; - } - } - - // There should only be one membership field collection associated with a - // log, so take the first. - $fcid = reset($field_collection_item_ids); - - // Query the membership group references. - $query = $this->select('field_collection_item', 'fci'); - $query->leftJoin('field_data_field_farm_group', 'fdffg', "fdffg.entity_id = fci.item_id AND fdffg.entity_type = 'field_collection_item' AND fdffg.bundle = 'field_farm_membership' AND fdffg.deleted = 0"); - $query->addField('fdffg', 'field_farm_group_target_id', 'target_id'); - $query->condition('fci.item_id', $fcid); - $result = $query->execute()->fetchCol(); - $membership_groups = FALSE; - if (!empty($result)) { - foreach ($result as $col) { - if (!empty($col)) { - $membership_groups[] = ['target_id' => $col]; - } - } - } - - // If the log has membership groups, then the log is a group assignment. - if (!empty($membership_groups)) { - $is_group_assignment = TRUE; - } - - // If the log has membership groups, store them in property on the log so - // they can be processed during migration. - if (!empty($membership_groups)) { - $row->setSourceProperty('log_groups', $membership_groups); - } - } - - // Set the "is_group_assignment" property for use in migrations. - $row->setSourceProperty('is_group_assignment', $is_group_assignment); - } - - /** - * Prepare a log's quantity information. - * - * @param \Drupal\migrate\Row $row - * The row object. - */ - protected function prepareQuantity(Row $row) { - $id = $row->getSourceProperty('id'); - - // Get field collections to migrate to log quantities. - $log_quantities = $this->getFieldvalues('log', 'field_farm_quantity', $id); - $log_inventories = $this->getFieldvalues('log', 'field_farm_inventory', $id); - - // Iterate through field collection values to collect field collection IDs. - $quantity_ids = []; - foreach (array_merge($log_quantities, $log_inventories) as $field_collection) { - if (!empty($field_collection['value'])) { - $quantity_ids[] = $field_collection['value']; - } - } - - // Add the quantity IDs to the row for future processing. - $row->setSourceProperty('log_quantities', $quantity_ids); - } - - /** - * Prepare a log's soil test information. - * - * @param \Drupal\migrate\Row $row - * The row object. - */ - protected function prepareSoilTest(Row $row) { - $id = $row->getSourceProperty('id'); - - // Get referenced soil name term IDs. - $soil_name_tids = []; - foreach ($this->getFieldvalues('log', 'field_farm_soil_names', $id) as $value) { - if (!empty($value['tid'])) { - $soil_name_tids[] = $value['tid']; - } - } - - // If no soil names are referenced, bail. - if (empty($soil_name_tids)) { - return; - } - - // Look up the term names. - $query = $this->select('taxonomy_term_data', 't'); - $query->addField('t', 'name'); - $query->condition('t.tid', $soil_name_tids, 'IN'); - $result = $query->execute()->fetchCol(); - $soil_names = []; - if (!empty($result)) { - foreach ($result as $col) { - if (!empty($col)) { - $soil_names[] = $col; - } - } - } - - // If there are no names, bail. - if (empty($soil_names)) { - return; - } - - // Create a string that summarizes the soil names. If there are multiple, - // separate with newlines. - if (count($soil_names) == 1) { - $summary = $this->t('Soil name: @name', ['@name' => $soil_names[0]]); - } - else { - $summary = $this->t("Soil names:\n@names", ['@names' => implode("\n", $soil_names)]); - } - - // The names are going to be appended to the log's Notes field, but we want - // to make sure that whitespace is added if there is already data in the - // Notes field. - $notes = $this->getFieldvalues('log', 'field_farm_notes', $id); - if (!empty($notes)) { - $summary = "\n\n" . $summary; - } - - // Add the soil name summary to the row for future processing. - $row->setSourceProperty('soil_name_summary', $summary); - } - -} diff --git a/modules/core/migrate/src/Plugin/migrate/source/d7/Inventory.php b/modules/core/migrate/src/Plugin/migrate/source/d7/Inventory.php deleted file mode 100644 index 55136503e..000000000 --- a/modules/core/migrate/src/Plugin/migrate/source/d7/Inventory.php +++ /dev/null @@ -1,81 +0,0 @@ -select('field_collection_item', 'fci'); - $query->addField('fci', 'item_id', 'id'); - - // Join in the numerator and denominator values. - $query->leftJoin('field_data_field_farm_inventory_value', 'fdffiv', - "fci.item_id = fdffiv.entity_id AND fdffiv.entity_type = 'field_collection_item' AND fdffiv.bundle = 'field_farm_inventory' AND fdffiv.deleted = '0'"); - $query->addField('fdffiv', 'field_farm_inventory_value_numerator', 'value_numerator'); - $query->addField('fdffiv', 'field_farm_inventory_value_denominator', 'value_denominator'); - $query->addExpression('SIGN(fdffiv.field_farm_inventory_value_numerator)', 'inventory_value_sign'); - - // Join in the inventory asset reference. - $query->leftJoin('field_data_field_farm_inventory_asset', 'fdffia', - "fci.item_id = fdffia.entity_id AND fdffia.entity_type = 'field_collection_item' AND fdffia.bundle = 'field_farm_inventory' AND fdffia.deleted = '0'"); - $query->addField('fdffia', 'field_farm_inventory_asset_target_id', 'inventory_asset'); - - // Join in the log table to get the uid. - $query->leftJoin('field_data_field_farm_inventory', 'fdffi', 'fci.item_id = fdffi.field_farm_inventory_value'); - $query->leftJoin('log', 'l', "fdffi.entity_type = 'log' AND fdffi.entity_id = l.id"); - $query->addField('l', 'uid'); - - // Ensure we don't include archived/deleted fields. - $query->condition('fci.archived', '0'); - $query->condition('fdffi.deleted', '0'); - - // Distinct items only. - $query->distinct(); - - // Order by item_id. - $query->orderBy('fci.item_id'); - - return $query; - } - - /** - * {@inheritdoc} - */ - public function fields() { - $fields = [ - 'id' => $this->t('The inventory item ID.'), - 'value_numerator' => $this->t('The inventory value numerator.'), - 'value_denominator' => $this->t('The inventory value denominator.'), - 'inventory_asset' => $this->t('The inventory asset.'), - 'inventory_value_sign' => $this->t('Thi sign of the inventory value. Used to determine increment or decrement.'), - 'uid' => $this->t('The user ID that created the inventory.'), - ]; - return $fields; - } - - /** - * {@inheritdoc} - */ - public function getIds() { - $ids['id']['type'] = 'integer'; - return $ids; - } - -} diff --git a/modules/core/migrate/src/Plugin/migrate/source/d7/Quantity.php b/modules/core/migrate/src/Plugin/migrate/source/d7/Quantity.php deleted file mode 100644 index e8d24e1b8..000000000 --- a/modules/core/migrate/src/Plugin/migrate/source/d7/Quantity.php +++ /dev/null @@ -1,91 +0,0 @@ -select('field_collection_item', 'fci'); - $query->addField('fci', 'item_id', 'id'); - - // Join in the measure value. - $query->leftJoin('field_data_field_farm_quantity_measure', 'fdffqm', - "fci.item_id = fdffqm.entity_id AND fdffqm.entity_type = 'field_collection_item' AND fdffqm.bundle = 'field_farm_quantity' AND fdffqm.deleted = '0'"); - $query->addField('fdffqm', 'field_farm_quantity_measure_value', 'measure'); - - // Join in the numerator and denominator values. - $query->leftJoin('field_data_field_farm_quantity_value', 'fdffqv', - "fci.item_id = fdffqv.entity_id AND fdffqv.entity_type = 'field_collection_item' AND fdffqv.bundle = 'field_farm_quantity' AND fdffqv.deleted = '0'"); - $query->addField('fdffqv', 'field_farm_quantity_value_numerator', 'value_numerator'); - $query->addField('fdffqv', 'field_farm_quantity_value_denominator', 'value_denominator'); - - // Join in the units value. - $query->leftJoin('field_data_field_farm_quantity_units', 'fdffqu', - "fci.item_id = fdffqu.entity_id AND fdffqu.entity_type = 'field_collection_item' AND fdffqu.bundle = 'field_farm_quantity' AND fdffqu.deleted = '0'"); - $query->addField('fdffqu', 'field_farm_quantity_units_tid', 'units'); - - // Join in the label value. - $query->leftJoin('field_data_field_farm_quantity_label', 'fdffql', - "fci.item_id = fdffql.entity_id AND fdffql.entity_type = 'field_collection_item' AND fdffql.bundle = 'field_farm_quantity' AND fdffql.deleted = '0'"); - $query->addField('fdffql', 'field_farm_quantity_label_value', 'label'); - - // Join in the log table to get the uid. - $query->leftJoin('field_data_field_farm_quantity', 'fdffq', 'fci.item_id = fdffq.field_farm_quantity_value'); - $query->leftJoin('log', 'l', "fdffq.entity_type = 'log' AND fdffq.entity_id = l.id"); - $query->addField('l', 'uid'); - - // Ensure we don't include archived/deleted fields. - $query->condition('fci.archived', '0'); - $query->condition('fdffq.deleted', '0'); - - // Distinct items only. - $query->distinct(); - - // Order by item_id. - $query->orderBy('fci.item_id'); - - return $query; - } - - /** - * {@inheritdoc} - */ - public function fields() { - $fields = [ - 'id' => $this->t('The quantity item ID.'), - 'measure' => $this->t('The quantity measure.'), - 'value_numerator' => $this->t('The quantity value numerator.'), - 'value_denominator' => $this->t('The quantity value denominator.'), - 'units' => $this->t('The quantity units.'), - 'label' => $this->t('The quantity label.'), - 'uid' => $this->t('The user ID that created the quantity.'), - ]; - return $fields; - } - - /** - * {@inheritdoc} - */ - public function getIds() { - $ids['id']['type'] = 'integer'; - return $ids; - } - -} diff --git a/modules/core/migrate/src/Plugin/migrate/source/d7/SensorAsset.php b/modules/core/migrate/src/Plugin/migrate/source/d7/SensorAsset.php deleted file mode 100644 index 70ae2dcf9..000000000 --- a/modules/core/migrate/src/Plugin/migrate/source/d7/SensorAsset.php +++ /dev/null @@ -1,77 +0,0 @@ -join('farm_sensor', 'fs', 'fa.id = fs.id'); - - // Limit by the sensor type. - if (isset($this->configuration['sensor_type'])) { - - // Specify the sensor type. - if (!empty($this->configuration['sensor_type'])) { - $query->condition('fs.type', (array) $this->configuration['sensor_type'], 'IN'); - } - - // Allow empty sensor type. - else { - $query->where("fs.type = '' OR fs.type IS NULL"); - } - } - - // Add sensor fields aliased with correct name. - $query->addField('fs', 'type', 'sensor_type'); - $query->addField('fs', 'settings', 'sensor_settings'); - - return $query; - } - - /** - * {@inheritdoc} - */ - public function prepareRow(Row $row) { - - // Get the sensor_settings field. - $settings = $row->getSourceProperty('sensor_settings'); - if (!empty($settings)) { - - // Unserialize the sensor_settings field. - $settings_array = unserialize($settings, ['allowed_classes' => FALSE]); - - // Re-set the source property value. - $row->setSourceProperty('sensor_settings', $settings_array); - } - - return parent::prepareRow($row); - } - -} diff --git a/modules/core/migrate/src/Plugin/migrate/source/d7/SensorListenerDataNames.php b/modules/core/migrate/src/Plugin/migrate/source/d7/SensorListenerDataNames.php deleted file mode 100644 index f0ae79a97..000000000 --- a/modules/core/migrate/src/Plugin/migrate/source/d7/SensorListenerDataNames.php +++ /dev/null @@ -1,56 +0,0 @@ -select('farm_sensor_data', 'fsd') - ->fields('fsd', $fields) - ->distinct() - ->orderBy('fsd.id'); - } - - /** - * {@inheritdoc} - */ - public function fields() { - $fields = [ - 'id' => $this->t('Sensor asset ID.'), - 'name' => $this->t('Sensor reading name'), - ]; - return $fields; - } - - /** - * {@inheritdoc} - */ - public function getIds() { - return [ - 'id' => ['type' => 'integer'], - 'name' => ['type' => 'string'], - ]; - } - -} diff --git a/modules/core/migrate/src/Traits/FarmQuickEntity.php b/modules/core/migrate/src/Traits/FarmQuickEntity.php deleted file mode 100644 index 5d99163e5..000000000 --- a/modules/core/migrate/src/Traits/FarmQuickEntity.php +++ /dev/null @@ -1,77 +0,0 @@ -getSourceProperty('id'); - - // Translate the 2.x entity type names to 1.x. - $old_entity_types = [ - 'asset' => 'farm_asset', - 'log' => 'log', - 'plan' => 'farm_plan', - ]; - if (array_key_exists($entity_type, $old_entity_types)) { - $entity_type = $old_entity_types[$entity_type]; - } - - // Check to see if the 1.x farm_quick module is enabled. - $query = $this->select('system', 's'); - $query->condition('s.name', 'farm_quick'); - $query->condition('s.status', 1); - $enabled = $query->countQuery()->execute()->fetchField(); - - // If the farm_quick module is enabled, look up quick form(s) that are - // linked to this entity. - if (!empty($enabled)) { - $query = $this->select('farm_quick_entity', 'fqe'); - $query->condition('entity_type', $entity_type); - $query->condition('entity_id', $id); - $query->addField('fqe', 'quick_form_id'); - $result = $query->execute()->fetchCol(); - if (!empty($result)) { - foreach ($result as $col) { - if (!empty($col)) { - $quick[] = $col; - } - } - } - } - - // Translate the 1.x quick form IDs to 2.x. - if (!empty($quick)) { - $new_quick_form_ids = []; - foreach ($quick as $delta => $form_id) { - if (array_key_exists($form_id, $new_quick_form_ids)) { - $quick[$delta] = $new_quick_form_ids[$form_id]; - } - } - } - - // Set the "quick" source property. - $row->setSourceProperty('quick', $quick); - } - -}