Delete versions of files
Permalink 1 user found helpful
On version 5.3.1, I have deleted an older version of a PDF via the appropriate dashboard interface. The version is correctly deleted from the database but the file is still found on the filesystem.
1. Is this meant or is this a bug I should report? Is there some sort of maintenance script that purge such orphan files?
2. Is there an existing way to 'maintain' the system by deleting old versions (by date, or by number - i.e. keep only 5 versions of page/files)?
Cheers.
1. Is this meant or is this a bug I should report? Is there some sort of maintenance script that purge such orphan files?
2. Is there an existing way to 'maintain' the system by deleting old versions (by date, or by number - i.e. keep only 5 versions of page/files)?
Cheers.
the files aren't moved like themes into the trash folder and remain in the original folders
I would also be interested in setting a cap to the number of version any particular file could have.
Like retain the last 5 or 10 versions of the file - when a new edit is made, the oldest version is automatically removed.
I've notice that there is a way to remove the versions by individually removing older versions on each file, but on a large site with lots of edits this will become burdensome.
I'm dealing with around 1,000 pages on an existing site and once I get it transferred into C5 I'm looking at somewhere between 6-10k versions of files (lots of edits / updates) - seems like a waste to keep everything when only the last 1-2 versions will ever be used.
So any ideas for automatically limit the number C5 saves? Does it do this now?
Thanks!
Like retain the last 5 or 10 versions of the file - when a new edit is made, the oldest version is automatically removed.
I've notice that there is a way to remove the versions by individually removing older versions on each file, but on a large site with lots of edits this will become burdensome.
I'm dealing with around 1,000 pages on an existing site and once I get it transferred into C5 I'm looking at somewhere between 6-10k versions of files (lots of edits / updates) - seems like a waste to keep everything when only the last 1-2 versions will ever be used.
So any ideas for automatically limit the number C5 saves? Does it do this now?
Thanks!
those things are wide open :) It is a bit late here but i am sure file versions are stored in the db and you can certainly just get a chronological sort and run a delete method on anything older than your arbitrary #. Run it daily and keep the last 5 or whatever you are comfortable with.
Hé wombat,
I ran into the samen issue. Over 8000 large images on the disk with our real estate connector (NVM Realworks), while we only had 3000 different files in the library. It's build to update any changed image, but would like to remove the older versions immediately.
Here is a small function i made, which loops all versions of a file (fID) and unlinks + deletes the not active versions. For stats in a long batch, it returns the number of fileversions deleted.
Anyone running into this problem try this function. If you're having trouble, let me know.
I ran into the samen issue. Over 8000 large images on the disk with our real estate connector (NVM Realworks), while we only had 3000 different files in the library. It's build to update any changed image, but would like to remove the older versions immediately.
Here is a small function i made, which loops all versions of a file (fID) and unlinks + deletes the not active versions. For stats in a long batch, it returns the number of fileversions deleted.
private function del_old_versions($fID) { $f = File::getByID($fID); $i=0; foreach($f->getVersionList() as $key => $fv) { if(!$fv->isApproved()) { $path = $fv->getPath(); if (unlink($path)) { $i++; $fv->delete(); } }
Viewing 15 lines of 18 lines. View entire code block.
Anyone running into this problem try this function. If you're having trouble, let me know.
NUL76, I'm intrigued by this solution, having struggled with this old version problem, too. Excuse my ignorance, but how do you implement this script, where does it go? Are you just appending it to the standard Concrete file block? Or...?
Hi Abberdab,
It depends where or when you need it.
We implemented this in a job which imports files. If you don't do this, you could make a job like the one that deletes older page versions. And set a cronjob to automatically run it.
Hope this helps!
It depends where or when you need it.
We implemented this in a job which imports files. If you don't do this, you could make a job like the one that deletes older page versions. And set a cronjob to automatically run it.
Hope this helps!
but there is nothing actually deleting the file from the filesystem.
So -> for Question 1. I'll submit a bug.
Question 2. though is still very much something I'd like to hear about.