Manual talk:Wiki family

I'm the only author of the text, copied it from m:Help:Wiki family and hereby released it in the public domain... feel free to correct my English, if you find typos, weird wordings ;-) or syntax errors - everywhere … have fun, --Produnis 21:19, 20 April 2006 (UTC)

Install more than one wiki on the same server using one copy of MediaWiki
It is possible to install more than one wiki on a server provided that:

OR
 * You use a different database for each wiki
 * You use a different database prefix for each wiki (for Postgres, you can achieve a similar effect by using different schemas)

The goal is to share the same copy of the MediaWiki for all wikis, instead of duplicate it over and over. Here is what I did under Linux:

MyNewWiki=...

mkdir $MyNewWiki cd $MyNewWiki lndir ../mediawiki-1.9.3

rm LocalSettings.php

Then run the config script again to recreate LocalSettings.php file. Be sure to pick a new database, or give a different prefix from the first Wiki.

Finially, point the browser to the newly created, different wiki.

It seems to be running ok. However, maintenance/importTextFile.php will break (I'm looking into how to solved that right now. In the meantime, if you know the answer, please update):

A copy of your installation's LocalSettings.php must exist in the source directory.

Scenario 2 does not work
If you set up all wikis like said, you have multiple sources. If you delete the sources but of one wiki, the other wikis do not work. You may edit the wiki2LocalSettings.php to match the correct path of the sources ($wgScriptPath), but then edit in wiki2 will edit the main wiki!

Share media files and keep language descriptions
Is it possible to share image and media files in a common directory as described, but retain different language descriptions of the files (i.e. unique Image: and Media: pages), for each project in the family?

It doesn't specifically say so in this tutorial. I want our wiki to keep uploaded files to one place, but allow different image page descriptions for each wiki, AND still keep the same file revision history on each image page.

In other words, can an image used in one of the wikis link to a unique image page for this particular wiki, yet still utilize/share a common, shared file upload and file revision history? --Morten Blaabjerg 23:03, 29 April 2006 (UTC)

LocalSettings / AdminSettings
Description on how to best use common configuration files with small "exception" files per-installation would be useful. -- Sysy / (talk) 22:07, 9 May 2006 (UTC)

Image description
Question: I used the above method to fetch description from Commons, but it fetches the entire page, not just the "#Content" section; I get the action tabs, the left hand nav/tool panels, the style sheet, etc, and it looks realy horrible because it sticks all that inside the #Content section of the wiki I'm fetching from. Is this a bug, or did I do something wrong?
 * Hmmm... i don't know.. In my installed version, it all works fine that way... Maybe you miss-spelled the URL to Pool-Wikis images? --Produnis 16:50, 14 May 2006 (UTC)

Additional Wiki on same server
On a LINUX box I:
 * created a fresh copy of the wiki files in a second directory
 * ran the config script again then moved the newly created LocalSettings.php file
 * was finished!

Note that I did NOT require an additional mySQL database. I DID create additional tables in the existing database. And I just gave those a different prefix from the first Wiki. And to address it, I have to point the browser to a different place inside my website.

Mark --24.195.14.18 03:09, 12 July 2006 (UTC)

So, it is not necessary to make an additional mySQL database, if you wish more than one Wiki in same hosting account. It´s optional. Read Help:FAQ

Shared image repository between different databases on different servers
Hi,

Im hosting my wikis with godaddy at the moment (i know its not the best host) using their economy plan.

I can create databases but every one is at a different url with different database name and database login.

Is there anyway to get the images and image description from the database on another server.

Cheers --158.125.9.4 16:16, 6 December 2006 (UTC)

Scenario 3: Thumbnail issue
Hi,

I followed scenario 3 for my multi-language wikis. At the moment, I've an english and a french wiki. All images go in the english one.

Everything works fine except when I try to create a thumbnail image from the french wiki:

I get the following error: Warning: mkdir [function.mkdir]: $WIKI_HOME/fr/includes/GlobalFunctions.php on line 1534 Warning: imagecreatefromjpeg(/ecwiki/en/images/6/65/RnD_Geo_UseCase_MBorne.JPG) [function.imagecreatefromjpeg]: failed to open stream: No such file or directory in $WIKI_HOME/ecwiki/fr/includes/Image.php on line 1266 Warning: imagecopyresampled: supplied argument is not a valid Image resource in $WIKI_HOME/fr/includes/Image.php on line 1274 Warning: imagejpeg [function.imagejpeg]: Unable to open '/ecwiki/en/images/thumb/6/65/RnD_Geo_UseCase_MBorne.JPG/180px-RnD_Geo_UseCase_MBorne.JPG' for writing in $WIKI_HOME/fr/includes/Image.php on line 1310 Warning: imagedestroy: supplied argument is not a valid Image resource in $WIKI_HOME/fr/includes/Image.php on line 1277

NB: The same operation from the english wiki works fine.

Thanks in advance for your help...

# 2 Scenario 2: Quick set-up - Clarity please
You want to install more than one wiki on a single server, using the same source code, and using the same database?

Aren't instructions one and two the basically the same?
 * 1) Install MediaWiki and additional tools as usual
 * 2) Set up your wiki (e.g., MyWiki)

So if I get this correctly http://www.foo.com/bubbawiki/ LocalSettings.php would go into "bubbawiki" if "bubbawiki" is where the wiki is installed. It is currently there (where I was told to put it in the set up of the wiki). Is the location different than the standard set up?
 * 1) After successful installation, move LocalSettings.php into the root directory of your wiki and rename it in such a way to make it easy to track (e.g., myWikiLocalSettings.php)

I thought the point was to use the "same source code"? I am creating new Mediawiki installs?
 * 1) Repeat the steps above for each wiki you wish to create, with suitable local setting files (e.g., anotherWikiLocalSettings.php, etc.)

Where does this LocalSettings.php file go?
 * 1) Create a LocalSettings.php file for your global settings, then select one from the two possibilities below:


 * 1. If your wikis are in different directories or subdomains linked to the same directory on your server, use this:

Where does the snip-it code go?

I am sorry to come across so naive on this. But setting up a wiki farm would be great for what we are trying to do. I have been unsuccessful so far with these instructions and I am not PHP programming savant. Thanks!

The "no extra files" solution
My solution requires not one additional file, and merely two symlinks.

I just symlink

radioscanningtw.jidanni.org -> mediawiki-1.10.0 taizhongbus.jidanni.org -> mediawiki-1.10.0

and in mediawiki-1.10.0/LocalSettings.php have this critical fork:

foreach(array('radioscanningtw','taizhongbus') as $v){ if(strpos($_SERVER['SCRIPT_FILENAME'].$_SERVER['PWD'],$v)){ $wgDBname=$wgSitename=$v; $wgLogo="/$v.png"; break;}} $wgScriptPath="";

However I don't have any uploaded images etc. So I didn't test that. Jidanni 00:21, 4 June 2007 (UTC)

Scenario 4 - Common Skins and Extensions
If you want to share common skins and extension code so as to avoid duplication, you can simply do the following in each language's LocalSettings.php file:

$sharedSourceDirectory = '/Path/to/root/of/yourwikipool'; $sharedSourcePath     = 'http://pool.yourwiki.org'; ... $wgStylePath          = "$sharedSourcePath/skins"; $wgStyleDirectory     = "$sharedSourceDirectory/skins"; ... $wgSharedUploadPath     = "$sharedSourcePath/images"; $wgSharedUploadDirectory = "$sharedSourceDirectory/images/"; $wgUploadNavigationUrl  = "$sharedSourcePath/index.php/Special:Upload"; ... $wgRepositoryBaseUrl    = "$sharedSourcePath/index.php/Image:"; ... require_once( "$sharedSourceDirectory/extensions/ExtensionName/ExtensionName.php" ); ...
 * 1) This is the server's local file path
 * 1) This is the URL to the pool wiki
 * 1) For each extension named "ExtensionName" add one of these:

Redundancy and confustion
Hi. This is a great article and very helpful, but some parts of it seem redundant or just unclear. For context, I program php full time.


 * 1) "Scenario 1" doesn't seem to be a different scenario from 2 and 3, but just a link to a 3rd party recipe.
 * 2) It's not clear at all what the difference is between the two code examples in Scenario 2. It seems like all cases of the second one would work in the first one, and also the non-domain parts of the logic are different, and it's not clear if that's a result of the history of this document, or if the examples are actually trying to illustrate different logic.
 * 3) The introduction to Scenario 3 does not mention in any way, shape, or form, how it differs from Scenario 2, other than that it is "Drupal style". I don't know what that means. In fact, the introduction essentially states that it is exactly the same as Scenario 2.

If I was a better mediawiki hacker I'd try to fix this myself, but I thought I'd just throw in some feedback in case any mediawiki pros out there want to spiff up this document.

Thanks! John

Scenario2 and shared privacy-, disclaimer- and copyright-pages
We use Scenario2 with one installation and multiple configs and databases. Everything works fine, but we want to have only one privacy-, disclaimer- and copyright-page for all (sub)wikis together. does anybody know if there is something like

$wgRightsUrl ...

for the disclaimer- and the privacy-page? -- Jens 09.11.2007

Scenario 2: Quick set-up - Clarity please - Second Part of the story
You want to install more than one wiki on a single server, using the same source code, and using the same database?

Same question as above: Aren't instructions one and two the basically the same?
 * 1) Install MediaWiki and additional tools as usual
 * 2) Set up your wiki (e.g., MyWiki)

Done, now I have something like Serverside: www/MyWiki With: www/MyWiki/config/LocalSettings.php


 * 1) After successful installation, move LocalSettings.php into the root directory of your wiki and rename it in such a way to make it easy to track (e.g., myWikiLocalSettings.php)

Done, now I have something like Serverside: www/MyWiki/MyWikiLocalSettings.php

Same question as above: I thought the point was to use the "same source code"? I am creating new Mediawiki installs?
 * 1) Repeat the steps above for each wiki you wish to create, with suitable local setting files (e.g., anotherWikiLocalSettings.php, etc.)

Done, now I have something like Serverside: www/MyWiki/MyWikiLocalSettings.php And Serverside: www/MyWiki/SecondMyWikiLocalSettings.php Serverside: www/MyWiki/ThirdMyWikiLocalSettings.php

I have also Serverside: www/MyWiki Serverside: www/SecondMyWiki Serverside: www/ThirdMyWiki with the complete code inside of each. Have I missed the "delete some files" part?


 * 1) Create a LocalSettings.php file for your global settings, then select one from the two possibilities below:

Done. Now I have a file named LocalSettings.php and inside I have

Now I put this into my "BaseWiki" e.g. MyWiki Serverside: www/MyWiki/LocalSettings.php

Each Wiki is working as “stand alone”. I have tried this with Xampp

hxttp://localhost/www/Mywiki/index.php & hxttp://localhost/www/SecondMyWiki/index.php

are bringing up the startpage. But after renaming and moving the LocalSettings to the MyWiki file and creating the new LocalSettings I see only

Error, Setup.php must be included from the file scope, after DefaultSettings.php

Any help is appreciated.. but please remember the poor people who rend a hostingpakage and not a whole server. I have to work with (Fire)FTP and phpmyadmin

same error, not working
I followed scenario two, not working too, i get the same error when trying to open wiki root wiki/...and 404 when adding the specified uri, en for example..i wanted to note that you don't install more wikis, just one wiki source..when you rename your generated localsettings.php, you can install mediawiki again with different settings and create another settings file (which you rename and continue to make another)..when you finish, you just create the global LocalSettings.php which have the ettins the method mentions which is not working for me..but may be that is because i use lighttpd though i doubt it..--Alnokta 14:34, 26 December 2007 (UTC)

Problem with Upload
$wgUploadNavigationUrl = "http://www.mywiki.org/wiki/index.php/Special:Upload"; won't work if I set this value in a german wiki (de/) which should use the mainwiki's (wiki/) Upload folder. don't want to have to different image/ folders but all in the same wiki/image/. Spezial:Upload in the german wiki will lead on upload to a write error: The upload directory (public) is not writable by the webserver. Of course, since I did not give write permission on de/image/ but this proves that the german uploaddirectory is still being used, despite the config. 86.39.64.5 13:19, 2 March 2008 (UTC)

Database error

 * A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:

(SQL query hidden)

from within function "MediaWikiBagOStuff::_doquery". MySQL returned error "1205: Lock wait timeout exceeded; try restarting transaction (localhost)".

Easiest way
The easiest and imho the best way to do this (and has been for several years) :
 * Create a unique domain name or subdomain for each wiki
 * Create a database for each wiki
 * Install one copy of Mediawiki and extensions (and probably a seperate copy purely to be used for running maintenance scripts) and point all subdomains to this folder in Apache
 * Optionally share an uploads area
 * Share the user database between wikis, using either the Mediawiki setting or by creating a SQL View
 * Use the conditional logic provided overleaf to alter the settings for each wiki based on which wiki is being accessed

It really is that simple and works a treat.

I don't know if it's possible on Windows because I don't know if IIS can serve multiple named hostnames from one folder, but I imagine it can. If not, it is at the very least possible to share common settings on Windows by using a require_once directive to read in the common settings. --Kingboyk 12:41, 15 June 2008 (UTC)

Scenario 4: no thumbnails?
I've shared uploads and descriptions and all that detailed in scenario 4. I made the permissions on the /images directory in the repository all 777. However, when I use the following code I get an error instead of a thumbnail. ends up like: Error creating thumbnail: Unable to create destination directory It seems like it's permissions-related. Any ideas?

Drupal Scenario doesn't not work
The drupal scenario looks rather clever, clean and flexible. My installation with several wikis now looks very clean and easy to understand and administrate. However, I get "Forbidden - You don't have permission to access / on this server." or "Forbidden - You do not have permission to access this document." when I try to access the new wikis after having followed closely the Drupal Scenario.

Here are things that I have tried out, which did however *not* solve the problem:
 * the setup has a versioned mediawiki directory with the actual code (a), a softlink to it named code (b) and a directory (c) for the actual wiki(s) with softlink to b. As this did not work, I thought that this may be due to the too many (3) stages, so I tried to reduce these stages to 2 or one by directly softlink from c to a or to directly mention the (a) or (b) directory as virtual directories of the wiki domain in the apache config. All did not work (and of course I restarted apache2 all the time).
 * I also tried to make sure that the user rights of the directories and softlinks were appropriate, again this did not help.
 * As I thought that may be the problem lies in the flexible LocalSettings.php, I tried to just call a simple html-file or the README file to make sure that the problem was not related to php and php code. but I even got the rights problems when calling such non-php code (Even connected to simple setups like the one mentioned above).
 * I should add that I tested the above scenario with latest Debian4, php 5.2, apache 2.2.

Has anyone ever tested it successfuly? The phrase "*should* now work" may indicate that this was not tested 1:1. So what is needed is more details in the explenation: what are the user and group rights/settings for each directory and link, how do you set up excactly the apache settings both for the mediawiki code directory, the mediawiki version directory and the actual wiki directory (Which is softlinkes/redirected to code which itself is again softlinked to the mediawiki version) etc...

Also, now the numbering of the scenarios has gone wrong, it seems we now have 2 (two!) scenarios both named "scenario 3", one of them being the Drupal Scenario.

Kai 91.62.106.57 22:16, 20 August 2008 (UTC)

Update (22 August 2008): These improvements helped: I was able to access the README files of teh wiki sites form the browser. I even was able to see the index.php.
 * the mediawiki, mediawiki/code and mediawiki/ directories needed to have rights rx for all (owner, group and all). This helped a lot.
 * when I combined this with directly accessing the /mediawiki/code directory in the apache configuration file,

However, I now have a different (less dificult, I hope) problem: I now see the setup page of the wiki. This should not display as I have a proper LocalSettings.php in my code/ directory copied from http://www.mediawiki.org/wiki/Drupal-style_LocalSettings.php )and changed the $confdir variable at the start of the file to point to my mediawiki directory) and I also have a LocalSettings.php in each /mediawiki/sites/ directory.

From debugging the code, it seems that the code from http://www.mediawiki.org/wiki/Drupal-style_LocalSettings.php is *NOT* able to locate the correct file from mediawiki/sites/ /LocalSettings.php (where I use domain without www prefix and without port or directory, just simple e.g. en.mywiki.org or similar domain names). I tried both versions in the history of that file, one with for loop and one with while loop, but both end with no $conf variable set and so end with the setup dialogue from /includes/templates/NoLocalSettings.php

What finaly helped was to set safe_mode_gid=On (I have safe_mode=On), as the file_exist function otherwise returned false. Now it seems to work...

"Drupal-style" means what, exactly?
Can this section be retitled/rewritten to make sense for everybody that hasn't used Drupal before? This name is given as if it is self-explanatory, but it is not. ⇔ ChristTrekker 04:27, 13 November 2008 (UTC)

Multiple Wikis, one install/config
I need to host a reasonably small number of similar wikis. I want to be able to update the source and configuration for all of them simultaneously, and have simplified maintenance. The solution I came up with is inspired by http://www.steverumberg.com/wiki/index.php?title=WikiHelp_-_Method_One and especially the reader comment about mod_rewrite. I wrote it up so I could remember, and because I thought it might be helpful. Bryan C. 68.188.91.87 05:00, 19 December 2008 (UTC)

The general idea is that we use the web server (Apache, here) to set an environment variable based on the URL. Then, in LocalSettings.php, we include a file that depends on the environment variable and contains exactly those settings needed for the selected wiki. All other settings can be shared. I have separate image directories for each wiki - I suppose this would work with a shared images directory, but I haven't tried it.

Why this is good:
 * Completely transparent to users
 * Can make a config change to all wikis at once since they all share the bulk of LocalSettings.php. For example, you can add an extension to all of them as easily as for a single wiki. You can also make settings only on some wikis, or on all but some wikis.
 * Avoids symbolic links, which will fail if the file structure of the MediaWiki install changes.
 * No need to customize maintenance scripts - just set an environment variable to choose which wiki they effect.
 * Only one directory needs to be backed up, and it's got everything.

Why you might try a different method:
 * Don't have the ability to add RewriteRules to Apache
 * Wikis will have widely differing settings/extensions.

This step-by-step shows how to set up a pair of wikis, which I'll call wiki1 and wiki2, and which are served at www.example.com/wiki1 and www.example.com/wiki2. I did this on Linux with Apache. The technique, but not the steps, should work in other settings.

Step 1: Create first wiki
In fact, I did this step a long time before moving to a multi-wiki setup. Just a normal install. If you plan to run multiple wikis under one database, you should use a different database prefix for each one.

Step 2: Add structure for separating wikis
Put a subdirectory structure on the images directory so that the images are stored in 'images/wiki1'. One way to do this is to rename images to wiki1, create a new directory images, copy wiki1 into it, then check that the permission settings are correct to allow write access by the webserver.

Split LocalSettings.php into two files, one still called "LocalSettings.php" and a second called "LocalSettings-wiki1.php". The -wiki1 file should contain only those settings which are specific to wiki1. For my setup, these were: Comments: Obviosly, you want different sitenames and possibly logos. The ScriptPath is so MediaWiki can generate pages with the correct URLs. For a single database solution, the DB variable could stay in LocalSettings.php and the site-specific file could set the prefix (mysql) or schema (postgres). The wgUpload variables set up the new images directory structure. I don't understand wgProxyKey, but I think it serves to keep a user's sessions untangled when they are logged in to multiple wikis.
 * $wgSitename = "Wiki1"
 * $wgScriptPath = "/wiki1"
 * $wgDBname
 * $wgUploadDirectory = "{$IP}/images/wiki1";
 * $wgUploadPath = "{$wgScriptPath}/images/wiki1";
 * $wgLogo
 * $wgProxyKey

Now add this to LocalSettings.php: require_once("$IP/LocalSettings-".$_SERVER["WIKI"].".php"); It includes the "LocalSettings-????.php" file depending on the state of the environment variable WIKI. I put this immediately following the require_once for DefaultSettings.

Add this line to the Apache config file: RewriteRule ^/wiki1(.*) /your/path/to/mediawiki$1 [E=WIKI:wiki1,last] The E part sets the environment variable "WIKI" to wiki1. The rest of the line is fairly standard and could be changed if needed.

At this point, you should test your single wiki and make sure everything still works, especially image upload/view.

Step 3: Add additional wiki(s)
Create the database for the new wiki and grant appropriate permissions to the DBuser, as done in a standard install (or skip this if you're using prefixes).

Create the images/wiki2 directory and set it's permissions so the webserver can write it.

Add a RewriteRule to Apache. It's the same as above, except with wiki2 in both places instead of wiki1.

Move LocalSettings.php to a different name temporarily.

Allow write permission on the config directory.

Browse to www.example.com/wiki2. It should look just like the config for a fresh install. Fill in the install form, nothing special (except the database or prefix needs to be set appropriately for wiki2).

Put back your LocalSettings.php file that you hid temporarily.

Create LocalSettings-wiki2.php. Either hand-edit a copy of LocalSettings-wiki1.php, or cut the important stuff out of the newly created config/LocalSettings.php (which is then no longer needed).

Test wiki2. Repeat step 3 to add more wikis.

Maintenance
To run a maintenance script, simply set an environment variable to pick the target wiki. For example, under Linux: WIKI=wiki1 php maintenance/checkUsernames.php

wiki family in PG
Seems that using schemas instead of table prefixes is the logical way of implementing a wiki family when using Postgres. I don't see any actual documentation for doing this, though. Am I just looking in the wrong place? Surely there's someone out there running more than one wiki on PG. ⇔ ChristTrekker 04:47, 7 January 2009 (UTC)