Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I try to delete old versions for only one node type, but not working. In the unversion.config file I have this:
<add docTypeAlias="post" rootXpath="//node[@nodeTypeAlias='post']" maxDays="100" maxCount="1" />
I tried change this configuration by this line:
<add maxDays="2" maxCount="1" />
but still not working at all. I understand, with this configuration I have 2 days past versions and only one version per day, correct?
Another question, when the plugin code executes? I think executes when I publish a version but I am not sure.
Can you help me please?
I've been playing with this today.
The code executes when you publish an item (not just save).
<add maxDays="10" maxCount="5" />
will retain no more than 5 versions, IF they are no more than 10 days old.
MaxCount does not mean 5 version per day, but total.
e.g. if you have 5 versions of this file, but only 2 are less than 10 days old, only those 2 will be retained.
Your sample will only retain 1 version. If that is your desire, you can omit the maxDays property.
The code that determines of a version is to be retained :
var daysDiff = (DateTime.Now - versionDate).Days;
if (published || newest || (daysDiff < configEntry.MaxDays && readerIndex <= configEntry.MaxCount))
versionsToKeep.Add("'" + versionId.ToString("D") + "'");
You say it is not working. Can you elaborate? Do you experience a bug or are you still seeing old versions in the database?
The easiest way to verify how many versions you have left, is go to the Info tab, select Actions > Rollback and count the items in the dropdown.
(see also my earlier post)
We have this set up on an Umbraco version 7.8.1 site, and what I noticed was this...
If my config includes:
<add docTypeAlias="PressRelease" maxCount="5" />
then I Publish a PressRelease content node which has more than 5 versions (according to the Rollback list), now there are zero versions (according to the Rollback list)...
This is using UnVersion 2.1, which I assumed was using the MaxInt value for the maxDays param, so wouldn't that mean that irrespective of the age of the versions, 5 should be saved?
So, I changed the config to:
<add docTypeAlias="PressRelease" maxDays="10000" maxCount="5" />
and I downloaded/recompiled the sourcecode (so I could step-through-debug it), and my issue is now gone.
I'm not sure if the config change fixed it, or if the sourcecode had some improvement since the 2.1 package...
FYI for troubleshooting, you can add this to the bottom of your log4net.config file:
<level value="DEBUG" />
And you will see the actual SQL statements in your Umbraco log file.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted