- First commit to issue fork.
- Merge request !7554Issue #3218351: Field storage optimization breaks workbench_moderation → (Open) created by apaderno
- last update
8 months ago 2,179 pass
The field storage optimization added in Drupal 7.79 breaks the 'workbench_moderation' module as described in #3217490: Field storage optimization breaks content moderation → .
Copy-pasting the steps to reproduce from #3217490: Field storage optimization breaks content moderation → :
- Download Drupal core version 7.79 or later and install using the standard profile.
- Note the settings.php will contain this line by default:
$conf['field_sql_storage_skip_writing_unchanged_fields'] = TRUE;
- If that line is not present in settings.php, add it.
- Download and enable Workbench Moderation latest stable release and its dependencies: Drafty, Entity. Leave all of the defaults when installing.
- Edit the Article content type to turn on moderation: At admin/structure/types/manage/article, check the boxes Create new revision and Enable moderation of revisions. Save the content type.
- Add an article. At node/add/article, enter "New article" in the Title field and "Initial draft of article" in the Body field.
- Select the Publishing Options vertical tab and change the Moderation State dropdown to Published.
- Save the article.
- Note the article is published and contains the correct title and body text.
- Click New Draft to create a new draft of the article.
- Add another line of text to the Body field.
- Save the draft without changing the moderation state in the Publishing Options tab. The new revision should be in Draft status.
- You will see the new line of body text on the Draft tab, but not on the View Published tab.
- Click the Moderate tab.
- In the moderation state dropdown, choose Published and save the settings.
- Note that the new line of text is not displayed on the published version.
The problem is that workbench_moderation needs to copy all field values from an older, pre-existing revision (ie. the data stored on the field_revisions_body
table) to the current field values (ie. to field_data_body
). I used the 'body' field as an example, but this has to work any field type. Unfortunately, the Field API only really provides a way to do this by actually saving the node.
So, while the 'workbench_moderation' module could attempt a number of fixes on its own (for example, doing it's own SQL to copy the values, or messing with $node->original
to prevent the optimization from happening), they'd all be sort of hacky and probably have some unexpected side-effects or edge cases where they wouldn't work.
Of course, you can just disable the new field storage optimization on sites that use 'workbench_moderation', but that means those sites won't be able to take advantage of this optimization, which should work fine when not moderating content through 'workbench_moderation'.
So, I'd like to propose making it possible to opt out of the optimization for a single node_save()
operation by setting a special property on the node, like:
$node->skip_field_sql_storage_optimization = TRUE;
node_save($node);
None.
A special entity property named 'skip_field_sql_storage_optimization' that will affect how that entity will be saved when using field_sql_storage.
None.
TODO
Needs review
7.0 ⚰️
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.