[pmwiki-users] Is there any way to have more than one shared directory?

Patrick R. Michaud pmichaud at pobox.com
Sat Nov 25 08:37:23 CST 2006


On Fri, Nov 24, 2006 at 09:28:10PM -0600, JB wrote:
> >> The variable $LockFile is not an array (that I know of).
> > 
> >     $LockFile = "$FarmD/shared.d/.flock";
> >     $WikiLibDirs = array(
> >       &$WikiDir,
> >       new PageStore('$FarmD/shared-1.d/$FullName', 1),  # first shared dir
> >       new PageStore('$FarmD/shared-2.d/$FullName', 1),  # second shared dir
> >       new PageStore('$FarmD/wikilib.d/$FullName'));
> > 
> > When a page is written, it will go back into whatever shared-?.d/
> > directory it currently exists in.  If it's a new page or
> > a page from wikilib.d/, then it'll go into $WikiDir.
> 
> HUH?
> 
> What is the $LockFile variable for?  For some reason I thought
> the a $LockFile would have to be in each of the shared
> directories.  

The $LockFile is a transactional lock.  It basically signals to
other executions of PmWiki that "I'm in the middle of changing pages
in the PageStores, so wait until I'm finished before starting any
other updates."

Any wikis that share a common writable PageStore need to be using
the same $LockFile.  As a transactional lock, the $LockFile is used
to coordinate actions among wikis, not PageStores, so a single
lockfile is sufficient.

> In your example you have the $LockFile in
> the "shared.d" directory and the shared directories are
> in completely different locations "shared-1.d" & "shared-2.d".
> Do you have a working example of this somehwere?  Does it
> matter where the $LockFile is located?

Oops, you're correct, that was a typo on my part.  It doesn't
matter at all where the $LockFile is located -- it just needs 
to be somewhere writable by the webserver, and all wikis that
have a shared writable PageStore need to be sharing the same
lockfile.

As a working example, all of the wikis in a farm could share
the farm's lockfile, by placing the following in local/farmconfig.php:

    $LockFile = "$FarmD/wiki.d/.flock";

Pm




More information about the pmwiki-users mailing list