Translations of this page?:

Maintenance

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 {} \;

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?

What about Windows? :-)
Poor Windows! :-) A good script for cleaning out old files on windows is 'warmzip', available from here on Sourceforge. Write a batch file to call it, and schedule it to run every day. And as the man says: 'Be sure to set everything up correctly' ;-)

I took the above suggestion to use waRmZip and wrote this batch file - maybe it will help out.

The latest version of DokuWiki stores the lock files in in the /data/locks directory (the above shell script doesn't reflect this).

My favorite way to run cron jobs on Windows is PyCron.

@echo off
set waRmZip="c:\Program Files\waRmZip\waRmZip.wsf"
set wikiHome="c:\path\to\htdocs\wiki\data"
 
rem Move attic files older than 30 days to an archive location
%waRmZip% %wikiHome%\attic /ma:30 /md:%wikiHome%_archive\attic /r /q
 
rem Option: delete attic files older than 30 days
rem %waRmZip% %wikiHome%\attic /da:30 /dc /r /q
 
rem Delete empty attic directories; waRmZip requires the /da flag when using
rem /df, so add filter for *.zzz so /da doesn't remove any files
%waRmZip% %wikiHome%\attic /r /da:31 /df /fo:*.zzz /q
 
rem Remove stale lock files
%waRmZip% %wikiHome%\locks /da:1 /fo:*.lock /r /q
 
rem Remove empty directories
%waRmZip% %wikiHome%\pages /da:365 /df /fo:*.zzz /r /q

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/pages/playground/

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

0,30 * * * * cp -rpf /path/to/savedwiki/data/wiki/ /path/to/dokuwiki/data/pages/wiki/
 
wiki/tips/maintenance.txt · Last modified: 2008/03/27 19:45 by 63.202.159.250
 
Imprint Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
WikiForumIRCBugsTranslate