diff --git a/composer.json b/composer.json index 29de27fc..e8f5c333 100644 --- a/composer.json +++ b/composer.json @@ -28,6 +28,7 @@ "drupal/maillog": "dev-1.x", "drupal/mailsystem": "^4.4", "drupal/memcache": "^2.5", + "drupal/migrate_plus": "^6.0", "drupal/require_revision_log_message": "^2.0", "drupal/scheduler": "^2.0", "drupal/scheduler_content_moderation_integration": "^2.0@beta", diff --git a/composer.lock b/composer.lock index fb858f9f..bd19fcf1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "382a239fd852eefad4866b40d9046f9f", + "content-hash": "1805cf8566aef804c8330c22a3002020", "packages": [ { "name": "asm89/stack-cors", @@ -2102,6 +2102,71 @@ "issues": "https://www.drupal.org/project/issues/memcache" } }, + { + "name": "drupal/migrate_plus", + "version": "6.0.4", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/migrate_plus.git", + "reference": "6.0.4" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/migrate_plus-6.0.4.zip", + "reference": "6.0.4", + "shasum": "0357c416d2a9fd3f4211dd13c6585ed8072fabe7" + }, + "require": { + "drupal/core": ">=9.1", + "php": ">=7.4" + }, + "require-dev": { + "drupal/migrate_example_advanced_setup": "*", + "drupal/migrate_example_setup": "*" + }, + "suggest": { + "ext-soap": "*", + "sainsburys/guzzle-oauth2-plugin": "3.0 required for the OAuth2 authentication plugin" + }, + "type": "drupal-module", + "extra": { + "drupal": { + "version": "6.0.4", + "datestamp": "1721745585", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Mike Ryan", + "homepage": "https://www.drupal.org/u/mikeryan", + "role": "Maintainer" + }, + { + "name": "Lucas Hedding", + "homepage": "https://www.drupal.org/u/heddn", + "role": "Maintainer" + }, + { + "name": "mikeryan", + "homepage": "https://www.drupal.org/user/4420" + } + ], + "description": "Enhancements to core migration support.", + "homepage": "https://www.drupal.org/project/migrate_plus", + "support": { + "source": "https://git.drupalcode.org/project/migrate_plus", + "issues": "https://www.drupal.org/project/issues/migrate_plus", + "slack": "#migrate" + } + }, { "name": "drupal/require_revision_log_message", "version": "2.0.2", diff --git a/composer.log b/composer.log index 8c078dfb..ab3e5ca1 100644 --- a/composer.log +++ b/composer.log @@ -11,3 +11,4 @@ bd188b544a4fe1c3f347f6b125585b17|Matt Poole|develop|Wed Jun 12 19:49:23 EDT 2024 abe3fa91a2c15b6b571ea0c019e2daf7|Matt Poole|develop|Tue Jul 2 13:35:21 EDT 2024|./composer.sh require drupal/maillog 23ef02af0f842a216c54ec0bd469e3d1|Matt Poole|develop|Tue Jul 2 13:41:08 EDT 2024|./composer.sh require drupal/mailsystem ae2759e9c45acbf0d8378d04e842d0a8|Matt Poole|develop|Tue Jul 2 13:45:43 EDT 2024|./composer.sh require drupal/maillog:dev-1.x +bee6963c114940945ea38110d5af9e93|Matt Poole|feature/migrate-image-example|Fri Aug 2 14:40:47 EDT 2024|./composer.sh require drupal/migrate_plus diff --git a/composer.patches.json b/composer.patches.json index 82ff50fa..f6d99a17 100644 --- a/composer.patches.json +++ b/composer.patches.json @@ -4,7 +4,7 @@ "Disable drupal/core from scaffolding without being in composer.extra.drupal-scaffold.allowed-packages in that way one has more control of when new scaffolding is added.": "./patches/drupal.core-composer-scaffold.implicit-drupal-core-disable.patch" }, "drupal/maillog": { - "/project/maillog/issues/3176023: Not configurable sender and other issues.": "https://www.drupal.org/files/issues/2024-01-17/maillog-n3176023-6.patch" + "/project/maillog/issues/3176023: Not configurable sender and other issues.": "https://www.drupal.org/files/issues/2024-07-24/maillog-n3176023-9.patch" } } } diff --git a/web/modules/custom/digital_gov_migration/digital_gov_migration.info.yml b/web/modules/custom/digital_gov_migration/digital_gov_migration.info.yml new file mode 100644 index 00000000..abca3e51 --- /dev/null +++ b/web/modules/custom/digital_gov_migration/digital_gov_migration.info.yml @@ -0,0 +1,7 @@ +name: 'Digital.gov Migration' +type: module +description: 'Migrations to Drupal from Hugo.' +package: Custom +core_version_requirement: ^10 || ^11 +dependencies: + - migrate_plus:migrate_plus diff --git a/web/modules/custom/digital_gov_migration/migrations/json_images.yml b/web/modules/custom/digital_gov_migration/migrations/json_images.yml new file mode 100644 index 00000000..03f183e5 --- /dev/null +++ b/web/modules/custom/digital_gov_migration/migrations/json_images.yml @@ -0,0 +1,61 @@ +id: json_images +label: 'Import images from Digital.gov Hugo' +source: + constants: + DRUPAL_FILE_DIRECTORY: 'public://m-images/' + + plugin: url + data_fetcher_plugin: file + data_parser_plugin: json + + urls: + # The host may have to change, depending on your local. For example, in + # WSL2, I had ot replace this with my WSL2 instances IP since Drupal is + # running inside a Docker Lando container, so localhost is the container + # not WSL2, where Hugo is. This shouldn't matter if this is a remote host. + # Another host to try is host.docker.internal or find your local machine's + # IP address. + #- http://172.31.222.216:1313/images/v1/json/ + #- http://localhost:1313/images/v1/json/ + - https://federalist-466b7d92-5da1-4208-974f-d61fd4348571.sites.pages.cloud.gov/preview/gsa/digitalgov.gov/1631-migrate-approaches/images/v1/json/ + + + # XPath-like selector. The slash (/) at the beginning is optional. + # This is needed if the content is not at the root. + item_selector: + fields: + - name: src_image_id + label: 'Image ID' + selector: uid + - name: src_image_url + label: 'Image URL' + selector: source-url + ids: + src_image_id: + type: string +process: + psf_destination_filename: + plugin: callback + callable: basename + source: src_image_url + psf_destination_full_path: + - plugin: concat + source: + - constants/DRUPAL_FILE_DIRECTORY + - '@psf_destination_filename' + - plugin: urlencode + psf_source_image_path: + plugin: urlencode + source: src_image_url + # This is the field that actually gets saved to the file entity, the rest + # are just pseudo fields for populating it. + uri: + # https://api.drupal.org/api/drupal/core%21modules%21migrate%21src%21Plugin%21migrate%21process%21FileCopy.php/class/FileCopy/10 + plugin: file_copy + source: + - '@psf_source_image_path' + - '@psf_destination_full_path' + file_exists: 'use existing' + move: FALSE +destination: + plugin: 'entity:file'