[pmwiki-users] Ghost pages in 2.1.5

Patrick R. Michaud pmichaud at pobox.com
Sat Oct 7 12:59:03 CDT 2006


On Sat, Oct 07, 2006 at 09:35:54AM +0200, Joachim Durchholz wrote:
> Patrick R. Michaud schrieb:
> > Given that PageStores can be given arbitrary directory paths
> > and $...Fmt strings, I haven't come across a good way to figure
> > out which directories are valid pagestores and which are not.
> 
> A quick&dirty way would be to ignore directories with a name that starts 
> with a dot. (You can't create directories or files that start with a dot 
> in Windows explorer, so explaining the mechanism would also need a 
> longish explanation how to create such a thing anyway on the server.)
> 
> Another way would be to ignore directories that have a file named 
> "not-a-wiki-store". Or, reversely, include only directories that have a 
> file that is named "wiki-store".
> 
> Third: ignore directories named "attic".

These are excellent ideas; I definitely hadn't thought of them.  
But documenting the feature would definitely be a bit of a trick -- I
doubt admins are going to know to go look for "things that make a
directory into a wikistore" or "things that prevent a directory
from being a wikistore".

In the instant case, I think that Chris reasonably guessed that as
long as the page files weren't directly in the wiki.d/ directory,
then they wouldn't be treated as pages.  But I doubt he would've
gone to the documentation to check for ways to make sure that
a subdirectory of wiki.d/ isn't searched for pages.


However, it does give me a useful optimization -- when the
PageStore is scanning its directories, it can compare the
number of slashes in the directory path against the number
of slashes in the PageStore's specification; if the number
is less we ignore page files in that directory (as it's
too short a path), if the number is greater we cull the 
directory altogether (as the path is too long).

So, given a PageStore for "wiki.d/{$FullName}", any 
subdirectories of wiki.d/ would be skipped because they
would end up being too deep to be valid for the PageStore.
And a PageStore of "wiki.d/{$Group}/{$FullName}" (organize
files by group) would search only subdirectories of wiki.d/
for page files.

This optimization would fail if a PageStore contains variable
specifications that result in slashes... but I don't think that
ever happens, and if/when it does we could provide a flag to
the PageStore to turn off the above optimization.

Anyway, very helpful.  Thanks!

Pm




More information about the pmwiki-users mailing list