メンテナンス

Here are some tips to automate some of the day-to-day maintenance needed for Dokuwiki

Keep Blacklist up to date

See blacklist on how to set up a cronjob to keep the Anti-Spam Blacklist current

Automatic cleanup script

It is recommended to set up some cleanup process for busy DokuWikis. The following script is an example how to do that. It deletes all revisions which are older than 30 days from the attic and removes stale lock files and empty directories.

#!/bin/sh
 
# set the path to your DokuWiki installation here
DOKUWIKI=/path/to/your/wiki
 
# purge files older than 30 days from the attic
find $DOKUWIKI/data/attic/ -type f -mtime +30 -exec rm -f {} \;
 
# remove stale lock files
find $DOKUWIKI/data/pages/ -name '*.lock' -type f -mtime +1 -exec rm -f {} \;
 
# remove empty directories
find $DOKUWIKI/data/pages/ -depth -type d -empty -exec rmdir {} \;
Should we include a line to clean out the meta directory too?

find $DOKUWIKI/data/meta/ -depth -type d -empty -exec rmdir {} \;

To run it automatically, set up a cronjob. The following example calls the script every day 5 minutes after midnight:

5 0 * * *   /full/path/to/cleanup.sh

Be sure to set everything up correctly - you don't want to delete the wrong things, do you?

Keeping Playground Clean

To keep the wiki's Playground and other pages clean, use a cron job every 30 min, that restores Playground and other pages to their original content.

Example: Restore PlayGround every 30 min:

0,30 * * * * cp -rpf /path/to/savedwiki/data/playground/playground.txt /path/to/dokuwiki/data/playground/

Example: Restore all pages in namespace “wiki” every 30 min:

0,30 * * * * cp -rpf /path/to/savedwiki/data/wiki/ /path/to/dokuwiki/data/wiki/