Contents

MediaWiki tips & tricks

This is a list of tips and tricks I use on various MediaWiki that I run.

Various versions, such as 1.15.1 for 1.15.1 – 2009-07-13, may appear.

Unbreakable space

I use the tilde character ∼ as a synonym of  , through the Extension:PatchOutput. This wouldn't work on a normal wiki where thinks like ∼∼∼∼ are used for signatures.

Disable caching

There is an extension called magic cache for single pages. To disable all sort of caching [1]:

## Disable all forms of MediaWiki caching $wgMainCacheType = CACHE_NONE; $wgMessageCacheType = CACHE_NONE; $wgParserCacheType = CACHE_NONE; $wgCachePages = false;

Disable links

On Laussywiki, you can't follow a red-link (that refers to a page that still does not exist), unless you're Elena or myself. If you try to force your way, you will be blocked by login permissions. Regular users do not get distracted in opening a page that tells them it does not exist and that they cannot create it. The link, however, exists, to inform it will/should appear at some point and brings light on how the authors structure their thoughts. This is achieved by patching includes/Linker.php:

1.18.1

Same as 1.16.0 but the block starts on line 300.

1.16.0

Line 285:

# Get a default title attribute. if( $target->getPrefixedText() == '' ) { # A link like [[#Foo]]. This used to mean an empty title # attribute, but that's silly. Just don't output a title. } elseif( in_array( 'known', $options ) ) { $defaults['title'] = $target->getPrefixedText(); } else { $defaults['title'] = wfMsg( 'red-link-title', $target->getPrefixedText() ); if ( !($wgUser->isLoggedIn()) ) { $defaults['onclick'] = "return false;"; } }

1.15.1

Line 287:

# Get a default title attribute. if( in_array( 'known', $options ) ) { $defaults['title'] = $target->getPrefixedText(); } else { $defaults['title'] = wfMsg( 'red-link-title', $target->getPrefixedText() ); if ( !($wgUser->isLoggedIn()) ) { $defaults['onclick'] = "return false;"; } }

We added the line that puts
onclick="return false;"
to the a tag, which prevents unlogged users to go further.

Color

The color is set as black with: (the !important keyword is to override another definition elsewhere)

a.new { color: black !important;}