Purging publishing destinations

Build 1501 on 14/Nov/2017  This topic last edited on: 24/Oct/2016, at 13:00

Overpopulated publishing destinations, containing thousands of content items, can seriously slow down the GN4 system and cause various malfunctioning. The default configuration of the GN4 system does not provide for an automatic purge of publishing destinations.

Therefore, you need to provide for the automatic cleanup of publishing destinations.

This may be achieved by scheduling a batch command file that exports from publishing destinations only the content you want to keep, and then reimporting it, overwriting anything else.

Important: this procedure must run on a GN4 server!

What you need to install?

You need to copy on a GN4 server two files:

ClearPubDests.cmd

ClearPubDest.xml

Copy both files in the folder of your choice, e.g. C:\TERA\GN4\BIN.

Customize the ClearPubDests.cmd as explained below. Customize the ClearPubDest.xml as explained in the paragraph ClearPubDest.xml.

Then, schedule the ClearPubDests.cmd to run every night out of the production hours.

ClearPubDests.cmd

This is the batch command file that performs the content export, unlocking of the publishing destinations and reimporting the content. The below code shows an example of such file. The parts highlighted in yellow are to be customized.

@ECHO OFF

rem ---------------------------

rem THIS IS JUST AN EXAMPLE

rem CHANGE THE PATH TO THE CLEARPUBDEST.XML AND IDS OF THE PUBLISHING DESTINATIONS TO UNLOCK FORCIBLY

rem v1.0 on 7/july/2014 (MP)

rem -------------------------

SET GN4PATH=C:\TERA\GN4\BIN

 

%GN4PATH%\srv4.exe export -conditions gn4:pubDest -opt %GN4PATH%\ClearPubDest.xml -out c:\temp\pubDests.xml -pars DaysToKeep:45

%GN4PATH%\srv4.exe unlock -ids 100,200,300,400

%GN4PATH%\srv4.exe import -in c:\temp\pubDests.xml

 

SET GN4PATH=

Notes

GN4PATH: the path on the server where are 64-bit GN4 executables.

C:\TEMP\PUBDESTS.XML: the path to the temporary file. If you do not have TEMP under C: root, adjust the batch file accordingly.

DaysToKeep: this applies on systems newer that 1.6, where you can pass the value as the parameter. For the 1.6 systems, the parameter is hard-coded in the XSL part of the ClearPubDest.xml. Search for DaysToKeep to locate it.

100,200,300... etc: these are ids of the publishing destinations to unlock during this maintenance. Replace with the ids of your publishing destinations, comma delimited.

ClearPubDest.xml

This is the export option:

Click to toggle expandClearPubDest code