Page MenuHomePhabricator

Need a LocalSettings.php per virtual Wiki site
Closed, DeclinedPublic

Description

Author: mediawiki

Description:
I have installed mediawiki in one location on my host (as per Debian
policy/packaging).

I run Apache2 and want to set up a number of independent Wikis - the virtual
websites are all configured and ready to serve!

index.php includes ./LocalSettings.php - I need an option that makes it include
a LocalSettings.php specific to the Virtual Server that the index.php is being
served under.

As a proposal, if in my Virtual Server section I say:

SetEnv MEDIAWIKI site1

then I would want index.php to say something like:

$qualifier = getenv('MEDIAWIKI');
if ( $qualifier ) {

include_once("./$qualifier.LocalSettings.php");

} else {

include_once("./LocalSettings.php");

}

I would then be able to have completely separate virtual mediawikis, with a
single install of the software - separate databases etc etc etc.

Is this possible?

Regards & thanks,
Jeff


Version: unspecified
Severity: normal

Details

Reference
bz4505

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:01 PM
bzimport set Reference to bz4505.
bzimport added a subscriber: Unknown Object (MLST).

LocalSettings.php is code. The file autogenerated by the web installer is a simple
case, but it can be arbitrarily complex. You could keep your per-wiki configuration
in separate files and include them based on the hostname, or as we do use an array
of setting overrides based on site and language.

For a little info on our and other possible setups see:
https://wikitech.leuksman.com/view/Wiki_farm
http://meta.wikimedia.org/wiki/MediaWiki_FAQ#How_do_I_create_a_small_wiki_farm.3F

  • Bug 4509 has been marked as a duplicate of this bug. ***

mediawiki wrote:

I understand that the MediaWiki maintainers are probably very busy - but either
of the proposed solutions works very well, and the attached patch fixes the problem.

https://wikitech.leuksman.com/view/Wiki_farm - I have no need to to manage a
wiki farm with some data shared and some not. Nor do I want to create a series
of custom scripts that will require hand-crafted maintenance or at least
testing, when MediaWiki is upgraded and changes. This is not a solution for
best-practice orgs where sysadmin and development are ring-fenced.

http://meta.wikimedia.org/wiki/MediaWiki_FAQ#How_do_I_create_a_small_wiki_farm.3F
main reccommendation does not satisfy the requirement to have the source just
once, with distinct LocalSettings.php. Later suggestions also talk about
hand-crafted creation of symlinks and clones of LocalSettings.php. Again, not a
reliable / quality recommendation.

What is required is a simple distinct wiki-farm mechanism, where a sysadmin can
associate a wiki with a virtual host. Our sysadmins will not hand-craft and
maintain a LocalSettings.php where a stray curly-brace error would cause issues
for all wikis etc. They want simple configuration - as I suggessted, an Apache
one-liner(3 words) in the virtual server, with no risk of changing / introducing
PHP errors for any other wiki.

<VirtualHost *>

...
SetEnv MEDIAWIKI alphawiki

</VirtualHost>

The attached patch on bug #4509 for index.php and config/index.php recognises
this environment setting, and solves the problem for everyone, without affecting
existing users. It works for Apache versions 1.2 - 2.2, and any webserver that
can set an environment variable.

Regards,
Jeff

mediawiki wrote:

Support VirtualHost Wiki-farm

index.php includes LocalSettings.php depending on environment variable value

Attached:

mediawiki wrote:

virtualhost wiki farm - this patch superceeds previous patch

Fixes some bugs in previous patch

Attached: