[pmwiki-users] Wikifarm question

John Rankin john.rankin at affinity.co.nz
Sun Sep 10 18:38:01 CDT 2006


On Saturday, 9 September 2006 4:49 AM, Patrick R. Michaud <pmichaud at pobox.com> wrote:
>On Fri, Sep 08, 2006 at 05:06:42PM +1200, John Rankin wrote:
>> When we refer to a page in a different field, we do one of 
>> 3 things:
>> - reject the link if the field is undefined (this works)
>> - if the page exists, display a browse link
>> - if the page doesn't exist, display an edit link
>> 
>> We do ths by temporarily resetting $WikiDir to point to 
>> the appropriate field's wiki.d. 
>
>As a quick aside: Something about this approach is causing 
>alarm bells to ring in my head, but I can't put my finger 
>on exactly why.  For now let me just note that the idea of
>swapping $WikiDir in the middle of processing is *way* outside
>of my mental design spec, so I can't be certain that something
>won't break later on.

I understand the alarm bells; I hear them too. The reason we
have ignored them for the time being is:
- the swap only occurs to detect whether a page in another field
  exists; we never write to a swapped $WikiDir and we carefully
  put the original back, so PmWiki itself never knows that we
  substituted a fake for a few milliseconds
- we couldn't see another way to implement this feature and
  administering an entire farm from a single Site.WikiFarm
  page is very tidy

- we are actually more worried about having to reset $WorkDir
  to the selected field's wiki.d when we detect a request to
  browse or edit a page in a given field, as we are changing 
  where pmwiki writes its lock file -- we are pretty sure this
  is OK, but could be wrong
>
>> In detail (quoting Donald Gordon):
>> 
>> The problem we have is that PageName() caches its results; once it's
>> decided on a page's existence, it will always return the same value for
>> that page, even if $WikiDir or $WikiLibDirs has changed in the interim.
>> [...]
>> I see two possible ways to change this: either make $pe a global
>> variable (presumably with a nicer name), or allow a global variable to
>> specify a prefix (effectively, a "page namespace") to the
>index of $pe.
>
>For now I've gone with making $pe a global variable, named 
>$PageExistsCache.  But I've also put a note in the code that
>says it might go away at some point, so hopefully people won't
>rely on it too heavily.
>
>$PageExistsCache is available in 2.1.25 (just released).

I have installed it and we will test it. Thank you very much.



-- 
JR
--
John Rankin







More information about the pmwiki-users mailing list