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.
Create a migration config and class for enable end user to migrate Blocks from Drupal 7 to Drupal 8
Contributors
People who helped in #2532550: Leading slashes not added to visibility paths, which was merged in patch #14: quietone, tim.plunkett
People who helped in #2372785: Error running d6_block migration, which was addressed in patch #22: eliza411, quietone, bdone
Suggested commit message:
git commit -m 'Issue #2408165 by phenaproxima, miguelc303, quietone, eliza411, tim.plunkett, bdone: Migration Files for Drupal 7 Blocks
Comment | File | Size | Author |
---|---|---|---|
#42 | interdiff-2408165-40-42.txt | 1.19 KB | phenaproxima |
#42 | 2408165-42.patch | 49.24 KB | phenaproxima |
#40 | interdiff-2408165-27-40.txt | 2.68 KB | phenaproxima |
#40 | 2408165-40.patch | 49.2 KB | phenaproxima |
#27 | interdiff-2408165-22-27.txt | 3.54 KB | phenaproxima |
Comments
Comment #1
benjy CreditAttribution: benjy commentedThere aren't any D7 migrations in core right now, they're in the sandbox: https://www.drupal.org/sandbox/chx/2105305
We need to get the sandbox re-rolled against HEAD and bring everything into core before we start with individual D7 issues.
Comment #2
miguelc303 CreditAttribution: miguelc303 commentedI did a patch for enable end user to migrate Blocks from Drupal 7 to Drupal 8
Comment #3
hosef CreditAttribution: hosef commentedMoving to the IMP issue queue.
Comment #4
miguelc303 CreditAttribution: miguelc303 commentedRemove some files and class because they were put in others issues.
Comment #5
benjy CreditAttribution: benjy at CodeDrop commentedComment #6
miguelc303 CreditAttribution: miguelc303 at Anexus commentedAdded organization support to Anexus IT
Comment #7
phenaproximaIt's time to get going on this. First step is tests for the patch in #4.
Comment #8
quietone CreditAttribution: quietone commentedStarted work on this, moved everything to their module. But currently fails tests because the blocks aren't migrated.
Comment #9
quietone CreditAttribution: quietone commentedJust moved files to block module.
Comment #10
quietone CreditAttribution: quietone commentedRemove the Related issue that is already a child issue.
Comment #11
phenaproximaEscalating, because a site without its blocks is like...well, it's not complete, that's for sure. People will assume migration is broken is blocks do not migrate.
Comment #12
phenaproximaComment #13
phenaproximaWIP patch. This generalizes a bunch of things, but I'm not sure it will pass the tests yet.
Comment #14
phenaproximaMerged in #2532550: Leading slashes not added to visibility paths.
Credit from that issue carries over to @quietone and @tim.plunkett; IS updated accordingly.
Comment #15
quietone CreditAttribution: quietone commentedDidn't get the opportunity to do much work on this. But here are a few namespace corrections.
Comment #16
phenaproximaNow with tests! Delicious, succulent, gluten-free tests.
Comment #18
hass CreditAttribution: hass commentedWhy have you rolled back the latest changes where you splitted pages and roles? Now they are again merged. Larger patches are more difficult to review...
Comment #19
phenaproximaShort answer: because, for reasons far beyond my control, they can't be split apart. I spent hours trying.
Comment #20
hass CreditAttribution: hass commentedCan you shed some light on these reasons, please? I need the same code for migration of roles and urls in #2531648: Migrate 'pages' and 'roles' settings to D8 and need some help, too.
Comment #22
phenaproximaFixed a fatal and removed the update hook. This should pass the tests now.
Yes. It has to do with the way DefaultLazyPluginCollection works.
If
visibility/user_roles
is defined in the migration, for example, the resulting visibility plugin collection will look something like this if the visibility plugin fails:The plugin collection will choke on this, throwing exceptions like
Plugin ID "user_role" not found
.Ideally, if the visibility plugin failed, the plugin collection should not even have the user_role key. Unfortunately, because it is defined in the migration, it will be there come hell or high water. There's no way for the process plugin to say "I failed, so please unset my destination key." The only way to prevent the key from being defined is for all visibility stuff to be handled in a single plugin.
Comment #23
benjy CreditAttribution: benjy at PreviousNext commentedLooks ready for me, couple of things:
Do we have tests for this? There is a separate issue for this very bug floating around somewhere. EDIT: here it is, #2372785: Error running d6_block migration
How nice of you, i've have almost been tempted to leave this out entirely to discourage its usage.
I notice this is "2" above, i'm guessing the other values are 0 or 1?
Nice!
Lets put these on two lines?
Comment #24
phenaproximaPulling in credit from #2372785: Error running d6_block migration, which is superseded by this patch.
Comment #27
phenaproximaFixed #23.4 and added a test of the custom block migration.
Comment #28
mikeryanComment #39
webchickTest:
- Fairly basic D7 test database, just a vocab, a menu link, maybe a piece of content.
- Added two blocks:
1) "Who's new" to the right sidebar, limited to authenticated users
2) "Who's online" to "tryptich middle" (which doesn't exist in D8), shown on front page only.
Migration appears to complete fine (using Migrate UI) but upon redirecting back to the front page I see the dread "The website encountered an unexpected error. Please try again later." error on every page. :(
Checking logs shows:
YOU'RE a lazy context repository! :P
drush cr
gets my /admin back briefly, but Bartik is hosed. Incidentally, when running that command, I got the following notices in console:Same error after
drush cr
tho.Adam and I discussed; most likely this is happening because of the access-controlled block, which uses context, and this also means we need expanded test coverage.
Comment #40
phenaproximaFixed! And tests are updated!
Comment #42
phenaproximahttp://biglizards.net/Graphics/ForegroundPix/CharlieBrownFootball.jpg
Comment #44
phenaproximaYAY! Restoring RTBC.
Comment #45
webchickAwesome!!
I had applied that fix locally earlier and the migration completed successfully, apart from #2569703: When migrating to the same theme with different region names, block will not migrate properly but that bug affects D6 as well.
Looked through the patch, no red flags. Let's DO THIS.
Committed and pushed to 8.0.x. YEAH!!