Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
In Drupal 7, actions were part of the System module, which maintained the actions table in the database. In Drupal 8, this has been split out into a core module called Action, and it will need a migration path.
Proposed Resolution
Write a migration which will scan through the contents of the D7 actions table and turn them into the D8 equivalent (config entities?)
Remaining Tasks
- Write the patch
- Write tests
- Review
- Merge into the parent issue
Comment | File | Size | Author |
---|---|---|---|
#26 | migrate_actions-2503047-26.patch | 19.75 KB | svendecabooter |
#21 | migrate_actions-2503047-21.patch | 19.78 KB | svendecabooter |
#18 | migrate_actions-2503047-18.patch | 19.67 KB | svendecabooter |
#15 | migrate_actions-2503047-15.patch | 18.14 KB | svendecabooter |
#14 | migrate_actions-2503047-14.patch | 18.17 KB | svendecabooter |
Comments
Comment #1
mikeryanWe have a d6_action source plugin currently, but no actual migration of that data is taking place. I doubt there's significant difference between D6 and D7 here, we should be able to do it in one patch.
Comment #2
svendecabooterComment #3
svendecabooterFirst rough attempt at migrating D6 & D7 actions into D8.
Some things to discuss:
* Custom actions in D6 & D7 get a numeric action id (aid). Should we use this as the D8 action machine name as well, or generate the machine name from the label?
* system_block_ip_action from D6 / D7 doesn't seem to exist in D8. In my patch I just skip the migration of this action. Not sure if this is the desired behavior.
Comment #4
phenaproximaYes, that would be the preferred way to go; there is a machine_name plugin to help with this.
The action may have been moved into the Ban module, so I'd check there first. If it doesn't exist, then yes, we can skip it.
Comment #5
svendecabooterUpdated version where numeric action IDs get turned into a machine name based on the label.
The action to block IPs doesn't get migrated from D6 & D7, because there is no action plugin in D8 (not in system module, nor ban module).
Comment #6
svendecabooterAdding my WIP changes for the tests
Comment #7
svendecabooterMight need some help here...
* D7 PHPUnit test doesn't run - getting "No test results to display." (same issue with unit tests as I have in #2500483: Upgrade path for Image 7.x
* D7 migration test: still some things that are failing:
- Something with a missing schema value - haven't figured out yet what's causing this
- Can't find a way to assert the "configuration" settings in the Action config entity. They don't seem to be exposed through a getter. How would I go about checking them?
Once those issues are fixed - I can pretty much copy the tests for D6.
Also: how will we migrate actions that are defined by contrib modules or custom code? Just skip them?
Comment #8
svendecabooterUpdated patch:
* Fixed PHPUnit errors
* Fixed wrong assertions in D7 MigrateActionsTest
Still have to figure out:
* Why it gives the following schema error:
Schema errors for system.action.unpublish_content_containing_keyword_s_ with the following errors: system.action.unpublish_content_containing_keyword_s_:configuration.keywords missing schema
* Can't find a way to assert the "configuration" settings in the Action config entity. They don't seem to be exposed through a getter. How would I go about checking them?
Comment #9
phenaproximaI looked into this and it turns out it is a tiny bug in the Node module. Issue filed: #2578519: Node has invalid config schema for node_unpublish_by_keyword_action.
Postponing until that lands.
Comment #10
phenaproximaBlocking issue landed.
Comment #11
phenaproximaIf I'm not mistaken, you should be able to get the configuration by calling
$action->get('configuration')
.Comment #12
svendecabooterUpdated patch:
* Uses new database fixtures to generate test data
* D7 test updated with assertions for $action->get('configuration')
* D6 test added
Comment #13
phenaproximaGreat work so far!
Need a new line at the end of the file to please Git :)
This migration seems virtually identical to d6_action -- can they be merged?
You heard the version control system :)
I'd prefer if we didn't cherry-pick the fields to select -- just select('actions', 'a')->fields('a')
At a glance, this also appears nearly identical to the D6 version. Can they be generalized?
I don't think this assertion adds much value; it's OK to remove it.
Needs a period at the end of the sentence.
This can just be Action::load($id).
$action->get('configuration')
Whoops :)
Comment #14
svendecabooter* Fixed newline issues
* Consolidated D6 & D7 action source - the only difference is the description field which is called "label" in D7 and "description" in D6.
* Assertion that counts number of actions has been removed.
* Periods added to comments
* @TODO: check configuration was already fixed - guess I uploaded an older patch by accident or something.
I could probably also consolidate d6_action.yml and d7_action.yml into the same file, but then the source property for the description field would need to have the same key in both cases. What's the best approach to do that, since I don't want to mess too much with the source data.
Comment #15
svendecabooterBollocks... still a Git newline missed...
Let's try again
Comment #18
svendecabooterMigrate source Unit test also needed updating. Trying again.
Comment #19
svendecabooterAdding this tag - hope that's ok
Comment #21
svendecabooterComment #22
quietone CreditAttribution: quietone commented@svendecabooter, I too would like to know about merging the d6 and d7 yml files. Can someone answer that question, in comment #14?
And other that the two wee edits below, this looks good to me. Not even sure if the question above prevents RTBC.
I think these should be uppercase.
And these too.
Comment #23
mikeryanUnfortunately, that one discrepancy in source field name does mean we can't use a common config file for both, d6_action and d7_action will need to stay separate.
Comment #24
quietone CreditAttribution: quietone commented@mikeryan, thank you.
@svendecabooter, I'm still getting used to reviewing, so I looked again and found 2 more items.
MigrateDrupalTestBase enables system and user, so they can be removed.
Same as above.
Comment #25
quietone CreditAttribution: quietone commentedComment #26
svendecabooterThanks for the review quietone!
Attached an updated with your remarks covered.
Comment #27
catchComment #28
quietone CreditAttribution: quietone commentedOne more!
Should this be migrate_drupal_7?
Same
Comment #29
svendecabooterThe @group setting seems to be different for Drupal 6 Migration tests compared to Drupal 7 Migration tests.
Not sure why that's the case, but I based myself on other tests that already made it into core, to keep things consistent.
Comment #30
quietone CreditAttribution: quietone commented@svendecabooter, thx!
Looks like everything has been addressed.
Comment #38
alexpottCommitted 395c724 and pushed to 8.0.x and 8.1.x. Thanks!
It is odd that the Ban module did not add this action.
Should be
\Action
not/Action
. Fixed on commit.