Mediawiki Installation: Difference between revisions

From SaruWiki
Jump to navigation Jump to search
(added tricks section)
m (→‎Other interesting tricks: added pw resets)
Line 68: Line 68:
==Other interesting tricks==
==Other interesting tricks==
* [[Wiki news items|Creating news items in a semantic wiki]]
* [[Wiki news items|Creating news items in a semantic wiki]]
* fixing access to a wiki when the sysop forgot his password (method 1, CLI access needed):<br>change directory: ''cd /path/to/mediawiki/maintenance''<br>run the following maintenance script: ''php changePassword.php --user="WikiSysop" --password="TheNewPassword"''
* fixing access to a wiki when the sysop forgot his password (method 2, MySQL access needed):<br>enter the MySQL client using an account with sufficient rights to alter the database of your wiki, then run these MySQL commands on the right database:<br>''UPDATE user SET user_password = MD5(CONCAT(user_id, '-', MD5('TheNewPassword'))) WHERE user_id = 1;''

Revision as of 16:39, 7 September 2010

Installation of MediaWiki

Here we have the basic installation of MediaWiki outlined for you.

The default installation will create your wiki in subdirectory /mediawiki. Should you wish to have another name, e.g. http://www.yourserver.com/wiki, then you must make two changes.

Extra configuration

After installation of MediaWiki, your Wiki is available on every Virtual Host you run - unless you follow the instructions to place MediaWiki inside a Virtual Host.

An extra feature we added was support for iFrames by means of a little PHP script that we googled; the extension is called websiteFrame.php.

Furthermore, we changed the Creative Commons picture in the footer from a remote one to a local one.

For performance, the following tricks can be used (which we found on this site):

  • apt-get install php-apc
    to install a PHP accelerator;
  • add $wgMainCacheType = CACHE_ACCEL; (instead of CACHE_NONE) into LocalSettings.php to enable that installed APC PHP accelerator;
  • add $wgDisableCounters = true; into LocalSettings.php to disable the page counters.

On the example site referenced, the cache reduced rendering of an (almost empty) main page from 217ms to 50ms; disabling the page view counter took off another 10ms.

Should you wish to customize the look of your MediaWiki wiki, then you must edit the MediaWiki skins.

Extensions

One of the nice things about using something as popular as MediaWiki is the availability of a great number of extensions. One of the first things to do, therefor, is to install the default Debian Mediawiki Extensions package.

For user management, we added the extensions Password Reset and Group Permissions Manager.

A feature we needed to gain experience for another project was the Semantic MediaWiki (SMW) extension; it also has a pretty simple installation.

Multiple Wiki's on a single server

Some people want to run multiple Wiki instances on one single server - especially so if that server runs multiple websites (the forementioned Virtual Hosts). The answer to that is to create a Wikifarm.
Note that we've set up a separate site for this problem - you're welcome there with any questions you might have on wikifarms on Debian.

User Rights management

The MediaWiki documentation quite clearly documents how to manage user rights, but here is a very quick recap:

The following user rights are granted implicitly to non-logged-in users:

// Implicit group for all visitors
$wgGroupPermissions['*'    ]['createaccount']   = true;		// 1.5.0
$wgGroupPermissions['*'    ]['read']            = true;		// 1.5.0
$wgGroupPermissions['*'    ]['edit']            = true;		// 1.5.0
$wgGroupPermissions['*'    ]['createpage']      = true;		// 1.6.0
$wgGroupPermissions['*'    ]['createtalk']      = true;		// 1.6.0

So if you want to limit the rights of anonymous users, paste these lines into LocalSettings.php and change to false those rights that you want to take away. e.g. if you do not want anonymous users to edit pages, set the 'edit' permission to false. Setting 'read' to false requires users to log in before they can read your wiki (but they can still see the sidebar!)

The following rights are implicitly granted to all logged-in users.

// Implicit group for all logged-in accounts
$wgGroupPermissions['user' ]['move']            = true;		// 1.5.0
$wgGroupPermissions['user' ]['read']            = true;		// 1.5.0
$wgGroupPermissions['user' ]['edit']            = true;		// 1.5.0
$wgGroupPermissions['user' ]['createpage']      = true;		// 1.6.0
$wgGroupPermissions['user' ]['createtalk']      = true;		// 1.6.0
$wgGroupPermissions['user' ]['upload']          = true;		// 1.5.0
$wgGroupPermissions['user' ]['reupload']        = true;		// 1.6.0
$wgGroupPermissions['user' ]['reupload-shared'] = true;		// 1.6.0
$wgGroupPermissions['user' ]['minoredit']       = true;		// 1.6.0
$wgGroupPermissions['user' ]['purge']           = true;	 	// 1.10.0

NOTE: you cannot let normal users keep a right like 'edit' and take it away for a special group that you create, like 'students'. You MUST grant the group 'user' the fewest rights that anyone should have, grant extra rights to other groups, and place the right users in these other groups. Examples:

$wgGroupPermissions['student' ]['edit']            = false; // WILL NOT WORK

The above will NOT "give everyone edit rights except for students".

$wgGroupPermissions['*'    ]['edit']            = false;		// 
$wgGroupPermissions['user' ]['edit']            = false;		// explicitly take away edit from all logged-in users
$wgGroupPermissions['staff' ]['edit']           = true;		// then give back edit to everyone except standard
$wgGroupPermissions['visitingstaff' ]['edit']   = true;		//  users

This WILL work: the edit right is taken away from everyone, including students, untill that right is explicitly restored. Just restore it to the necessary groups, taking care not to restore it to 'students'.

So if you want to grant everyone 'edit' except for a particular account - sorry, don't know how that'd work.

Other interesting tricks

  • Creating news items in a semantic wiki
  • fixing access to a wiki when the sysop forgot his password (method 1, CLI access needed):
    change directory: cd /path/to/mediawiki/maintenance
    run the following maintenance script: php changePassword.php --user="WikiSysop" --password="TheNewPassword"
  • fixing access to a wiki when the sysop forgot his password (method 2, MySQL access needed):
    enter the MySQL client using an account with sufficient rights to alter the database of your wiki, then run these MySQL commands on the right database:
    UPDATE user SET user_password = MD5(CONCAT(user_id, '-', MD5('TheNewPassword'))) WHERE user_id = 1;