MediaWiki

From GreyWiki

Jump to: navigation, search

Contents

Pretty URLs

In LocalSettings.php:

$wgScriptPath       = "/wiki";
$wgScript           = "$wgScriptPath/index.php";
[...]
$wgArticlePath      = "/w/$1";

Replace "wiki" with the actual script directory and "w" with what you want in the URL.

In the Apache config:

Alias /w /var/www/wiki/index.php
Alias /index.php /var/www/wiki/index.php

Again, replace "w" with what you want in the URL shown to the visitor. Note that the last entry may (most likely) need /w or /wiki in front of it. (TODO: Confirm from GreyWiki server config.)

Permissions

One thing I'm fond of is locking out anonymous edits. How? The following block goes at the end of LocalSettings.php:

#
# Permission keys given to users in each group.
# All users are implicitly in the '*' group including anonymous visitors;
# logged-in users are all implicitly in the 'user' group. These will be
# combined with the permissions of all groups that a given user is listed
# in the user_groups table.
#
# This replaces wgWhitelistAccount and wgWhitelistEdit
#
# The following line should be commented, otherwise these settings will
# throw away the settings on DefaultSettings.php (you probably don't want this).
# With this line commented you will only overwrite the settings you explicitly
# define here (that's what you probably want).
#$wgGroupPermissions = array();
$wgGroupPermissions['*'    ]['createaccount']   = false;
$wgGroupPermissions['*'    ]['read']            = true;
$wgGroupPermissions['*'    ]['edit']            = false;
$wgGroupPermissions['sysop']['edit']            = true;

Categories

At the bottom of a given page, entering [[Category:Foo]] will add the page in question to the "Foo" category. One can then follow the newly-created Category: Foo link at the bottom of the saved page to create a basic document for the new category's page. If that category page contains another Category tag, such as [[Category:Bar]], then the "Foo" category becomes a subcategory of "Bar".

Put another way:

"If you have

Page One - [[Category: Baseball]]

and you have

Category: Baseball with a tag on the page called [[Category: Sports]]

You would then find that 'Baseball' is a subcategory of 'Sports'."

The main use of categories on this website is to provide a ready-made "related content" mechanism. This is in lieu of techniques like filling the home page and/or navigation column with links to every possible section. Categories are a very good idea, so please ensure that any new page includes an appropriate category tag. (There's a special page which displays the current category list if you're not sure.)

Side note: Linking to a category from the article body itself is done by prepending a colon to the link content, as in [[:Category:Foo|The Foo Category]].

TLA search enabling

This may not be of very much use on a server like Duckpond, but on a Wiki-specific rig it could come in quite handy. For instance, at my current job being able to search for TLAs is a bonus. By default MySQL has a minimum of four characters for a search word.

(From MySQL's docs on Fine-Tuning MySQL Full-Text Search:)

The minimum and maximum length of words to be indexed is defined by the ft_min_word_len and ft_max_word_len system variables (available as of MySQL 4.0.0). See Section 5.3.3, “Server System Variables”. The default minimum value is four characters. The default maximum depends on your version of MySQL. If you change either value, you must rebuild your FULLTEXT indexes. For example, if you want three-character words to be searchable, you can set the ft_min_word_len variable by putting the following lines in an option file (you can simply put these lines in my.cnf):

[mysqld]
ft_min_word_len=3

[myisamchk]
ft_min_word_len=3

Then restart the MySQL server and rebuild your FULLTEXT indexes. (Also note particularly the remarks regarding myisamchk in the instructions following this list.) To do this, simply run the mediawiki rebuild text script by executing a mediawiki maintenance script found in the wiki/maintenace directory:

php rebuildtextindex.php

You might want to consult this site for further reference.

Common.css

If we want to have some custom CSS, add

$wgUseSiteCss = true;

to LocalSettings.php, edit MediaWiki:Common.css and then clear the browser cache (to see it take effect). This is useful to, for instance, add classes we can style (in the case of tables).

Of course, this won't be useful until we can upgrade MediaWiki on our server...

Personal tools