Clearing down Versioning files

Lenya keeps a copy of all content changes made on a file. This is a very good thing, but from time to time, you may need to clear down this extensive file change history.

Lenya also keeps a log file of user task actions carried out. These too may need, from time to time, to be cleared down.

File Version Back ups

After a file is edited a back up of the old file version is stored. Backed up files for a publication are stored in the following directory relative to a publication:

/content/rcbak/content/authoring

Task Log back ups

Lenya also maintains a log of each task executed within the following directory relative to a publication:

\logs\tasks

Perl Script

The attached script clears down both lenya version history and task logs. lenyaArchive.pl

Usage:
lenyaArchive.pl [-h | -r | -d | -a] archiveDate [archiveRootDir]

-h: Displays usage information

-r: Runs the script in report mode. No actions are taken. A list of files to be archived is printed to standard out

-d: runs in delete mode. Files identified to be archived are deleted with no back-up. DATA WILL BE LOST

-a: runs in archive mode. Files identified to be archived are copied to the archive location and orignal files removed.

archiveDate: Files older than this date will be actioned. Format is dd-mm-yyyy

archiveRootDir: full directory path to where files are to be archived.

For a successfull run you will also need to amend the script to be specific to your publication. In short change the following variable assignments to match your publication / requirements.

........

# publication specific set up

$args{'mount'}="c:";

$args{'pubRootDir'}="/tomcat-5.0.28/webapps/lenya/lenya/pubs/";

$args{'pubName'}="default";

$args{'workArea'}="authoring";

$args{'relativeLogStoreDir'}="/logs/tasks";

$args{'relativeVersionStoreDir'}="/content/rcbak/content/";

# default archive area. maybe over written by cmd line argument
#make sure this directory exists !!!!!

$args{'archiveRootDir'}="d:/test/archive/";

.........

Example Usage:

lenyaArchive.pl -h

prints usage info.

lenyaArchive.pl -r 01-01-2005
Lists files which are older than 01 jan 2005.

lenyaArchive.pl -d 01-01-2005
Deletes files older than 01 jan 2005.

lenyaArchive.pl -a 01-01-2005
copies files older than the 01 jan 2005 to the default archive location.
Files then deleted.

lenyaArchive.pl -a 01-01-2005 d:/mySpecialArchiveDir
copies files older than the 01 jan 2005 to the specified archive location.
Files then deleted.

I've tested a little and runs okay on my set up. It should run on most os but comment if you have issues. The user executing this script will need enough welly to write files to the archive location and to read the log/version files for the publication. This script could cause damage if used incorrectly. Goes without saying used at own risk.

  • No labels