Last modified: 2006-01-07 12:22:41 UTC
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
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. ***
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
Created attachment 1271 [details] Support VirtualHost Wiki-farm index.php includes LocalSettings.php depending on environment variable value
Created attachment 1272 [details] virtualhost wiki farm - this patch superceeds previous patch Fixes some bugs in previous patch