From 9cfc1d040fafe0e11bcefb44c96981cc22a9658f Mon Sep 17 00:00:00 2001 From: brockfanning Date: Fri, 30 Aug 2024 14:50:10 -0400 Subject: [PATCH] FOIA-0: Another core patch hack to allow XML uploades to work. (#647) --- composer.json | 3 ++- composer.lock | 2 +- .../migrate-action-hack-for-xml-upload.patch | 27 +++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 patches/migrate-action-hack-for-xml-upload.patch diff --git a/composer.json b/composer.json index f0841b619..2baeb7b77 100644 --- a/composer.json +++ b/composer.json @@ -171,7 +171,8 @@ "FOIA-32: Exclude Agency/Component from validation for bulk publishing": "./patches/FOIA-32-validator.patch", "2869592 - Disabled update module shouldn't produce a status report warning": "https://www.drupal.org/files/issues/2024-07-16/2869592-disabled-update-module-71.patch", "2230909 - Simple decimals fail to pass validation": "https://www.drupal.org/files/issues/2024-06-04/2230909-321.patch", - "Hacks related to file_entity to get XML upload to work": "./patches/managed-file-hacks-for-xml-upload.patch" + "Hacks related to file_entity to get XML upload to work": "./patches/managed-file-hacks-for-xml-upload.patch", + "More hacks related to action module to get XML upload to work": "./patches/migrate-action-hack-for-xml-upload.patch" }, "drupal/password_policy": { "Config install issues": "https://www.drupal.org/files/issues/2022-10-04/password_policy_field_last_password_reset_unknown_error_2771129-134.patch" diff --git a/composer.lock b/composer.lock index 97a4772ee..ef5d1e5fe 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": "4869699dfeeb000f97e5c0bc2f92758a", + "content-hash": "83a23cf403e6681bf3892daec56d8567", "packages": [ { "name": "acquia/blt", diff --git a/patches/migrate-action-hack-for-xml-upload.patch b/patches/migrate-action-hack-for-xml-upload.patch new file mode 100644 index 000000000..cb841af8b --- /dev/null +++ b/patches/migrate-action-hack-for-xml-upload.patch @@ -0,0 +1,27 @@ +diff --git a/core/modules/action/action.module b/core/modules/action/action.module +index 0e4229debc..f3ac61db22 100644 +--- a/core/modules/action/action.module ++++ b/core/modules/action/action.module +@@ -61,12 +61,16 @@ function action_migration_plugins_alter(array &$migrations) { + foreach ($migrations as $migration_id => $migration) { + // Add Actions plugins in actions module. + /** @var \Drupal\migrate\Plugin\migrate\source\SqlBase $source_plugin */ +- $source_plugin = \Drupal::service('plugin.manager.migration') +- ->createStubMigration($migration) +- ->getSourcePlugin(); +- if (is_a($source_plugin, Action::class) && isset($migration['process']['plugin'])) { +- $migrations[$migration_id]['process']['plugin'][0]['map']['comment_unpublish_by_keyword_action'] = 'comment_unpublish_by_keyword_action'; +- $migrations[$migration_id]['process']['plugin'][0]['map']['node_unpublish_by_keyword_action'] = 'node_unpublish_by_keyword_action'; ++ try { ++ $source_plugin = \Drupal::service('plugin.manager.migration') ++ ->createStubMigration($migration) ++ ->getSourcePlugin(); ++ if (is_a($source_plugin, Action::class) && isset($migration['process']['plugin'])) { ++ $migrations[$migration_id]['process']['plugin'][0]['map']['comment_unpublish_by_keyword_action'] = 'comment_unpublish_by_keyword_action'; ++ $migrations[$migration_id]['process']['plugin'][0]['map']['node_unpublish_by_keyword_action'] = 'node_unpublish_by_keyword_action'; ++ } ++ } catch (Exception $e) { ++ // Do nothing. This hack added to allow the XML upload to work. + } + } + }