Deleting pages having the badge Delete This Page
For moin up to 1.2.x only.
Until there is an integrated solution for deleting pages matching some criteria, at least Linux/UNIX users can use this script. We use the DeleteThisPage WikiBadge (without the markup) to mark pages to be deleted.
If there is no activity on these pages and they do not exceed a maximum size (enough for the badge and a redirect or other short info), they get removed automatically.
Calling the script via /etc/cron.daily/pagereaper:
/usr/local/bin/PageReaper.sh /home/of/my/wiki
PagerReaper.sh:
# Page reaper for Wikis
# search directory PAGES for pages that contain the string DeleteThisPage and were not written to in the last DAYS days.
# The found pages will be moved to the DELETED directory with a UNIX timestamp attached.
# NO WARRANTY. USE ON OWN RISK. Released under GPL.
# give base directory on the commandline
PAGES=$1/data/text
DELETED=../deleted
DAYS=14
MAXSIZE=100
DELETEBADGE=DeleteThisPage
DATE=`date +%s`
cd $PAGES
if [ -f StartSeite ] || [ -f FrontPage ]; then
mkdir $DELETED 2>/dev/null
for i in `find -mtime +$DAYS -size -$MAXSIZE -exec grep -l $DELETEBADGE {} \;` ; do
FN=`basename $i`
mv $FN $DELETED/$FN.$DATE
if [ -d CVS ]; then
cvs remove $FN > /dev/null
fi
done
else
echo "No Wiki here."
fi