Closed (outdated)
Project:
Drupal core
Version:
8.4.x-dev
Component:
content_moderation.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
22 Jul 2017 at 05:33 UTC
Updated:
17 Sep 2018 at 16:36 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
sam152 commentedComment #3
sam152 commentedComment #4
sam152 commentedA first pass of this.
Comment #6
xjmI think we should at least mention this upgrade path in the release notes.
Comment #7
sam152 commentedComment #8
jibranI updated a site to 8.4.x and saw some errors. I think we should document on d.o how to fix it manually.
Comment #9
sam152 commentedComment #10
xjm@jibran, can you be more specific?
Comment #11
jibranAs seen in the upgrade path that we have to set the states and transitions names after the upgrade.
Comment #12
sam152 commentedThat shouldn't be necessary, not sure what is going on but I can add some more to the test case.
Comment #13
sam152 commentedReroll plus adding to the test to prove we don't need to update labels.
Comment #14
jibranThanks, for the update. FWIW, I was talking about machine name.
Comment #15
sam152 commentedThose shouldn't have changed either?
Comment #16
jibranOk, let me clarify. After updating to rc1 states were missing the labels and I have to re-add all the transitions.
Comment #17
sam152 commentedI see, so you're saying without the patch, if you want to fix it manually, there should be documentation for that?
Comment #18
jibranYes.
Comment #19
sam152 commentedComment #20
sam152 commentedComment #21
sam152 commentedComment #22
sam152 commentedComment #23
sam152 commentedComment #24
sam152 commentedComment #25
rferguson commentedHey, I'm trying to use this patch to go from 8.3.7 to 8.4, and I'm having trouble applying the patch. So far I've tried placing the patch in the drupal root directory and using patch -p0 < 2896630-13.patch or -p1 with no success. It just says "can't find file to patch at input line 5". It looks like there is no .install file in 8.3.7 for content moderation to start with, not sure if that makes any difference? I've also tried using git apply but it fails silently, and there shouldn't be much different between that and the patch command?
Any help is much appreciated!
Comment #26
sam152 commentedHi @rferguson, this patch applies on top of 8.4.0. You should upgrade your site, as you would normally to this version, then apply the patch before running "updb".
Comment #27
rferguson commentedComment #28
sam152 commentedThank you for clarifying the issue summary.
Comment #29
rferguson commentedOne more thing you can maybe help with. The above worked, however for the longest time now I've been having this other issue, possibly it seems related to a previous patch I didn't apply.
On the status page I see this:
ENTITY/FIELD DEFINITIONS
Mismatched entity and/or field definitions
The following changes were detected in the entity type and field definitions.
Content moderation state
The Content moderation state entity type needs to be updated.
Then running drush entity-updates I get this output:
The following updates are pending:
content_moderation_state entity type :
The Content moderation state entity type needs to be updated.
Do you wish to run all pending updates? (y/n): y
Drupal\Core\Entity\EntityStorageException: Exception thrown while performing a schema update. SQLSTATE[42000]: Syntax [error]
error or access violation: 1071 Specified key was too long; max key length is 767 bytes: ALTER TABLE
{content_moderation_state_field_data} ADD UNIQUE KEY `content_moderation_state__lookup` (`content_entity_type_id`,
`content_entity_id`, `content_entity_revision_id`, `workflow`, `langcode`); Array
(
)
in Drupal\Core\Entity\Sql\SqlContentEntityStorage->wrapSchemaException() (line 1513 of
/vagrant/src/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Failed: Drupal\Core\Entity\EntityStorageException: !message in [error]
Drupal\Core\Entity\Sql\SqlContentEntityStorage->wrapSchemaException() (line 1513 of
/vagrant/src/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Cache rebuild complete. [ok]
Finished performing updates. [ok]
I'm wondering if there's something quick I can do to fix this? Is it just a matter of changing the column size in the db?
Comment #30
sam152 commentedHere is some context on your issue: https://www.drupal.org/node/2890189#comment-12148013
If you used this patch to come from a version 8.3.3 or earlier, and you didn't use the above upgrade path, the "content_entity_type_id" column in the "content_moderation_state_field_data" and "content_moderation_state_field_revision" table will be too long and should be adjusted to "32". I believe updating the tables manually will leave you in an invalid state however because the entity storage schema is persisted in other places, so there will still be a mismatch.
I would look at running the update steps in #2890189: Unofficial content_moderation 8.3.2 to 8.3.3 upgrade path. That patch will no longer apply, but each of the three update hooks should still be valid if you can get them to run.
Resetting your content_moderation schema version to "8401" (as in 8.4 HEAD) and then renaming them to be 8402, 8403 and 8404 respectively should do the trick.
Comment #31
sam152 commentedThe last production site I am responsible for moved to 8.4 today with this patch. I don't have anything further to add to these, so unless anyone else runs into issues I think these can be closed.
Comment #32
rop commentedI Applied patch as suggested yet I keep getting these warnings:
updated to 8.4.4 after patching
Comment #33
sam152 commentedDid you run updb and follow the other steps in the issue summary? You also need to confirm your schema version was at "8401" before running updb and applying the patch.
Comment #34
sam152 commentedCan I ask if following the steps in #33 worked?
Comment #35
rop commented@Sam152
I am not sure actually. I did (try to) follow the steps and I did run updb. But it is possible that I messed up since I had trouble in my git setup with branch differences and configuration diffenrences. ...I know..
The question is how can I either revert applied updates or check/revert my schemaversion without getting really messy, since updates have been added after the patch updates.
Or maybe the question is, can I manually fix the above issues?
Sorry for bothering you with my clumbsy questions.
Comment #36
sam152 commentedHappy to help in any way I can! Schema version is per module, so you can dial the content_moderation one back or forward without impacting anything else. No update hooks have been created for content moderation after the patch was created, so it should be safe.
Comment #37
rop commentedAh..ok. Not too familiar with the update version system..
Cool I'll give it a try.
Comment #38
stephen ollmanGetting error after applying the patch and running update.php
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /update.php/start?id=2740&op=do_nojs&op=do
StatusText: Internal Server Error
ResponseText:
Nothing is saved to the watchdog table.
Running via drush gives:
Error: Class 'NestedArray' not found in
/home/devboxco/public_html/asada/core/modules/content_moderation/content_moderation.install, line 28
Comment #39
stephen ollmanMy bad... I missed the new code at the top.
Comment #40
rop commentedmhh...still having trouble with this.
All my workflow transitions are gone and I cannot recreate them.
When I run update_8402 I get:
but I guess that's because there are null transitions,
Trying to add a new transition results in:
Also trying to import the older config file fails, because the entity allready exist, yet I cannot delete it because it's being used by some of my nodes.
So I am not sure what to do.
Comment #41
sam152 commentedSimilar issues were reported in #2937527: "Argument 1 passed to Drupal\workflows\Plugin\WorkflowTypeBase::getNextWeight() must be of the type array, null given" when adding a workflow transition. I provided some steps to try and resolve this:
Comment #42
sam152 commentedQueueing up another test run for this, given that's twice someone has run into this issue.
Comment #43
sam152 commentedComment #44
rop commentedThank you sam for that reference!
I think I've managed to get everything back in order. I have my state transitions and no errors.
I did, like Stephen https://www.drupal.org/project/drupal/issues/2937527#comment-12433588
just manually edit the blob from a backup.
I compared it with the new string and found that (besides all transition) that the uuid was NULL
a:10:{s:4:"uuid";N;s:8:"langcode";s:2:"en";...So all I did was replace the uuid in the old file with 'N' and then pasted that into the updated database. That gave me only the default transitions back, and all of the state-labels where empty.
After that I ran the 8401 update, this restored all the labels and transitions. Hooray!
The only thing that worries me is, should the workflow not have an uuid?
Comment #45
sam152 commentedModifying data directly in a backup seems kind of risky but glad you got it to a workable state. As far as the UUID, I suppose you could install a fresh copy and compare it with what you have, I'm not sure what the state of that blob should be in off the top of my head.
Comment #46
rop commentedI agree, it is not the most elegant or safest way to fix things. And I suppose not having that id is not ok.
It is not a recommended solution,
Het is vallen en opstaan :-)
Comment #47
sam152 commentedComment #48
tamarpe commentedApplied the patch and it works well! thank you :)
Comment #49
greg boggsSo, I tried the patch and everything seems to have gone smoothly, but then I noticed on reports that it says the moderation entity is out of date. So, I tried drush entity-updates.
Any ideas?
```
The following updates are pending:
content_moderation_state entity type :
The Content moderation state entity type needs to be updated.
Do you wish to run all pending updates? (y/n): y
Drupal\Core\Entity\EntityStorageException: Exception thrown while [error]
performing a schema update. SQLSTATE[HY000]: General error: 1709
Index column size too large. The maximum column size is 767 bytes.:
ALTER TABLE {content_moderation_state_field_data} ADD UNIQUE KEY
`content_moderation_state__lookup` (`content_entity_type_id`,
`content_entity_id`, `content_entity_revision_id`, `workflow`,
`langcode`); Array
(
)
in
Drupal\Core\Entity\Sql\SqlContentEntityStorage->wrapSchemaException()
(line 1513 of
/mnt/www/html/shatterproofdev/docroot/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
```
Comment #50
sam152 commentedHi @Greg Boggs, it looks like you skipped one of the earlier patches: #2890189: Unofficial content_moderation 8.3.2 to 8.3.3 upgrade path. They will run fine out of sequence, but I suggest you simply copy the code out into some custom modules install file. Rerolling and reverting schema is going to be a pain.
Comment #51
greg boggsThanks Sam!
Comment #52
wturrell commentedFor anybody still fixing a broken site, here's a sandbox with Sam152's 8.3.2->8.3.3 patches (see #30 and #50) rolled up into a module you can just install.
https://www.drupal.org/sandbox/wturrell/3000331
git clone --branch master git@git.drupal.org:sandbox/wturrell-3000331 content_moderation_patch