[pmwiki-users] Post-processing recipes

Patrick R. Michaud pmichaud at pobox.com
Wed Mar 22 12:36:11 CST 2006

On Wed, Mar 22, 2006 at 06:53:57PM +0100, Dominique Faure wrote:
> On 3/22/06, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> > What sort of custom post-processing code are you looking for?
> >
> The first thing that come to my mind is for instance the ActionLog
> recipe: All the recipe processing is made at the end of the recipe
> source which comes in pmwiki.php before stdconfig.php and the real
> PmWiki processing:
> * %annoying_only% I have to ask admins to include 'scripts/author.php'
> and/or 'scripts/authuser.php' *before* 'cookbook/actionlog.php' to
> have the {$Author} and {$AuthId} page variables initialized.

It's perfectly okay for Cookbook scripts to do includes of things
in scripts/, including scripts/author.php.  So, perhaps the following
in the recipe:

    if (!@$Author) include_once("$FarmD/scripts/author.php");

You may need to make the wiki administrator aware that the recipe 
is setting the $Author variable, but in general it's okay if
a recipe loads things before stdconfig.php does it.

In fact, there's nothing to prevent a local.php or other file
from loading stdconfig.php.

> * %more_problematic% Since this recipe generates some page content
> ({$SiteGroup}.ActionLog), it needs to have access to the PageStore 
> and this may be problematic (cf. php bug 33772).

That's definitely icky.  I can see why this would be a problem.

> Practically this could be made as an an array of callback function
> names to call.

It's a bit tricky from a farm perspective, because I want to
preserve the ability of the farm administrator to have the final
say about how things are set.  

Some people may also want to register callbacks to occur after
processing of stdconfig.php and not the end of all processing,
so that's another aspect.

Lastly, some functions call exit() directly, and in these
cases the callbacks would be skipped.  I may see if I can do
something about that, however.

So, it isn't a "no", it's just may take a little time to spec
it all out cleanly.


More information about the pmwiki-users mailing list