[pmwiki-users] page store problem with latest pmwiki 2.2.0 beta19

Patrick R. Michaud pmichaud at pobox.com
Thu Jan 11 11:33:59 CST 2007


On Mon, Jan 08, 2007 at 04:46:47PM +0000, Hans wrote:
> Monday, January 8, 2007, 4:24:37 PM, Hans wrote:
> 
> > I observe a problem with pages not accessible in a skin's page store.
> 
> PS: To complicate matters:
> It seems to work on pmwiki.org, but it does not on a clean
> installation on my machine.

This was a very tricky problem to track down.  The problem is
related to the $PageExistsCache, which avoids filesystem calls
by keeping track of which pages are already known not to exist.

The change that caused the problem (in 2.2.0-beta18) was in the
scripts/robots.php file, where I switched the robots <meta>
tag to report 'nofollow,noindex' for any non-existent page.
Of course, it used PageExists() to check for page existence,
and the results of that test would be stored in $PageExistsCache.

However, the robots.php code is executed before skins are loaded.
(We generally want to deal with robots as quickly as possible,
before spend any server resources on a request that is just going
to be discarded anyway.)  So, at the point where the robots.php
code is looking to see if the requested page exists, any 
skin-specific page stores haven't been loaded into $WikiLibDirs yet.  

Normally this isn't an issue, but since the results of PageExists()
are cached, subsequent calls to PageExists() would always return
"false" for the page, even if $WikiLibDirs had been updated to
include new PageStores.

My solution for now is that the creation of any new PageStore
object empties the $PageExistsCache, so that any previous results 
aren't remembered.  So, when a skin adds it set of pages to
$WikiLibDirs, any previously cached results are discarded.
This seems to solve the immediate problem for the Triad skin.

Another solution might be to have robots.php load after skins.php,
but since skins.php is itself dependent on other scripts, that
seems to add more processing overhead to robot requests.  So, I'm
going to leave the current sequence in place for now, and we can
revisit it at some point in the future.  

Anyway, the problem now seems to be fixed in 2.2.0-beta20 (just released).  
Thanks!

Pm




More information about the pmwiki-users mailing list