[pmwiki-users] RFC: PITS 00701 -- WikiFarm confusion

Patrick R. Michaud pmichaud at pobox.com
Wed Mar 15 15:45:12 CST 2006


On Wed, Mar 15, 2006 at 10:34:18PM +0100, Joachim Durchholz wrote:
> Patrick R. Michaud schrieb:
> > It's *very* difficult to get PHP to apply this in scripts, since
> > there's not a "fall back" mechanism that we can use for include 
> > statements.
> 
>    if (is_readable ($local_dir . '/' . $file)) {
>      include ($local_dir . '/' . $file);
>    } else {
>      include ($fallback_dir . '/' . $file);
>    }
> 
> This code works even if it is inside a function like this:
> 
> function include_file ($file) {
>    if (is_readable ($local_dir . '/' . $file)) {
>      include ($local_dir . '/' . $file);
>    } else {
>      include ($fallback_dir . '/' . $file);
>    }
> }
> 
> Well, sort of: variables assigned to within the included files will be 
> local to include_file(). (Workaround: add a "global" directive.)

Sorry, that's a "workaround" I'm not wanting to pursue.  We already
have enough problems with people forgetting to put "global"
in skin.php files, I can't imagine making every configuration
file have to remember to declare each variable as global before
setting it.  Even (or especially) if we just limit it to cookbook 
recipes, we'll end up with a lot more questions about why recipes 
don't work when the answer is that a variable wasn't declared global.

But even more so, I'm not convinced that the current mechanisms
are in any way inadequate.  Most everyone that I've heard from
in dealing with cookbooks in farm situations have indicated
that the current way things are done makes good sense.

> >> On  a safe_mode-disabled server, this would allow webmasters to install 
> >> the software, and nail down the configuration so that it "simply works" 
> >> for their customers.
> > 
> > PmWiki already works this way.  A webmaster can install a copy of
> > PmWiki in, say, /usr/local/pmwiki, and then customers simply
> > create directories with index.php files that have
> > 
> >     <?php include_once('/usr/local/pmwiki/pmwiki.php');
> 
> How would I make sure that the scripts/ directory is taken from 
> /usr/local/pmwiki?

Do you mean in the sense of enforcement or in the sense of
making things work?

If you're just wanting to make it work -- PmWiki already loads
scripts/ from the farm directory (/usr/local/pmwiki) and not
from the current directory.  That's what $FarmD is for.

If you're wanting to *enforce* it, there's not a way to do that
without seriously limiting what a customer can do in the way
of local configuration.  But the webmaster can entirely disable 
(or override) a customer's configuration settings from the 
farmconfig.php file.

Pm




More information about the pmwiki-users mailing list