[pmwiki-users] PageTopStore recipe

Eemeli Aro eemeli at gmail.com
Fri Feb 13 05:19:10 CST 2009

2009/2/13 Oliver Betz <list_ob at gmx.net>:
> Eemeli Aro wrote:
>>Also, having a second copy of each page is nice in terms of
>>safety: if you screw up horribly with a script that mangles stuff in
>>wikitop.d, you can simply remove the whole directory and it'll be
>>regenerated from wiki.d.
> you have to be fast - as soon as someone reads the wiki page, the
> mengled version get's included.

Nope, not quite. The edited/mangled version gets included in the page
history as late as possible, ie. when the page's history is read as
opposed to just the current version of the page.

To clarify: the PageStore::read and therefore also PageTopStore::read
methods take in two parameters: the name of the page to read and a
$since timestamp value. The methods then return an array containing
the page, but with no data marked as older than the specified
timestamp. Most of the time when a page is read (eg. browsing,
pagelists, includes) this second paramater is given as
READPAGE_CURRENT which is defined as a week ahead from the current
time, resulting in only the current page's data & ignoring all the

PageTopStore::read explicitly checks the value of this timestamp; if
it's equal to READPAGE_CURRENT it gives you the contents of the file
in wikitop.d (or wiki.d, if the specifified file is missing from
wikitop.d), otherwise it first updates any modifications from
wikitop.d to wiki.d and then gives you the file from wiki.d.

The only default core actions that will update files in wiki.d are
edit, diff, postattr, upgrade, approveurls and approvesites.
Additionally it looks like there's a bug in scripts/vardoc.php, line
53, which means that any pages mentioned in $VarPagesFmt get updated
when any page in the wiki is read.


More information about the pmwiki-users mailing list