Auto-delete editions and linked content

Build 1501 on 14/Nov/2017  This topic last edited on: 11/Feb/2016, at 13:17

You may want to automate deleting and purging of editions, to auto-delete all archived editions after X days of edition date.

Create a custom scheduled task for that purpose.

1.On a GN4 server, create a file with search conditions to locate all archived editions after X dats of edition date, and save it in a suitable folder.

An example of the search condition that finds all editions in workstate Archived and edition date after 2 days may be:

<SearchConditions xmlns="http://www.teradp.com/schemas/GN4/1/SearchConditions.xsd"

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ObjectTypeName="edition">

  <SearchNode xsi:type="ConditionSearchNode" Op="And">

 

    <Left xsi:type="ConditionSearchNode" Op ="Equal">

      <Left xsi:type="AttributeSearchNode" Path="edition.workstateRef.name"/>

      <Right xsi:type="StringSearchNode" Value="Archived"/>

    </Left>

 

    <Right xsi:type="ConditionSearchNode" Op="After">

      <!-- This is the attribute used to determine the age of the object -->

      <Left xsi:type="AttributeSearchNode" Path="edition.date"/>

      <!-- This is the specification of how old: day.hours:minutes:seconds -->

      <Right xsi:type="DateTimeRelativeSearchNode" Interval="-2.00:01:00"/>

    </Right>

  </SearchNode>

</SearchConditions>

 
Feel free to change the workstate name and the number of days value.

2.On a GN4 server, create a batch command file with a following command (all in one line):

srv4 spike 

-conditions conditionsfilename

-extend master.editionRef,page.editionRef,extDoc.editionRef,pageLayer.pages,txtGeometry.txtRef,txtGeometry.jumps,pagePreview.pageRef,article.pageLayers.pageRef,webComment.objectRef 

-extendunref linkObject.pageLayers.editionRef,linkObject.pageLayers.pageRef,linkObject.pageLayers.layerRef,pageLayer.txtGeos 

-unref linkObject.assigns,linkObject.assigns.pageRef,linkObject.assigns.extDocRef,pubDest.objs,pubDest.preObjs 

–recurse

srv4 cleanup -purge 2.06:00

Replace conditionsfilename with the full path to your conditions file, and change the highlighted values.

2.In Windows, create a scheduled task that runs every day at a time at your choice and executes the above batch file.

The above auto-deleted all archived editions after X days of edition date, and purges all content that is deleted longer than 2 days and 6 hours.