Needs work
Project:
Drupal core
Version:
main
Component:
workflows.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Aug 2017 at 12:25 UTC
Updated:
15 Aug 2025 at 01:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
amateescu commentedThis is what I had in mind. I tested it manually and it works, but we still need automated test coverage.
Comment #3
sam152 commentedThe
ContentModerationStateentity exists so that content_moderation could be uninstalled, with moderated content, while it was experimental. The editorial workflow config entity also has a dependency on content_moderation, so I assume that'd also be deleted if someone tried to uninstall content_moderation.Does this patch stop implementations like content_moderation deciding that they can safely clean up on uninstall?
Comment #4
amateescu commentedNope, because
\Drupal\content_moderation\Plugin\WorkflowType\ContentModeration::workflowHasData()decides whether it has data or not based on the existence ofcontent_moderation_stateentities using that workflow. After we delete those entities, the method will return FALSE so the Content Moderation can be uninstalled :)Here's the required test coverage. A test-only patch is not needed because this is a new functionality for the Workflows module.
Comment #5
sam152 commentedSo in the case of the
content_moderationplugin, it can't be uninstalled without the relevant data being purged anyway, so does this solution add any checks and balances we don't already have?In the case of an implementation that provides a
@FieldType, core has similar protections for modules providing field types built in, so this wouldn't affect that either right?In another completely hypothetical use of
@WorkflowType, who is to say uninstalling the module doesn't also remove the associated thing-being-workflowed™, even if that thing isTRUEforhasDataand that's the expected and intended behavior?Comment #6
amateescu commentedNope, this doesn't change anything for
content_moderation:)Right.
If
hasDatareturns TRUE for whatever reason, it means that there *must* be a way to remove that data, just like field types can be uninstalled by removing all fields that use them.Comment #13
ranjith_kumar_k_u commentedRe-rolled #4 for 9.4.
Comment #14
ranjith_kumar_k_u commentedFixed CS errors.
Comment #19
acbramley commentedNeeds a reroll into an MR and quite a bit of refactoring to be in line with modern practices (strict types, etc)
Do we have an example workflow type in contrib that would benefit from this? I.e workflowHasData returns TRUE when there are no entities provided by the module?