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.
I successfully migrated my site from D7 to D8, but all my forum containers was imported as forums.
Solution:
The patch implements the solution suggest in #19
Comment | File | Size | Author |
---|---|---|---|
#72 | interdiff-2903007-51-72.txt | 3.83 KB | maxocub |
#72 | 2903007-72.patch | 7.48 KB | maxocub |
Comments
Comment #2
cilefen CreditAttribution: cilefen commentedThank you for reporting an issue. Let's move this to the migration system first so as to get attention from the migrate maintainers.
Comment #3
dillix CreditAttribution: dillix commentedComment #4
quietone CreditAttribution: quietone as a volunteer commentedI'm pretty sure this was fixed in, #2669030: D6 Forum vocabulary is migrated to the wrong D8 field name, which was only committed yesterday to 8.5.x. Can anyone confirm that? Especially, maxocub, who wrote the patch.
Comment #5
dillix CreditAttribution: dillix commented@quietone, I will check tomorrow if patch from #2669030 fixes this issue.
Comment #6
heddnPostponing while we wait.
Comment #7
dillix CreditAttribution: dillix commentedI tried to migrate in fresh 8.4-dev (catch commited patch also for 8.4), but instead containers i've got forums. Also I can't manually create new containers, after migration drupal create forums instead containers.
See screenshot: http://joxi.ru/LmG8Ba9seG4Ll2
Comment #8
dillix CreditAttribution: dillix commented@heddn how can I help to fix this issue?
Comment #9
heddnMaybe I don't understand the wording used here. When I hear the word containers, I think of something besides Drupal. What are containers in the context of comments and forums?
Comment #10
dillix CreditAttribution: dillix commented@heddn When I install new site from scratch on D8 I can create containers and move forums to it. Here is screenshot from admin: http://joxi.ru/xAeJKLgFpKWEEr
And this one from frontend: http://joxi.ru/DrlNXvghvDMg72
But when I migrate from D7 to D8 my containers migrated as forums with child subforums. And when I try to create new container I also get forum instead.
Comment #11
dillix CreditAttribution: dillix commentedI investigated forum & taxonomy migrations and there isn't containers support.
Comment #12
xjmComment #13
xjmPer discussion with @catch, we're promoting the "Migrate critical" issues to critical given the importance of a stable migration path at this point in the release cycle. (The framework and release managers will confirm this in a later triage for individual issues.) Assuming the feature of forum containers still exists in D8 (edit: which is confirmed in #10), this is actually a data integrity issue.
Comment #14
heddn@dillix was container support available before the migration? Meaning, is container support available in D8, and there a migrate issue or is the feature not available? I'm not very familiar with forum, so you are the expert here...
Comment #15
masipila CreditAttribution: masipila as a volunteer commentedI'll have some time on Friday this week to troubleshoot this further unless others can get it solved already earlier.
Cheers,
Markus
Comment #16
dillix CreditAttribution: dillix commented@heddn, yes support is available on fresh D8 site before migration (both in templates & admin), I attached links with screenshots in #10, but after migration it breaks. This bug is critical for our site and we can't migrate to D8 now.
Comment #17
masipila CreditAttribution: masipila as a volunteer commentedI investigated this a bit in the bus on my way to work.
Drupal 7
https://api.drupal.org/api/drupal/modules%21forum%21forum.admin.inc/7.x
It seems to me that both forums and forum containers are taxonomy terms. The difference is that we have a persistent variable
forum_containers
which seems to be an array ot term ids that should be treated as containers instead of forums.Assigning to myself, I'll continue with this during this week.
Markus
Edit: typos
Comment #18
masipila CreditAttribution: masipila as a volunteer commentedI had a bit of time yesterday evening on this. I need a bit of guidance on the approach.
1. Digging the source is-this-forum-container setting
We can easily do the determination in thde Term source plugin
If the taxonomy term is forum relevant, we can add a source property forum_container with the correct value.
2. What is the most elegant way to map this for forum relevant terms only?
This the part where I could use some guidance. I don't think we want to add the "forum_container is false" value to all non-forum related terms. Or is this safe to do in the sence that this mapping sould be automatically ignored for the non-forum related terms?
Cheers,
Markus
Comment #19
phenaproximaBased on my own cursory research, here's what I'm seeing.
In D8, forum_container is a configurable boolean field attached to taxonomy terms from the 'forums' vocabulary. It should therefore be completely harmless for us to do something like this: the source plugin could set an is_container property which indicates if the term being migrated is a container (which, as you know, can be found out by looking at the value of a particular D7 variable). Then we can map that directly to the forum_container destination property, which (I think) will simply be discarded for terms which don't have that field.
Should be pretty straightforward.
Comment #20
masipila CreditAttribution: masipila as a volunteer commentedThanks, this answers the only thing I was wondering i.e. does it harm if we map this to all terms. All clear now.
Markus
Comment #21
maxocub CreditAttribution: maxocub for Acquia commentedTagging.
Comment #22
dipakmdhrm CreditAttribution: dipakmdhrm as a volunteer commentedComment #24
rakesh.gectcrWorking on the tests
Comment #25
masipila CreditAttribution: masipila as a volunteer commentedUnassigning myself since others had time to write the patch already before me. The solution is exactly how I was about to do this (not surprise since this is straight forward).
Comment #26
maxocub CreditAttribution: maxocub for Acquia commentedBeside the failing lint to be fixed, here's my review:
What about something simpler: "Set the 'is_container' to TRUE if the tid is in the 'forum_container' variable."
in_array already return TRUE or FALSE, so the " ? TRUE : FASLE" part is not needed.
In retrospect, this could look cleaner with a one-liner.
Comment #27
rakesh.gectcrComment #28
rakesh.gectcrDone all the comment @maxocub has addressed.
Comment #29
masipila CreditAttribution: masipila as a volunteer commentedOnce the automatic tests pass, I can do a manual test still this evening and RTBC this after that.
Markus
Comment #30
quietone CreditAttribution: quietone as a volunteer commentedTalked to rakesh.gectr about minor nits in a comment, the variable name didn't match what was in the code. He has made changes that will be uploaded in next patch.
Comment #31
masipila CreditAttribution: masipila as a volunteer commentedJust realized that this can't be RTBCd yet. We're still missing automated test coverage for this...
Comment #32
heddnComment #33
quietone CreditAttribution: quietone as a volunteer commentedYes, forget to mention that rakesh.gectr was working on the test.
Comment #34
maxocub CreditAttribution: maxocub for Acquia commentedThis change is in the wrong file.
Drupal\taxonomy\Plugin\migrate\source\Term is deprecated, we need to move that to Drupal\taxonomy\Plugin\migrate\source\d7\Term.
Comment #35
rakesh.gectcr@maxcoub Thank God and Maxi, We did find out that .... :) Here i am attaching that patch now, Still I am working on test. :)
Comment #37
rakesh.gectcrLets hit again.
Comment #38
rakesh.gectcrComment #40
quietone CreditAttribution: quietone as a volunteer commentedI prefer a comment that says what are trying to achieve. And the code here is simple enough. So, Something like
'Determine if this is a forum container.'
is_container is defined only for the expected results of tests[0]. Are the other tests returning the expected results for is_container?
Comment #41
rakesh.gectcrAdded the tests,
According to quietone's comment,
1) Done
2) Honestly, I am not having convincible answer now. :(
Comment #42
dipakmdhrm CreditAttribution: dipakmdhrm as a volunteer commentedThis patch contains all the needed tests (migration and source plugin).
This also address @quiteone's point #2 in comment #40 i.e. this patch now has expected results for
is_container
for all tests inTermTest.php
Comment #43
rakesh.gectcrWas trying to figure out,
Why the lines are getting removed and trying to apply the patch got the following result.
Patch is good.
A small nit pick
+ forum_container: is_container
trailing whitespace.
Comment #44
quietone CreditAttribution: quietone as a volunteer commentedThere are 7 parameters for this method and 6 are being passed. Therefor the test isn't doing what you expect.
$expected_container_flag defaults to '0' but then checked with isset, but it will always be set if this is done. The source plugin sets it to TRUE or FALSE, so it will always have a value.
Comment #45
dipakmdhrm CreditAttribution: dipakmdhrm as a volunteer commentedFixed the whitespace.
Also discussed the observations in #44 with @quiteone.
We decided that both observation were not valid for this patch. However, there indeed was a patch needed for fixing the tests where we were using integer values
0
&1
instead of booleanTRUE
&FALSE
.Comment #46
dillix CreditAttribution: dillix commentedAfter migration to D8 I can't create containers anymore. When I try to create one it saves as forum. On a fresh install I can create containers.
Comment #47
maxocub CreditAttribution: maxocub for Acquia commented@dillix: Do you mean you tried the latest patch from #45 and it still didn't worked?
I did manually tested the latest patch on a fresh D8 install and the containers were migrated and I was able to create new containers after the migration.
If you did something different, please share the steps to reproduce.
Comment #48
rakesh.gectcrA small nit pick need to update the comment doc block for the function
protected function assertEntity
Noticed that we are removed the
is_container
flag fromAnd still i am trying to figure out [#43] y the first part is happening / y git is acting wierd.
Comment #49
quietone CreditAttribution: quietone as a volunteer commentedYes, dipakmdhrm is correct. My comments in #44 aren't very useful. Hope about I blame that as a side effect of breathing all this northern hemisphere air?
Comment #50
phenaproximaA couple of nitpicks:
Let's use $entity->hasField('forum_container') instead.
This should be assertSame().
Comment #51
rakesh.gectcr:) Here we go!
Comment #52
quietone CreditAttribution: quietone as a volunteer commentedThe solution suggested by phenaproxima in #19 has been implemented. The patch has been tested and it does fix the problem. Updated the IS with a link to the solution that was implementd.
So off we go to RTBC land!
Thanks rakesh.gectcr and dipakmdhrm for getting this to RTBC at Vienna,
Comment #53
phenaproximaLooks totally great. +1 RTBC.
Comment #54
dillix CreditAttribution: dillix commentedI will try latest patch soon and write here about results.
Comment #55
rakesh.gectcrComment #56
webchickThe OP talks about a bug that after migrating, they can no longer create forum containers. There is test coverage for the migration itself, but not for this bug. Marking back to needs work for tests, per @phenaproxima.
Separately, it feels super grody to the max and decidedly un-tubular and non-radical to shove a bunch forum logic in the taxonomy term migrations. Maybe we could also get a non-critical follow-up to make Forum a sub-class of Term so we can better encapsulate the one-off logic here.
Comment #57
dillix CreditAttribution: dillix commentedI tried #51 on 8.4 latest dev and nothing changes. My containers migrated as forums and I can't create new containers. When I try to create containers before upgrade it's created as containers.
Comment #58
masipila CreditAttribution: masipila as a volunteer commentedHi dillix,
Could you please clarify what exactly do you mean that you are not able to create new containers after you have executed migrations?
Do you mean that when you try to create new containers manually after the migrations have been executed, they are created as forums?
Or something else?
Cheers,
Markus
Comment #59
catchAgreed with #56.
I'm wondering if the forum migration could be a secondary migration (i.e. allow taxonomy to migrate the terms, then have forum get the forum/container metadata from the source site, load the terms already migrated and save the field values etc.).
Having said that, since the term migration already does some forum logic, that might be OK as a non-critical follow-up once we've fixed the data-integrity issue here.
Comment #60
dillix CreditAttribution: dillix commented@masipila, yes I have this problem:
> Do you mean that when you try to create new containers manually after the migrations have been executed, they are created as forums?
And also containers created in D7 after migration converted to forums.
@catch I think that taxonomy migration breaks creation of new containers after migration.
Comment #61
dipakmdhrm CreditAttribution: dipakmdhrm as a volunteer commented@dillix:
I did some manual testing with patch from #51. And everything seems to be working well.
1. I created some forums and containers in D7:
2. I was able to import them as respective forums and containers in D8 (by using Migrate Drupal UI i.e.
/upgrade
path):3. I was able to create a new forum container after migration as well:
Is there something wrong with what I am trying? Did you try something else?
Comment #62
dillix CreditAttribution: dillix commented@dipakmdhrm on D7 site I also have advanced_forum module, but as I know it doesn't change containers functionality.
Comment #63
maxocub CreditAttribution: maxocub as a volunteer commentedThanks @dipakmdhrm for your manual testing and for confirming my results.
@dillix: Could you give us a list of all your enabled contrib modules? I just did manual testing with advanced_forum enabled and I wasn't able to reproduce your results, all containers were migrated as containers and I was able to create new containers after the migration.
I will try to add a test for the creation of forum containers after a migration.
Comment #64
dillix CreditAttribution: dillix commented@maxocub modules on D7 or D8 site?
Comment #65
maxocub CreditAttribution: maxocub as a volunteer commented@dillix: Both I guess, the more info we have the easier it is to understand what's going on.
Comment #66
heddnAssigning to myself to review this week.
Comment #67
dillix CreditAttribution: dillix commentedD7 modules:
D8 Modules:
Comment #68
maxocub CreditAttribution: maxocub as a volunteer commentedLet's fix the forum container migration bug here and move the investigation for the creation of new containers after a migration to a follow-up: #2914249: Translated forum vocabulary migration creates duplicate forum vocabularies.
I also created a follow-up to move the forum logic from the taxonomy migrations to new forum migrations, as per #56 and #59: #2914251: Move forum related logic from taxonomy migrations to new forum migrations.
Comment #69
quietone CreditAttribution: quietone as a volunteer commentedGreat, now that there are follow up issues, all the points raised since the last RTBC have been addressed. Retesting the latest patch, #51, now.
Comment #70
phenaproximaI concur with @quietone. Pre-RTBC on the assumption that #51 will pass Drupal CI.
Comment #71
catchIt still seems worth having some automated testing to ensure that new forum containers can be created after the migration. If the follow-up isn't reproducible, then we won't have an issue to add that test coverage. On the other hand I'm also struggling to see how the migration could interfere with this. Leaving RTBC but re-tagging for discussion at least.
Comment #72
maxocub CreditAttribution: maxocub as a volunteer commentedGood thing we took a second look at those tests because the current test was not testing anything since the forum module was not enabled.
I added test coverage to see if we can add a new forum container after a migration, not sure if adding it programmatically is enough though, since it's not exactly like clicking on the button and filling a form, but I guess it's close enough.
Comment #73
phenaproximaKicking back to NR since there is a new patch.
Comment #74
dillix CreditAttribution: dillix commentedTried #72 and it does't fix my issue. I investigated a bit more my problem and found that during migration drupal creates new vocabulary Forums and imports here terms and after migration I have 2 vocabs (Forums and Форумы), so relation between forum functionality and vocabulary breaks. Also when I open taxonomy_forums field settings for forum content type there isn't any taxonomy vocab checkbox marked here (but before migration it has been set to Форумы after I enabled forum module).
PS: In my D8 site config I have only one language (Russian) and it sets as default in settings.
PPS: May be #2914251: Move forum related logic from taxonomy migrations to new forum migrations will fix my issues...
Comment #75
masipila CreditAttribution: masipila as a volunteer commentedThanks @dillix for the additional information. I'm trying to reproduce this now.
Comment #76
masipila CreditAttribution: masipila as a volunteer commented@dillix, I tried to reproduce this issue using Finnish language but I was not able to reproduce this.
We have two separate but related bugs here:
1. We migrated Forum containers as Forums because we were missing "is this forum taxonomy term a container" check
- This bug is being fixed under this issue
2. We seem to still have another bug which you are reporting in #74 which seems to have something to do with language setup
- maxocub created a separate issue for this in #68, see #2914249: Translated forum vocabulary migration creates duplicate forum vocabularies
Let's continue debugging the bug 2 in #2914249: Translated forum vocabulary migration creates duplicate forum vocabularies.
Cheers,
Markus
Comment #77
masipila CreditAttribution: masipila as a volunteer commentedComment #78
quietone CreditAttribution: quietone as a volunteer commented@masipila, thanks for trying to reproduce the issue dillix has reported and the summary.
Setting this back to NR because it does fix the problem of forum container migrating as forums and followups have been created to continue working on the problem dillix is still having and to move the code to the forum module.
Comment #79
masipila CreditAttribution: masipila as a volunteer commentedPatch 51 was reviewed in #52 and #53 and manually tested in #61.
Maxocub enhanced the test coverage in patch #72 and thus #71 has been addressed. There are no code changes between 51-72, the only changes are related to tests.
I did yet another manual test with patch #72 and results were as expected.
Follow-up issues have been created to a) address the separate issue that dillix is still reporting and b) to separate Forum related term migration logic away from the general term migrations.
I've read through patch #72 and as far as I can see everything is OK and all review comments have been addressed.
Setting to RTBC.
Cheers,
Markus
Comment #80
catchCommitted/pushed to 8.5.x and cherry-picked to 8.4.x. Thanks!
Comment #81
catchComment #84
phenaproximaMarked Fixed by @catch, but somehow it didn't take.