[pmwiki-users] Wikifarm question

John Rankin john.rankin at affinity.co.nz
Fri Sep 8 00:06:42 CDT 2006


We have almost got wikifarm configuration working off a 
Site.WikiFarm page that behaves like a specialised 
Site.InterMap page. But have struck a problem.

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. The problem is that 
PageExists caches its results. So the following page 
references confuse PmWiki as to whether or not they exist:

Farm:FieldA/Main.HomePage

Farm:FieldB/Main.HomePage

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.

Currently, PageExists does this:

function PageExists($pagename) {
  global $WikiLibDirs;
  static $pe;
  if (!isset($pe[$pagename])) {
    $pe[$pagename] = false;
    foreach((array)$WikiLibDirs as $dir)
      if ($dir->exists($pagename)) { $pe[$pagename] = true; break; }
  }
  return $pe[$pagename];
}

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.

Either solution would work for us.

Is ther a solution to this?? At the moment, we have disabled this 
feature.
-- 
JR
--
John Rankin







More information about the pmwiki-users mailing list