deleting old versions of blocks

Permalink
Is there any reason why I should not delete all by the latest version of a block? I mean, technical reasons, not philosophical reasons ;) Will that break anything? I will do it anyway as a test, but I am wondering if it will have long term consequences

ntisithoj
 
mnakalay replied on at Permalink Reply
mnakalay
Old block versions are kept because pages are versioned. So you need them in case you want to revert to an older page version.

Simply deleting the old block version won't do anything as long as you stay on the latest page version.

What you should test is what happens if you delete them and then try to revert to an old page version.

A probably better way of doing it is deleting old page versions (using the job built for that) which should normally delete the corresponding block versions.
ntisithoj replied on at Permalink Reply
ntisithoj
Thanks. I'm curious, if I delete all the old versions of pages, then I can't revert to older versions, so why are the older versions of blocks kept? Shouldn't all the block version older than the last version of a page also be deleted? This question is what lead me to wonder if they are needed for other reasons I am not aware of.
mnakalay replied on at Permalink Reply
mnakalay
That exactly what happens. When deleting a page version, all the following items are deleted for the selected page version:
- blocks versions
- Collection features
- Page attributes
- Block styles
- Theme custom styles
- Area Styles
- Composer output

So as long as you delete page versions using Concrete5's core API functions, your block versions will also be deleted.

You can see the code in concrete\src\Page\Collection\Version\Version.php function delete()
ntisithoj replied on at Permalink Reply
ntisithoj
Thank for the feedback.

I see it does delete SOME stuff, but, for example, after I delete all old versions, then look in the collectionVersions table I still see 9 versions of a collection with comments like "Version 1", ":New Version 2", "Versions 3"... not what the diff is between "versions" and "new versions", but that's trivial. Other enters do show only one entry, so those are getting updated.

In theory, if a site has 100 pages total, shouldn't it have only 100 entries in collectionVersions?