Remove Old Page Versions Automated Job - behaviour query

Permalink 1 user found helpful
Hello,
I just need to check I'm not going mad.
I understood that this job removes all but the last 10 page versions.
The documentation also says the same.

I've never actually paid too much attention to this task but in running it on a local dev instance I noticed it deleting everything apart from the approved version, the most recent version and the 10 earliest versions.

All of the other versions are deleted:

for example I might have 50 versions with 50 as the approved version - 49 as the most recent and 1-48 as the older versions.

If I run the job it deletes versions 47 down to 10, preserving the initial 10 versions.

I ran this on another dev server (not local) and experienced the same results.

Looking at the code for that job it is the array_reverse that is causing this issue in the loop that deletes the old versions.

Can anyone else confirm this behaviour?

 
designportfolio replied on at Permalink Reply
designportfolio
We also found the same. Was not happy when it was run and was left with pages with hardly anything on being the first 10!
Should the array be altered to do it the other way around then?
WebcentricLtd replied on at Permalink Reply
I believe I just removed the array_reverse but can't remember exactly now. This might have been fixed in later versions.
Dushka replied on at Permalink Reply
Dushka
I am having a different problem with this job. When I run it, it does nothing. The instant I hit "Run", I get a message "0 versions deleted from 0 pages".
ConcreteOwl replied on at Permalink Reply
ConcreteOwl
I was also unhappy about the way old versions were removed and ended up creating my own code to do that job,
I created a "single page" with my custom code and it works for me on several sites I maintain,
You use it at your own risk and I would recommend testing it on a development server first. The code for the single page is below..
<div style="background-color:#ccc; padding:20px; border-radius:8px">
<p style="color: #000">Pages in Edit Mode:</p>
<p style="color: red; font-weight:bold">
              <?php 
                Loader::model('page_list'); 
                $pl = new PageList(); 
                $pl->filter('p1.cIsCheckedOut', '1', '='); 
                $pages = $pl->get();
                foreach($pages as $page)
                {
                echo $page->getCollectionName();
                echo "<br>";
                } ?>
</p>
<br>
Dushka replied on at Permalink Reply
Dushka
Many thanks, David. I will give it my best shot. I'm no PHP savant, so it may take me a while, but I will definitely have a go.
JohntheFish replied on at Permalink Reply
JohntheFish
The core job only removes old versions from 3 pages at a time. You need to run it X times (X=num_pages_on_site/3) to clear up all pages.

If you are pre c5.7, my Extreme Clean job can do a more extreme cleanup all in one click.
https://www.concrete5.org/marketplace/addons/extreme-clean/...
Dushka replied on at Permalink Reply
Dushka
Hello, John. I have your Extreme Clean add-on (many thanks), but I have now made the move to 5.7 and intend to stay with it in spite of its bugs. Any chance of updating EC for this version?
Actually, I would be interested to know if others are having the same problem I am with the Remove Old Versions utility. I have Concrete5.7.3 installed both locally and online, and am having the same problem with both installations — it doesn't remove any old versions from any pages, no matter how many times I run it. I groan at the thought of having to manually delete them. I am hoping David's contribution will obviate the need to do that. (Thanks again, David.)