[pmwiki-users] Wikifarm question
John Rankin
john.rankin at affinity.co.nz
Mon Sep 11 18:17:54 CDT 2006
On Tuesday, 12 September 2006 1:03 AM, Patrick R. Michaud <pmichaud at pobox.com> wrote:
>On Mon, Sep 11, 2006 at 11:38:01AM +1200, John Rankin wrote:
>> 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:
>> >> 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:
>> - we couldn't see another way to implement this feature and
>> administering an entire farm from a single Site.WikiFarm
>> page is very tidy
>
>How about a custom LinkFieldPage() function that works just like
>LinkPage() but checks for page existence in another field?
>Instead of using PageExists(), one can do
>$fielddir->exists($pagename) .
We considered doing that. We chose to call LinkPage with a
temporarily modified list of wiki directories because it
seemed like re-inventing the wheel to create a LinkFieldPage
function. As far as we can tell, the new global pageexists
cache works fine, but we are still testing.
>
>> - 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
>
>There's a potential conflict here if two people attempt to
>simultaneously edit the same page from different fields where
>different lockfiles are being used.
>
>One simple way to avoid this is to have PmWiki use the same
>lockfile for every field, then it doesn't matter. Just set
>
> $LockFile = '/path/to/common/.flock';
>
>Make sure that PmWiki has write permission to whatever directory
>contains the .flock file (/path/to/common/ above).
>
>Pm
>
Sorry, I'm lost in a maze of twisty little passages, all
alike. Here is our thinking, which led us to conclude we
needed to redefine $WorkDir and that it would be OK:
- consider the following case
wiki
wiki.d
wikifarm
FieldA
wiki.d
FieldB
wiki.d
FieldC
wiki.d
- we always go to wiki/pmwiki.php?n=Group.Page&field=FieldName
- if there is no &field=... it is the standard pmwiki case and
pages are in wiki/wiki.d
- if a field is specified and it's listed on Site.WikiFarm,
we set $WikiDir and $WorkDir to wikifarm/FieldName/wiki.d
- the reason we set $WorkDir is so that pmwiki creates
wikifarm/FieldName/wiki.d, which is done in the Lock
function by calling mkdirp(dirname($LockFile))
- so, if we set $LockFile to a common location, pmwiki
won't create FieldName/wiki.d
- next, consider the case where FieldA and FieldC both contain
pages with links of the form Farm:FieldB/Group.Page?action=edit
- when an author clicks to edit the page, the farm customisation
steps in and sets $WorkDir to wikifarm/FieldB/wiki.d, so
both edits lock in the same place
- if, however, one author edits FieldA/Main.HomePage and
another edits FieldC/Main.HomePage, we lock in
wikifarm/FieldA/wiki.d and wikifarm/FieldB/wiki.d respectively
- this is also what would happen in a standard farm set-up
where the structure is wikifarm/FieldName/index.php;
$WorkDir is the specified wikifarm/FieldName/wiki.d
- to define a shared lock file, this is the pmwiki default, as
$LockFile = "$WorkDir/.flock" and if we don't redefine
$WorkDir, pmwiki points to wiki/wiki.d in the structure above
- however, not only do we not get our fields' wiki.d directories
created, but potentially one of the above edits will have to
wait on a lock, even though they are writing to different
wiki.d directories -- not wrong, but also different from what
happens in a normal wiki farm
I have been over and over the above logic and can't see a
flaw in it. We are getting the correct wiki.d directories
created automatically the first time we reference a field
on the farm.
My head hurts thinking about it :-)
--
JR
--
John Rankin
More information about the pmwiki-users
mailing list