Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orphaned revisions #541

Open
murphy1484 opened this issue Oct 12, 2023 · 5 comments
Open

Orphaned revisions #541

murphy1484 opened this issue Oct 12, 2023 · 5 comments

Comments

@murphy1484
Copy link

Describe the bug

It seems that supertable blocks nested inside a matrix field are not being deleted when the element revisions are pruned.
When running php craft utils/prune-revisions I get following results for the supertable elements.

- SuperTable Block 29354 (23 revisions) ... done (found 0)
- SuperTable Block 29355 (23 revisions) ... done (found 0)
- SuperTable Block 29356 (23 revisions) ... done (found 0)
- SuperTable Block 29560 (22 revisions) ... done (found 0)
- SuperTable Block 29561 (22 revisions) ... done (found 0)
- SuperTable Block 29562 (22 revisions) ... done (found 0)
- SuperTable Block 29563 (22 revisions) ... done (found 0)
- SuperTable Block 30665 (9635 revisions) ... done (found 0)
- SuperTable Block 30666 (9635 revisions) ... done (found 0)
- SuperTable Block 30667 (9635 revisions) ... done (found 0)

Steps to reproduce

  1. Supertable blocks inside matrix field
  2. Run php craft utils/prune-revisions --max-revisions=5

Craft CMS version

4.4.15

Plugin version

3.0.12

Multi-site?

Yes

Additional context

No response

@jlawrence-yellostudio
Copy link

@engram-design What is the recommended way of cleaning these up? I have over 12000 of them

@engram-design
Copy link
Member

Still investigating this, as the built-in pruning utility doesn't seem to cater for Super Table in some instances.

@jlawrence-yellostudio
Copy link

@engram-design Thanks for replying. I am not sure this is isolated to Super Table blocks, the following issue could suggest the native matrix does it too:

craftcms/cms#15843

My output is very similar to reported there.

Screenshot 2024-10-10 at 11 54 57

If I query the owner elements (primaryOwnerId) of 775 of these Super Table Block Elements (all ones with 200+ revisions), only 83 of them exist. I believe they are all likely children of MatrixBlocks.

Screenshot 2024-10-10 at 12 08 19

Overall I have 97,217 non orphaned SuperTableBlockElement rows.
When i check my DB for:

SELECT * FROM elements WHERE type = 'verbb\\supertable\\elements\\SuperTableBlockElement' AND id NOT IN(SELECT id FROM supertableblocks)

I get 460k orphaned rows returned with dates ranging from Jan 2021 to a few weeks ago, i am running the latest version of Craft 4.12.5.

As you can imagine, that and the associated data is taking up a fair bit of space across all environments.

@engram-design
Copy link
Member

It does seem to include Matrix as that linked issue mentions. I’m chatting to Brandon about it.

@jlawrence-yellostudio
Copy link

jlawrence-yellostudio commented Nov 1, 2024

@engram-design Any movement on this? i would have thought the orphan cleanup utility should remove elements with type verbb\supertable\elements\SuperTableBlockElement that are present in the elements table but not in the supertableblocks table?

Whilst i could delete all these elements, I'm wary of the fact i'll have to keep deleting them as the issue is still current and not a previously fixed bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants