Closed (fixed)
Project:
Revision Manager
Version:
1.0.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
4 Dec 2025 at 19:54 UTC
Updated:
19 Dec 2025 at 22:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
j-barnes commented@jura.khrapunov - Thanks for reporting this. I've been trying to replicate this locally with tests but no luck.
I've went ahead and added a few new group specific tests for your exact scenario.
All tests seem to pass, including the combined Age + Amount scenario you described.
When both plugins are enabled, revisions are only deleted if they appear in BOTH deletion sets (intersection):
A few questions to help debug:
Comment #3
jura.khrapunov commented@j-barnes, thanks for looking into this. I understand the logic and it works just fine for all other entities, but groups, unfortunately. Just a note - Group support was a sole reason to switch from node_delete_revision module which doesn't support them.
Group module version: 2.3.2
Drupal version: 11.2.5
Group revisions: for the test entity the oldest is from 2022, most recent is from a week ago
How many revisions exist vs your Amount threshold? 58 revisions exist, threshold in Revision manager is set to 10
Are the revisions published: yes, all of them
If it helps - I was able to delete excessive revisions via drush using another module of yours: drupal/revision_delete_tools , but it doesn't work for me as it is not working well with multilingual entities.
Comment #5
j-barnes commentedThanks for the extra details - I think I was able to replicate this. The issue appears to be in
EntityHelper::getEntityIds()- it was usingaccessCheck(TRUE)which triggers Group's access hooks when enumerating entities. During drush/cron runs, Group tries to check memberships and silently fails, so no entities get found for cleanup.The fix should be straightforward - change to
accessCheck(FALSE)since this is an admin operation and it follows the same pattern as core for batch processing.Opening a MR with a patch and test, let me know if it works for you.
Comment #6
j-barnes commentedComment #7
jura.khrapunov commented@j-barnes, I tried the patch you provided and it seems it does the job.
However, I noticed in our case we had fair amount of revisions (mostly very old) with status=0. Those revisions are not affected by cleanup but they are still taken into consideration for calculations of the number of revisions to retain, which leads to undesired results.
Here is an example:
Group has 50 revisions spread between 2022 and 2025 years. There are 10 revisions from 2022 with the status=0, so when Revision manager is configured to keep last 5 versions we are ending up with exactly 11 revisions - the most current one plus 10 very old which are kept because of their status=0.
Expected behavior would be to keep 5 most recent revisions (or any number within "Minimum age of revisions to keep" period). I'd also suggest to remove revisions with status=0 if there are newer revisions, is there particular reason to exclude them?
Comment #8
j-barnes commentedThanks for confirming the patch works and helping out with this.
Yeah, the
status=0accumulation is a valid concern. We protect unpublished revisions by design (could be draft work), but 3-year-old drafts are probably safe to clean up.I dug into how node_revision_delete handles this - they use a 3 state system keep/delete/no-opinion on each revision. I'm thinking of adopting that for 2.x, which would let us add a WorkflowState plugin:
That way you get separate policies for published vs draft cleanup. What do you think about that? We can spin this off into a separate issue.
Comment #9
jura.khrapunov commentedI think it is more logical to keep drafts which are more recent than the published revision only. If the new revision supersedes existing draft - in our editorial workflow it makes older version obsolete and subject for clean up. With "Minimum age of revisions to keep" it provides great flexibility to accommodate various scenarios, but frankly speaking if the draft is older than current published version - I don't see why it should be protected. if you would like to accommodate that scenario - it might be worth adding another checkbox to the RM settings: "Keep all drafts".
It is a different story if the draft is more recent than the published version and those must be preserved, but as far as I can see It is already discussed here: https://www.drupal.org/project/revision_manager/issues/3556356
Comment #10
jura.khrapunov commentedMy primary concern is that with drafts included into the calculations we are facing potential data loss - I'd expect to keep XYZ number of the most recent versions for the node, but instead it leaves me with the only one, which is currently published and random number of old drafts associated with the node.
Comment #11
j-barnes commentedYeah you're right - we can just protect forward drafts and treat old drafts as regular deletion candidates. Way simpler than what I was originally thinking...
Basically change the Amount / Age plugin from filtering by
status=1:To filtering by revision ID:
This also handles #3556356 (forward revisions) since they're automatically excluded from the query.
What do you think? I can throw together a patch with some tests to confirm it works as expected, it might be better on the other issue though.
Comment #12
jura.khrapunov commented@j-barnes I think you nailed it this time. Future revisions are not included and the rest is processed using common logic. Happy to test the patch on the real database clone.
Comment #13
j-barnes commentedThanks again for taking the time to test this out, added the new patch.
Comment #14
jura.khrapunov commentedWorks as expected now, but another issue popped up as long trail of unremoved drafts is not covering it now - algorithm is not aware of translations and count all respective revisions together, same as https://www.drupal.org/project/revision_delete_tools. I'll open a separate ticket for that issue as this one is apparently fixed now.
Thank you for spending time on this, really appreciated.
Comment #15
j-barnes commentedAwesome, glad it's working now. Thanks for testing - good catch on the translation issue too, I'll take a look.
Comment #16
j-barnes commented