Not logged in. · Lost password · Register
Forum: General Help and Support Installation and Configuration RSS
Cache maintenance
Page:  1  2  next 
Avatar
xrat #1
Member since Nov 2009 · 19 posts · Location: Vienna, Austria
Group memberships: Members
Show profile · Link to this post
Subject: Cache maintenance
I was surprised that http://www.dokuwiki.org/tips:maintenance actually says nothing about keeping the /cache/ directory clean. Is a regular cleanup recommended or is DW removing old outdated files automagically?
Avatar
andi (Administrator) #2
User title: splitbrain
Member since May 2006 · 3471 posts · Location: Berlin Germany
Group memberships: Administrators, Members
Show profile · Link to this post
It isn't that easy because even if a cache file wasn't modified for a long time, it might still be used. If your filesystem supports access times, you could use a find command to find files that haven't been access for a long time and delete them. If you filesystem has no atimes, deleting based on mtimes wouldn't hurt, since everything in cache will be rebuilt if missing...
Read this if you don't get any useful answers.
Lies dies wenn du keine hilfreichen Antworten bekommst.
Avatar
andi (Administrator) #3
User title: splitbrain
Member since May 2006 · 3471 posts · Location: Berlin Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Oh and to answer your question: no, DokuWiki does not delete from cache automatically.
Read this if you don't get any useful answers.
Lies dies wenn du keine hilfreichen Antworten bekommst.
Avatar
xrat #4
Member since Nov 2009 · 19 posts · Location: Vienna, Austria
Group memberships: Members
Show profile · Link to this post
Thanks andi,

So, clearly, maintenance is recommended. This should be stated on http://www.dokuwiki.org/tips:maintenance (I'll do it unless someone else is faster).

In order to provide some basic means for cleanup I suggest to remove old files based on their modification times (mtime). Smaller installations will have moderate and in general longer retention times so that removing cache files at the same time as old revisions will not hurt.

I.e., if we have ($1 = the path to the data dir)
# purge files older than $2 days from the attic
find "$1"/attic/ -type f -mtime +$2 -print0 | xargs -0r rm -f
I'd add
# purge files older than $2 days from the cache
find "$1"/cache/?/ -type f -mtime +$2 -print0 | xargs -0r rm -f
+ a pointer to this thread should sufficient.

Any objections?  :-)
Avatar
xrat #5
Member since Nov 2009 · 19 posts · Location: Vienna, Austria
Group memberships: Members
Show profile · Link to this post
I have now overhauled the http://www.dokuwiki.org/tips:maintenance page, also adding stuff for cache maintenance, of course. HTH.
Avatar
goldseed #6
User title: V_L
Member since Sep 2010 · 5 posts · Location: Seoul, Korea
Group memberships: Members
Show profile · Link to this post
Subject: Oops...
I used dokuwiki for years... (thanks, Andi !!).

For my dokuwiki, I am using commercial web service with 1 GB storage limit,  Recently It frequently exeeds limit...

but I did not know I must do manual maintenance procedure..

My server do not allow to use crontab or ssh connection, I can use only ftp.

Can You suggest maintenance commands which can  be used via FTP protocol in WINDOWS or linux?
http://vaslor.net
Avatar
gesders #7
Member since Apr 2011 · 1 post
Group memberships: Members
Show profile · Link to this post
Subject: dummy
yes i´m a dummy and yes i appreciate your gratitude to answer on dummy questions and yes i did some search and i didn´t find a answer to my following question :blush: :

have i to restart apache on my windows home server after changing something in
conf/dokuwiki.php
?

and yes i did a backup.

i use dokuwiki in my very small business intranet (around 10 boxes, win and ubuntu) as information- and documentation tool since 4 month and it works well, so i want to upgrade my skills from dummy to senior dummy. :scared:
mfg

wge
This post was edited on 2011-04-20, 11:24 by gesders.
Avatar
benjamin #8
Member since Oct 2009 · 28 posts · Location: Nancy, France
Group memberships: Members
Show profile · Link to this post
Why just removing empty directories from the 'data/pages' directory ?
Wouldn't it be better to remove empty directories from the entire 'data' directory ?
Avatar
xrat #9
Member since Nov 2009 · 19 posts · Location: Vienna, Austria
Group memberships: Members
Show profile · Link to this post
I don't know much about DW insides. However, after listing the empty directories of 2 of my larger installations it seems that
  - Empty directories do pile up (mostly in ''attic''). And:
  - It's safe to remove them with the exception of ''tmp''.

I hope Andreas can confirm this. Then we should change the maintenance wiki page.
Avatar
benjamin #10
Member since Oct 2009 · 28 posts · Location: Nancy, France
Group memberships: Members
Show profile · Link to this post
Well, finally it's a bad idea :)
In my script, I asked to remove all empty directory form the data directory.

For some of my wikis, there were no revision for 15 days, so all files which was in the /data/attic/ directory where removed, so this directory data/attic was empty... and removed... My wiki were dead :)

=> I think it's better to just leave /data/pages :)
This post was edited on 2011-06-03, 23:31 by benjamin.
Avatar
xrat #11
Member since Nov 2009 · 19 posts · Location: Vienna, Austria
Group memberships: Members
Show profile · Link to this post
Oops :-| But thanks for testing :)

I looked at my wiki installations again: I don't think that it is particularly important to remove empty directories but some of my wikis do have some leftovers. They don't hurt but I personally prefer to have them removed.

However, we should at least exclude all top level directories like with
  find "$1"/ -mindepth 2 -type d -empty -print0 | xargs -0r rmdir

Removing empty directories from within "attic" is no problem. They are recreated when the namespace is updated.
Avatar
benjamin #12
Member since Oct 2009 · 28 posts · Location: Nancy, France
Group memberships: Members
Show profile · Link to this post
Removing empty directories from within "attic" is no problem. They are recreated when the namespace is updated.

Well, it's a problem in fact because if this directory (attic) is removed, we can't access to our wiki (we just have an error and a white page) and so we can't update the wiki anymore :)

Anyway, it's a good idea to exclude top level directory.
Avatar
xrat #13
Member since Nov 2009 · 19 posts · Location: Vienna, Austria
Group memberships: Members
Show profile · Link to this post
Quote by benjamin:
Removing empty directories from within "attic" is no problem. (...)

Well, it's a problem in fact because if this directory (attic) is removed, we can't access to our wiki (we just have an error and a white page) and so we can't update the wiki anymore :)

That's why I wrote "within" :) and the "-mindepth 2" should take care of not removing "attic" itself.
Avatar
benjamin #14
Member since Oct 2009 · 28 posts · Location: Nancy, France
Group memberships: Members
Show profile · Link to this post
Oups, my mistake :)

Anyway, I'll use your find command which seems to be perfect !
Avatar
xrat #15
Member since Nov 2009 · 19 posts · Location: Vienna, Austria
Group memberships: Members
Show profile · Link to this post
Since we received no further feedback and benjamin and I have been running our DokuWikis for some time now, I have updated the script at http://www.dokuwiki.org/tips:maintenance to reflect the recent discussion, i.e. we do not only remove empty directories in "$conf['savedir']/pages/" but also in all the other directories.

However, I have chosen an approach which is a bit safer than the one suggested above. So, the new "find" now is
find "$1"/{attic,cache,index,locks,media,meta,pages,tmp}/ \
    -mindepth 1 -type d -empty -print0 | xargs -0r rmdir

In order to make this work I had to change "#!/bin/sh" to "#!/bin/bash". (I assume that if someone really needs a Non-Bash shell they probably know how to rewrite the "find" line.)
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Page:  1  2  next 
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2019-08-19, 16:27:41 (UTC +02:00)