MediaWiki has extensions that add interesting functionality. The only downside of these extensions is that they can become obsolete with version changes. It's up to you to decide...however, some are only used occasionally.
Extensions
SpecialRenameuser.php
This extension is provided in Debian repositories, so I recommend installing it with apt. Otherwise, it's available here. Then you just need to link it:
Now, if you go to the Special pages, you'll have the ability to rename a user.
DeleteHistory
I developed this extension (DeleteHistory) myself. It allows you to delete the history of your articles. Besides leaving some traces (passwords, confidential information...), you might wonder why not keep the history.
I had the idea to create it because I previously used SpecialDeleteOldRevisions, but the developer wasn't reactive enough for my taste to update his extension and make it work everywhere. Moreover, he developed the entire deletion part himself, which certainly has advantages, but also a major disadvantage: it's not maintained by the MediaWiki team, and if changes to the database happen during an upgrade, the extension must be modified to accommodate these changes.
For my extension, I simply opted for a maintenance script provided by MediaWiki, which removes the problem mentioned above and allows me to be compatible with many different versions.
Depending on your wiki's purpose, this may or may not be important. But for mine, it's not very important!
This extension is available here. For those of you who are less interested, let me give you some numbers to consider. In one year of wiki usage, my database was 14 MB. With this extension that removes histories, I was able to reduce it to 4.8 MB. You can see the gain you can achieve by removing histories!
Google Ads
For Google Adsense, you must first create an account and then generate ad banners of your desired size.
Without skin modification
You need to install the PCR GUI Inserts module which will allow you to insert information at various places on your pages. First, activate the extension by adding these lines:
# Google Ads (bottom page)$wgPCRguii_Inserts['SkinAfterBottomScripts']['on'] = true;$wgPCRguii_Inserts['SkinAfterBottomScripts']['content'] = '<!-- Graphically aligned --><div style="margin-left: 160px;"><!-- Google Ads 1 --><script type="text/javascript"><!--google_ad_client = "*****PLACE YOUR CLIENT ID HERE******";/* 728x90 */google_ad_slot = "***CODE HERE***";google_ad_width = 728;google_ad_height = 90;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script><!-- End Google Ads 1 --></div>';
With skin modification
The disadvantage of this method is that when you update MediaWiki, these modifications are likely to be overwritten. You will then have to redo the configuration. Opt for the manual method if you want to be worry-free.
Monobook
Bottom section
Insert these lines in the file mediawiki/skins/Monobook.php:
</div><!-- end of the left (by default at least) column --> <div class="visualClear"></div> <div id="footer"><?phpif($this->data['poweredbyico']){?> <div id="f-poweredbyico"><?php$this->html('poweredbyico')?></div><?php}if($this->data['copyrightico']){?> <div id="f-copyrightico"><?php$this->html('copyrightico')?></div>
Vector
Bottom section
Insert these lines in the file mediawiki/skins/Vector.php:
I created an extension that doesn't require modifying the skin: https://www.mediawiki.org/wiki/Extension:GoogleSearch All explanations are on the MediaWiki page and it's very simple, so I won't rewrite those lines.
With skin modification
Implementing Google search is very practical, as the basic search isn't always the best. To have a small Google search at the bottom left of your menus, edit the file mediawiki/skins/Monobook.php. You need to place and adapt (obviously you need a Google Adsense account) this text:
If you want to keep the dotted lines around your sources, as well as the gray color (just like a <syntaxhighlight lang=text></syntaxhighlight>), here's what you need to add to your MediaWiki:Common.css address (e.g., https://www.deimos.fr/mytechnotebook/index.php?title=MediaWiki:Common.css):
I am very satisfied with it. I'll let you see how to do it on the link, as installation and configuration take only 2 minutes.
Setting default values
I have the annoying habit of always putting line=1 and start=0. But after a while, it gets annoying! That's why there are default variables, and here are the ones I've modified:
/** * Number at which line numbers should start at * @var int */ var $line_numbers_start = 0; /** * Flag for how line numbers are displayed * @var boolean */ var $line_numbers = GESHI_FANCY_LINE_NUMBERS; /** * The size of tab stops * @var int */ var $tab_width = 4; /** * The "nth" value for fancy line highlighting * @var int */ var $line_nth_row = 1;
If the changes aren't visible right away, run the update.php maintenance script:
Piwik is an equivalent to Google Analytics, but free. It allows you to have statistics of your website with nice graphs etc... There is a plugin to insert code into each page (necessary), but it's obsolete and has security flaws. So we will use another module that will allow us to insert this type of code easily.
You need to install the PCR GUI Inserts module which will allow you to insert information at various places on your pages. Activate the extension first by adding these lines:
# UsabilityInitiativerequire_once('extensions/UsabilityInitiative/UsabilityInitiative.php');# WikiEditorrequire_once("$IP/extensions/UsabilityInitiative/WikiEditor/WikiEditor.php");$wgWikiEditorModules['toolbar']['global'] = true; // Enable the WikiEditor toolbar for everyone$wgWikiEditorModules['toolbar']['user'] = false;// Don't allow users to turn the WikiEditor toolbar on/off individually# Collapse Menurequire_once("$IP/extensions/UsabilityInitiative/Vector/Vector.php");$wgVectorModules['collapsiblenav']['user'] = true;$wgVectorModules['collapsiblenav']['global'] = true;# Expandable search$wgVectorModules['expandablesearch']['user'] = true;$wgVectorModules['expandablesearch']['global'] = true;$wgVectorUseSimpleSearch = true;
As you can see, I activated the WikiEditor and the collapsible menu (Sidebar).
MediaWiki 1.17
In version 1.17, everything has been split up. So I use WikiEditor and Vector to get back the features I was interested in from version 1.16. Once installed in the extensions, activate everything:
MobileDetect is a simple solution to have a semblance of a version optimized for smartphones. This extension loads the "Chick" theme by default when the detected User Agent is a PDA/Smartphone. This solution is handy when you don't want to set up a complex system to make the pages as well adapted as possible to portable devices.
Put the code in the "extensions" folder, then add this to your LocalSettings.php:
This extension is very practical because it allows you to dump your wiki in HTML format with images and everything else for offline use. Download the extension, then all you have to do is execute it with some optional parameters to get a good result. For my part, I made a script that dumps the wiki and compresses it. Here's the script:
#!/bin/sh# Dump MediaWiki to html# This permit to get an offline site# Made by Pierre Mavro / Deimosmediawiki_path="/var/www/deimos.fr/mytechnotebook"archive_name="bni_offline"##################################################### Check if extension is hereif[-f"$mediawiki_path/extensions/DumpHTML/dumpHTML.php"];thendumpHTML_php="$mediawiki_path/extensions/DumpHTML/dumpHTML.php"elif[-f"$mediawiki_path/maintenance/dumpHTML.php"];thendumpHTML_php="$mediawiki_path/dumpHTML.php"elseecho"Can't perform a dump as dumpHTML.php is not found"exit1fiskin=`grep'^\$wgDefaultSkin'$mediawiki_path/LocalSettings.php|awk-F\''{ print \$2 }'`archive_folder="$mediawiki_path/$archive_name"echo"-- Start to dump the wiki --"php$dumpHTML_php-d$archive_folder-k$skin--image-snapshot--force-copy
echo"-- Compress the wiki dump archive --"cd$mediawiki_pathtar-czf$archive_name.tgz$archive_nameecho"-- Remove the uncompressed dump archive"rm-Rf$archive_folderecho"Done"
CharInsert
CharInsert is an extension that allows you to add a small bar in edit mode with the wiki code that we use most often or the one that is most difficult to find. The goal is to simplify page editing as much as possible.
Download and install the extension. Once done, you need to create the following page https://wiki.deimos.fr/mytechnotebook/index.php?title=MediaWiki:Edittools# Insert the text you want with the <charinsert>+</charinsert> tags, and put in the middle the code you want (use + so that your cursor automatically goes to this point after insertion):
<!-- Any text entered here will be displayed under the edit boxes or file upload forms. -->
<!-- Text here will be shown below edit and upload forms. -->
<!-- Please don't translate this page with sub pages (it will render support of that menu for your language very likely unmaintainable) -->
<div id="specialchars" class="my-buttons" style="margin-top:10px; border:1px solid #aaaaaa; padding:1px; text-align:center; font-size:110%;" title="Click on the wanted special character.">
<p class="specialbasic" id="Standard">
<charinsert>__TOC__</charinsert> ·
<charinsert>[[:Image:+|thumb|Name]]</charinsert> ·
<charinsert>[[:Media:+]]</charinsert> ·
<charinsert>[[:Image:+]]</charinsert> ·
<charinsert>[[Category:+]]</charinsert>
<br />
<charinsert><pre></charinsert> ·
<charinsert></pre></charinsert> ·
<charinsert><nowiki><syntaxhighlight lang=text></nowiki>+</charinsert> ·
<br />
<charinsert><nowiki>{{command|+|<syntaxhighlight lang=text></nowiki></charinsert> ·
<charinsert><nowiki>{{config|+|<syntaxhighlight lang=text></nowiki></charinsert> ·
</p>
</div>
/* Extra buttons for 'edittools' */.my-buttons{/* padding: 1em; *//* margin:5px; */}.my-buttonsa{color:black;background-color:#d0e0f0;font-family:monospace;font-size:115%;text-decoration:none;border:thin#069outset;line-spacing:5pt;}.my-buttonsa:hover{background-color:#99ccff;border-style:outset;}.my-buttonsa:active{background-color:#0645ad;border-style:inset;}
Now when editing an article, you will have your new toolbar.
Cite
The Cite extension allows you to have a references section. Until today, I managed it manually, but now I use this extension which allows me to make automatic links. It's practical and beautiful. However, we can make it even more beautiful by editing the CSS:
/* make the Cite extension list of references look smaller and highlight clicked reference in blue */ol.references{font-size:90%;}ol.references>li:target{background-color:#ddeeff;}sup.reference:target{background-color:#ddeeff;}
I had been telling myself for a long time that I should find an extension that does multi-file uploads. And I'm very happy to have found one that's well-made, pretty, and as usual simple to set up. It's MsUpload. To install it, simply unzip the desired version into the extensions folder and add this to the LocalSettings file:
When editing, a blue bar will appear, and you can just drag and drop.
SphinxSearch
SphinxSearch replaces the basic search provided by MediaWiki, which is not fulltext. Explaining how to set this up here would be too long, so there is a dedicated article about it.