Инструменты пользователя

Инструменты сайта


Боковая панель

Этот перевод старее, чем оригинальная страница, и может быть неактуальным. Смотрите, что было изменено.
Перевод этой страницы?:

О «Докувики»

Дополнительные возможности

Для предпринимателей

Наше сообщество


Следуйте за нами на Фейсбуке, в Твиттере и других социальных сетях.

Конфиденциальность (англ.)

ru:tips:maintenance

Это старая версия документа!


Обслуживание системы DokuWiki

В этом разделе собраны советы о том, как автоматизировать работы по ежедневному обслуживанию DokuWiki.

Поддерживайте актуальность блэклиста

В статье blacklist описано как настроить cronjob для автоматического обновления Anti-Spam Blacklist.

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?

Script for multiple installations

The following Bash script is more handy for multiple installations of DokuWiki. It also shows how to use find with -print0 and xargs.

#!/bin/bash
 
function cleanup {
 
  # $1 ... full path to data directory of wiki
  # $2 ... number of days after which old files are to be removed
 
  # purge files older than $2 days from the attic
  find "$1"/attic/ -type f -mtime +$2 -print0 | xargs -0r rm -f
 
  # remove stale lock files (if older than 2 days)
  find "$1"/pages/ -name '*.lock' -type f -mtime +2 -print0 | xargs -0r rm -f
 
  # remove empty directories
  find "$1"/pages/ -depth -type d -empty -print0 | xargs -0r rmdir
}
 
# cleanup my wiki installations (path to datadir, number of days)
# some examples:
 
cleanup /home/user1/htdocs/doku/data              256
cleanup /home/user2/htdocs/mywiki/data            180
cleanup /var/www/superwiki/data                   180

Windows -- warmzip

A script for cleaning out old files on Windows systems 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/pages/wiki/ /path/to/dokuwiki/data/pages/wiki/
ru/tips/maintenance.1253016279.txt.gz · Последнее изменение: 2009-09-15 14:04 — 93.91.4.119