Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Martin 1 post 72 karma points
    Sep 04, 2018 @ 13:27
    Martin
    1

    Hi, 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?

    Regards!

  • Jeroen Vantroyen 6 posts 86 karma points
    1 week ago
    Jeroen Vantroyen
    0

    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)

Please Sign in or register to post replies

Write your reply to:

Draft