logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: All files location - was Re: 1.3.10 - config.ini location: msg#00112

Subject: Re: All files location - was Re: 1.3.10 - config.ini location
Much easier would it be as we do it on sf.net with the demo wiki. Or at my
test site.

This explanation is also somewhere at the phpwiki site, and asked multiple
times.

We have a bunch of small scripts without extensions like 'en', 'de',
'macosx', 'sidebar', 'pear', 'adodb' and so on.
Each of these files has the php handler attached in the .htaccess file,
and overrides some config values, loads the phpwiki index.php, overrides
some other variables, and loads lib/main.php.

en:
<?php // -*-php-*-
// CONSTANTS as default wiki overrides before:
define('WIKI_NAME', 'PhpWikiDemo:'.basename(__FILE__));
define('VIRTUAL_PATH', $_SERVER['SCRIPT_NAME']);
define('CHARSET','utf-8');

include "index.php";
// other VARIABLE overrides here:

include "lib/main.php";
?>

This way you keep the site configuration in config.ini, and some special
constants, like VIRTUAL_PATH, WIKI_NAME, DEFAULT_PGSRC, $LANG, CHARSET,
and so on in the various loaders. See PrettyWiki.

And don't really like Matthews idea.


Different lib is impossible om the same phpwiki, please rename special
plugins then.
different config files are also easy, but generally not needed.
see the content of index.php. These four lines could go into your start
script if you really need different config files.
But you have to declare PHPWIKI_DIR and DATA_PATH then, because you
started phpwiki out of the phpwiki directory.


> On Sat, May 22, 2004 at 10:18:59AM +1200, Jim Cheetham wrote:
>> How difficult would it be to virtualise the entire wiki? I'd like to be
>> able to install the Debian package once, probably into
>> /usr/share/phpwiki/ ... and then in various VirtualHosts be able to
>> declare a (uniquely-named) wiki, that would be able to pick a different
>> config file (and possibly a different 'additional lib' for plugins) ...
>
> As it stands, it wouldn't be particularly simple, because PHPWiki does
> everything from it's index file, which is hardcoded to look for it's
> config file in one place.  We need to tell index.php to get it's config
> from
> different places depending on which virtual instance invoked it for this
> particular run.
>
> What I have just recently done for another project is to create multiple
> configuration instances by indexing a config file by a unique substring of
> the URL.  So, if you've got two PHPWiki sites http://www.site.com/wiki and
> http://www.site.com/otherwiki, your config sections would be linked to
> '/wiki' and '/otherwiki'.  Similarly, If they're on different virtual
> hosts
> entirely, you can have your sections as 'site1.com' and 'site2.com' if
> they're the unique substrings.
>
> This is cute because it requires nothing more than to set up another
> section
> in your config file for the new vhost and add an alias.  It's a PITA for
> PHPWiki because it would almost certainly mean a new config file to handle
> the substring => config file mapping, as you wouldn't want multiple
> PHPWiki
> configs in the one file (it'd be a little long and confusing).
>
> Another method, if you wanted it, that would work in PHPWiki more or less
> as-is, would be to use the other method I devised for the above project
> (which I didn't use as the substring method was more appropriate in that
> case).  Create a constant, perhaps called __CONFIGURED, that will be
> defined
> true once all of the appropriate config statements have been processed.
> Then, tell index.php not to call IniConfig() (or tell IniConfig() not to
> do
> anything) if __CONFIGURED is defined.
>
> How does this help?  Because you put something like the following in your
> apache.conf for each of the virtualised PHPWiki instances:
>
> php_value auto_prepend_file /some/config/file.php
>
> Where /some/config/file.php is unique for each instance, and contains
> pretty
> much the following code:
>
> require_once '/usr/share/phpwiki/lib/IniConfig.php';
> IniConfig('/some/config/file.ini');
> define('__CONFIGURED', true);
>
> Again, where /some/config/file.ini is unique to that virtual instance of
> PHPWiki and filled with lovely local-specific config options.
>
> You then point each virtual instance of PHPWiki at /usr/share/phpwiki for
> it's code, index.php runs for everyone but skips the default config for
> your
> virtual instances because __CONFIGURED is defined, and IniConfig() has
> previously run with your per-instance config file.
>
> If you're interested in using this method (which I think may be the better
> option for PHPWiki), I'm happy to patch index.php in Debian to support
> this,
> as it doesn't break anything in the default case (single instance, config
> in
> /etc/phpwiki/config.ini).



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id149&alloc_id?66&op=click


<Prev in Thread] Current Thread [Next in Thread>