[Pmwiki-users] Expiring page revisions.

Pedro Miller Rabinovitch miller
Wed Oct 1 00:02:00 CDT 2003


On Tuesday 30 September 2003 22:07, Richard Canning wrote:
> Is there any way to add an action that would automatically do this?
> eg ?action=expirediff
> Which would expire all of the page revisions, keeping the file sizes
> smaller.

There is a way, but remember one should always authenticate this (it's as 
effective as page deletion). One could, in PHP, read the contents of the file 
and truncate it before the revisions... This could actually also be easily 
done from scripts on the server side, just to make sure there's *no* way an 
external user could use it. If you have any scripting capabilities (i.e., 
bash, lua, etc), take a look at the format PmWiki uses to store each page. If 
I'm not mistaken, what you want to do is something like this:

[user at host] cat wiki.d/Group.MyPage | grep -ev "^diff=" | grep -ev "^rev=" > 
wiki.d/Group.MyPage
[user at host] echo "rev=1" >> wiki.d/Group.MyPage

(the above is untested. Take with a kilo of salt, please. Patrick, is this 
correct?)

Of course, I'm taking leaps here assuming you're on an *nix platform. It can 
still be done in Windows, of course, but gets more complicated. >: )

I'd rather do this type of thing from the server side, I guess. I don't trust 
many people with the capability of actually deleting data on my disks. >: )

Cheers,

	Pedro.



More information about the pmwiki-users mailing list