“Awesome” Mediawiki Extension

I have been studying about how to make an extension in MediaWiki. Recently I came across an extension called “Awesome”. What it does is that is simply boldens all the words which have the occurrence of the word-pattern “awesome”.

Procedure to install an extension in MediaWiki

Generally, at the end of the LocalSettings.php file (but above the PHP end-of-code delimiter, “?>“, if present), the following line should be added:
require_once "$IP/extensions/extension_name/extension_name.php";
(Here $IP is the absolute path where your MediaWiki is installed).
This line-code forces the PHP interpreter to read the extension file, and thereby make it accessible to MediaWiki.
Some extensions can conflict with maintenance scripts, for example if they directly access $_SERVER (not recommended).
In this case they can be wrapped in the conditional so maintenance scripts can still run.
if (!$wgCommandLineMode) {
   require_once "$IP/extensions/extension_name/extension_name.php";
}

 

Ensure that required permissions are set for extensions!
While this installation procedure is sufficient for most extensions, some require a different installation procedure. Check your extension’s documentation for details.
If you want to alter configuration variables in LocalSettings.php, you have to do this typically after including the extension. Otherwise defaults defined in the extension will overwrite your settings.
Caution! Caution: While extension declaration can be placed in other places within the LocalSettings.php file, never place extensions before the require_once "includes/DefaultSettings.php"; line for MediaWiki versions below 1.17 . Doing so will blank the extension setup function arrays, causing no extensions to be installed, and probably will make your wiki inaccessible until you fix it!

We can see the extension working via the following images, see the “awesome” word being boldened:

 army

awesome

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s