[pmwiki-users] PageTopStore recipe
eemeli at gmail.com
Thu Feb 12 13:14:47 CST 2009
2009/2/12 Hans <design5 at softflow.co.uk>:
> I got a question about the PageTopStore recipe.
> In the description in Coobook/PagetopStore it says:
> "PageTopStore extends PageStore by keeping a second copy of each
> current page in a separate directory (by default, wikitop.d). The
> copies kept in this directory have a slightly different format that
> should be easier to read and edit in an external application."
> What is the advantage of keeping two file versions for each page, the
> normal one in wiki.d and an addition one with line breaks in
> wikitop.d? Would not one new version be sufficient and more efficient?
> I just fail to see the objective of this doubling. I may miss a
> technical necessity?
Using just one version is of course sufficient, and in terms of disk
memory usage it is clearly more efficient, but the reason pages are
doubled in PageTopStore is something else: convenience. When in use,
the wikitop.d directory contains the current plaintext versions of
each page. In other words, the history of each page is only kept in
the PageStore files.
The convenience comes from the fact that you can edit the wikitop.d
files with whatever external application you wish to use, and any
changes you make are subsequently properly logged in the page's
history. This is only possible by keeping the current version of the
page stored in two separate files, as then you can diff one against
the other. 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.
For one concreate example, you could do a global search-and-replace
across wikitop.d with an external app (eg. sed), and all your changes
would get logged in each page's history and the appropriate
RecentChanges pages. For another example, you could use PageTopStore
to export a completely history-free version of a wiki by copying the
whole thing except for wiki.d. Another as-of-yet-unrealised benefit of
PageTopStore is that you now have a directory with very simple text
files that ought to be easy to access using external tools, eg. for
implementing a better search engine.
Regarding the efficiency aspect, I rather doubt that the extra disk
capacity used is in any way notable for most uses. I've done no
testing, but there's a chance that using PageTopStore might even speed
up PmWiki, as less processing needs to be done to the wiki page text
when reading it from file.
More information about the pmwiki-users