Problem/Motivation
There are many reports about block_content_update_8400()
being broken because of
1) its dependency on content_translation_update_8400()
2) its usage of \Drupal::moduleHandler()->moduleExists('content_translation')
which returns FALSE
when run during the update process, but returns TRUE
when run on the live codebase (e.g. via Drush)
Some of the problems with that update function were fixed in #2951242: Allow BaseFieldDefinition::setInitialValueFromField() to set a default value - this fixes issues with block_content_update_8400(), but the broken dependency on Content Translation is still there, and it still affects people who are updating to 8.5.6.
taxonomy_update_8601()
will likely have the same kind of issues, so let's fix them both at the same time.
Proposed resolution
Do not rely on the return value of \Drupal::moduleHandler()->moduleExists('content_translation')
in those two update functions, and keep only the check for the existence of a content_translation_status
field.
Remaining tasks
Review.
User interface changes
Nope.
API changes
Nope.
Data model changes
Nope.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2991902.patch | 2.3 KB | amateescu |
Comments
Comment #2
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedOnce this minimally invasive patch gets in, we should try to get to the bottom of the problem with
\Drupal::moduleHandler()->moduleExists()
returning conflicting values when run during database updates vs. regular site operation.FWIW, I think this should be backported to the 8.5 branch if we ever release a final 8.5 patch version before 8.6.0.
Comment #3
0Sarah0Al CreditAttribution: 0Sarah0Al commentedThanks amateescu :)
Comment #4
BerdirHm. So the point of this is that if a site is updating from an old version, to make sure that we are fixing the content_translation_status fields first, and only after that make them required. AFAIK, if you manage to run e.g. block_content_update_8400() first, things would be really broken.
Comment #5
amateescu CreditAttribution: amateescu for Pfizer, Inc. commented@Berdir,
block_content_update_8400()
doesn't depend oncontent_translation_update_8400()
anymore since #2951242: Allow BaseFieldDefinition::setInitialValueFromField() to set a default value - this fixes issues with block_content_update_8400(), becauseNULL
values incontent_translation_status
are now properly initialized withstatus = 1
. This dependency should have been removed in that issue, we just forgot about it..Comment #6
BerdirGood point. Then lets do this. As you said, lets avoid those crazy problems we had :)
Comment #8
catchCommitted/pushed to 8.7.x and 8.6.x, leaving open against 8.5.x
Comment #11
catchOK committed/pushed to 8.5.x (without the taxonomy hunk) too.