#!/bin/sh
#
# Simple script to purge the mason cache
# http://requesttracker.wikia.com/wiki/CleanMasonCache
#
CACHE_DIR="__RT_CACHEDIR__/mason_data/obj/"

if [ ! -d "$CACHE_DIR" ]; then
        echo "Nothing to clean, the mason cache directory does not exist" >&2
        exit 1
fi

if [ "$CACHE_DIR" != "/" ] && [ "$CACHE_DIR" != "" ]; then
    find "$CACHE_DIR" -type f -exec rm -f {} \;
fi

if [ -x /usr/sbin/rcapache2 ]; then
    /usr/sbin/rcapache2 try-restart
fi
