[pmwiki-users] Shared Pages

Petko Yotov 5ko at 5ko.fr
Sat Sep 12 18:52:16 CDT 2009

On Saturday 12 September 2009 07:06:09 Simon wrote:
> In config.php I have
>   $WikiDir = new PageStore('wiki.d/$Group/$FullName');
>   $LockFile = "/home/tahi/public_html/pmwiki/wikishared.d/.flock";
>   $WikiLibDirs = array(
>      &$WikiDir,
>      new
> PageStore('/home/tahi/public_html/pmwiki/wikishared.d/$Group/$FullName',
>  1), new PageStore('$FarmD/wikilib.d/$FullName'));
> What I want to achieve is having some shared groups of pages that can be
> updated and added to (ie new pages) from both websites.
> Where a group is not in the shared directory I want it to update the local
> website folder (this happens now).
> existing pages are updated in their existing locations, but new
> pages are added in to local folder.
> If anyone can suggest how I can have all new pages in a shared group only
>  be added the the shared directory I would appreciate it

You can re-define the $WikiLibDirs array in two local/SharedGroup.php files in 
both wikis:

## only alter the directories when a page is posted in this group
if (@$_REQUEST['action']=='edit' 
  && preg_grep('/^post/', array_keys($_REQUEST) ) ) {
  $WikiDir = new PageStore('$FarmD/shared.d/$FullName');
  $WikiLibDirs = array(  &$WikiDir,
    new PageStore('$FarmD/wikilib.d/$FullName')  );

> I can test for a pagename in config.php by using   $pagename =
> ResolvePageName($pagename);
> How can I test for a groupname in config.php?

You can get the group by something like this (at the end of config.php):

  list($group, $name) = explode('.', ResolvePageName($pagename));
  if ($group=='PmWiki') { /*do something...*/}


More information about the pmwiki-users mailing list