November Happy Hour will be moved to Thursday December 5th.

Version count and deletion of old versions

Vote:
 
Hello, First, is it possible in the framework to set a version count (like EPnVersionCount) for a specific page type? What i want to accomplish is having unlimited version on all but one page type, where i want to have like 15-20 versions max. Second, how do i remove old revisions of a page to accomplish the above scenario? E.g. a page has 500 versions, and i only want to keep the latest 20. What tables do need to remove rows from and how would that be done? One problem that occurs when changing the global EPnVersionCount value in web.config is that the website hangs and timeouts. I guess this has to do with the amount of pages that needs to be deleted and therefor it timesout. I have increased the EPnQueryTimeout to several hours but timeouts still occur. Thanks. C.
#12941
Feb 16, 2007 13:34
Vote:
 
The version in question is 4.51.5.145. Just found some code that was able to resolve this issue but only for 4.61. Going to have a look at that first.
#15126
Feb 16, 2007 13:37
Vote:
 

Hi Christer,

I am also interested in doing something similar to what you have spoken about in this post. The Max Versions attribute doesn't have any effect on the 'Not ready' versions and I would like them limited as well. Do you know if this is possible? Any advice would be gratefully recieved.

 Many Thanks,

Ella

#32704
Sep 14, 2009 14:12
Vote:
 

Hi

One way to do this is to attach to a suitable DataFactory event. For example SavedPage, that is executed every time a page is saved.

In that event you could load all the versions for that page and delete the ones that you do not want to keep any more. Something like this to delete all not ready versions:

foreach (PageVersion version in PageVersion.List(e.PageLink))
{
  if (version.Status == VersionStatus.CheckedOut)
    DataFactory.Instance.DeleteVersion(version);
}

I do not recommend deleting rows directly in the database.

Regards

Per Gunsarfs
EPiServer CMS development team

#32715
Sep 14, 2009 16:33
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.