[pmwiki-users] Re: Problem with URLapprove

chr at home.se chr at home.se
Mon Jun 13 17:07:13 CDT 2005


On Mon, 13 Jun 2005, Patrick R. Michaud wrote:

> On Mon, Jun 13, 2005 at 10:28:13PM +0200, chr at home.se wrote:
> > After some more testing, the problem is probably that my configuration is 
> > a bit too advanced...
> > 
> > I'm aiming for a wiki farm with a shared field, where this field should
> > contain the list of approved URL's. 
> > [...]  Oh, oh... if I modify WritePage(), I'd also have to worry about
> > the locking mechanism, right?  Two fields might be writing to the same
> > shared page at once...  maybe this is hopless...
> 
> Oh, I don't think it's so hopeless.  The urlapprove.php script uses
> PostPage() to make changes to the approvals page (so that page history
> is preserved), and PostPage() always writes to the storage area 
> given by $WikiDir.  Thus, all you really need to do is set $WikiDir 
> to point to the farm wiki.d whenever making a change to the url 
> approvals page -- same as what you're doing for other edits in 'Site':
> 
>     # approve urls into shared page directory
>     if ($action == 'approvesites' || $action == 'approveurls') 
>       { $WikiDir = new PageStore("$FarmD/shared.d/\$FullName"); }

Duh.. thanks, with a small modification it now works. Here's what I have 
in my farmconfig now.

// Modify page library search so that Site/-pages are available in all fields.
if(true) {
  $WikiLibDirs = array(&$WikiDir,
                       new PageStore("$FarmD/shared.d/\$FullName"),
                       new PageStore('$FarmD/wikilib.d/$FullName'));

  // Force use of directory shared.d/ for edits to the group 'Site'
  $group = FmtPageName('$Group', $pagename);
  if(($action == 'edit' && $group == 'Site') ||
     ($action == 'approvesites' || $action == 'approveurls')) {
    $WikiLibDirs[] = $WikiDir;
    $WikiDir = new PageStore("$FarmD/shared.d/\$FullName");
  }
}

If this is a reasonable way to do it, I can add this comment to a suitable 
cookbook page.

Btw, it'd be nice if $group was available at the script level... there's 
got to be tons of scripts that do this line
	$group = FmtPageName('$Group', $pagename);
over and over again :-)

/Christian

-- 
Christian Ridderström, +46-8-768 39 44               http://www.md.kth.se/~chr




More information about the pmwiki-users mailing list