[pmwiki-users] wikifarm question: autoconfigure a new wiki

Patrick R. Michaud pmichaud at pobox.com
Thu Aug 24 21:54:36 CDT 2006

On Fri, Aug 25, 2006 at 11:27:57AM +1200, John Rankin wrote:
> Is it possible to change the use of 'local' when loading 
> config.php and pgcust's Group.php and Group.Page.php files, 
> to use a variable such as $localDir? $localDir would default 
> to 'local'.

Sure, we can do this.  

However, I'd like to point out that it's perfectly possible 
to achieve what you want within the existing codebase without 
*too* much work (although yes, it's not *quite* as simple 
as setting a $localDir variable :-).

Basically, it can be done in the existing codebase by 
adding the following code at the end of farmconfig.php:

    $EnableLocalConfig = 0;
    $EnablePGCust = 0;

    if (file_exists("$localDir/config.php"))

    $pagename = ResolvePageName($pagename);

    $f = 1;
    for($p=$pagename;$p;$p=preg_replace('/\\.*[^.]*$/','',$p)) {
      if (file_exists("$localDir/$p.php")) 
        { include_once("$localDir/$p.php"); $f=0; }

    if ($f && file_exists("$localDir/default.php"))

This completely disables the existing "local/" hardcoded files
and replaces them with includes based on $localDir.

Still, as you said, it's not a substantial change for us 
make the capability available in the core, so I'll
probably do it there.  (However, to keep consistency
with the rest of PmWiki the variable will be name $LocalDir
instead of $localDir.)

Does that work for you?


More information about the pmwiki-users mailing list