Это старая версия документа!
Содержание
Обслуживание системы DokuWiki
В этом разделе собраны советы о том, как автоматизировать работы по ежедневному обслуживанию DokuWiki.
Поддерживайте актуальность блэклиста
В статье blacklist описано как настроить cronjob для автоматического обновления Anti-Spam Blacklist.
Скрипт автоматической чистки
Для за загруженных DokuWiki рекомендуется запустить несколько процессов чистки. Приведенный ниже скрипт может служить примером, того как это можно сделать. Он удаляет все ревизии старше 30 дней из пространства имен attic и удаляет повисшие файлы блокировки 1) и пустые директории.
#!/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 {} \;
Для запуска этого скрипта автоматически настройте cronjob. Следующий пример запускает скрипт каждый день в 00:05
5 0 * * * /full/path/to/cleanup.sh
Убедитесь, что вы все настроили правильно. Вы ведь не хотите удалить что-нибудь не то?
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/