MediaWiki modules are extensions that add new functionality to the wiki software. Modules allow you to customize and enhance your wiki’s features beyond what comes included in the base MediaWiki installation.
Modules are packaged code libraries that can hook into MediaWiki. They provide additional tools, interface changes, data storage options, and more. Administrators can install over 2,000 freely available modules depending on their needs.
Some key benefits of using modules include:
Adding features – You can enable complex functionality like visual editing, maps, data graphs, multimedia handling, and more through modules.
Lower development costs – Installing modules is easier and faster than building custom features from scratch. Modules save development time and resources.
Community support – Popular modules have large user bases that can help troubleshoot issues. Modules are also regularly maintained and updated.
Customization – Modules allow you to tailor your wiki to suit your use case by enabling only the needed features.
Scalability – As your needs grow, you can incrementally add modules to expand your wiki’s capabilities.
In summary, modules provide an easy and flexible way to extend MediaWiki. With a library of modules, wiki owners can create customized wikis with the required features.
Table of Contents
Where Modules Are Stored
MediaWiki modules are stored in the extensions/ folder in the MediaWiki installation directory. This is where all add-on extensions reside.
The full filesystem path is:
Modules are stored in their subfolders within extensions/. For example:
Modules can also be exported using MediaWiki’s built-in export tool, Special: Export. This can export a module’s code into an XML file for easy sharing and installation on other wikis.
For example, navigating to Special: Export/TemplateStyles on a wiki with TemplateStyles installed will export that extension’s code into an XML file.
The Special: Export page lists all extensions/modules on a wiki for selective exporting.
How To Find Modules In Mediawiki
There are several ways to find modules to extend MediaWiki’s functionality:
Documentation on mediawiki.org
The MediaWiki website contains extensive documentation on available modules. The Extension page lists all official and recommended extensions, while the Developer hub covers module development. The documentation details what each module does, installation instructions, configuration settings, and more.
The Category: Modules page on mediawiki.org categorizes modules by function. For example, modules related to user rights, spam blocking, and editing workflows can be browsed. The category view offers a quick way to find modules for a specific purpose.
In addition to the official MediaWiki repositories, many third-party repositories host MediaWiki modules. These include GitHub organizations like MediaWiki-extensions-Peer-Review and Wikimedia. Searching on GitHub can surface less common modules not found on mediawiki.org.
There are two main ways to install modules in MediaWiki:
Using Special: Export
The Special: Export page allows installing modules directly within your wiki. Navigate to Special:Export and enter the extension name you want to install. Click the “Download” button. This will download a .xml file containing the module code.
Then go to Special: Import and upload the .xml file. Make sure to check the “Install” box before submitting. This will install the module files directly into your wiki’s extensions folder.
The Special: Export method is the easiest way to install modules, especially for beginners. It handles placing all the files in the correct locations.
You can also install modules manually by downloading the code and uploading it to your server. This takes a few more steps:
Download the module code as a .zip file, usually from MediaWiki.org or a third-party repository.
Unzip the files to your computer.
Use FTP to upload the module folder to your wiki’s extensions folder on the server.
Add the following line to your LocalSettings.php file to enable the module:
wfLoadExtension( 'ExtensionName' );
Replace “ExtensionName” with the folder name of the module.
Manual installation gives you more control but requires FTP access and editing files. Overall, Special: Export is recommended for most use cases.
Once installed, a module must be configured and enabled to work properly in your MediaWiki instance. There are two main steps to configuring a module:
Enabling the Module
To enable a module, you need to add the following line to LocalSettings.php:
wfLoadExtension( 'ExtensionName' );
Replace ‘ExtensionName’ with the actual name of the extension.
This will load and enable the module to run when MediaWiki is started. Some modules may require additional parameters to be set in LocalSettings.php – check the documentation for required settings.
Most modules allow some customization and configuration via parameters. These are also set in LocalSettings.php.
For example, to set the limit for the number of results shown by the TemplateSandbox extension, you could add:
$wgTemplateSandboxResultLimit = 50;
The parameters available depend on the module. Refer to the documentation on MediaWiki.org for details on the settings specific to each extension.
Some common parameters you may want to configure include:
Enabling/disabling specific features of a module
Setting limits for things like results, revisions, etc.
Providing API keys or credentials
Configuring file paths, URLs, databases, etc.
Properly configuring parameters is important so the module integrates smoothly with your wiki. Take time to understand what options are available.
Some of the most popular and widely used modules in MediaWiki include:
The Template documentation module adds syntax highlighting and formatting to template documentation pages. This makes reading and understanding templates much easier by clearly showing template code samples. Some features include:
ImportJS allows importing data from external JSON APIs into wiki pages using a simple tag syntax. For example, ImportJS can pull in content from sources like YouTube, Twitter, etc.
Scribunto is a framework for embedding scripting languages like Lua into wiki pages. It allows creation complex modules and templates by writing code that generates wiki markup.
VisualEditor provides a visual editing interface for wiki pages instead of editing wikitext code directly. It makes editing more accessible for new users by providing a word processor-like experience.
These modules add powerful extra functionality to MediaWiki, including templates, importing data, scripting, and editing. They showcase the flexibility and customization available through modules.
Modules can add all sorts of functionality to a MediaWiki installation. Here are some common use cases:
The UniversalLanguageSelector module works alongside it to auto-detect the language and apply highlighting without needing language tags. This improves the experience for developers and users posting code snippets.
The ImportArticles module allows importing articles from another wiki or XML files. This is useful for migrating content or templates from one MediaWiki instance to another.
Similarly, the ImportFreeImages module can pull Creative Commons-licensed images from Wikimedia Commons into your wiki database. This seeds your wiki with free illustrations that can be used in articles out of the box.
Enhancing Editing Experience
Modules like VisualEditor, CodeEditor, and Template Wizard help enhance the editing experience in MediaWiki. VisualEditor provides a WYSIWYG interface for editing pages. CodeEditor adds syntax highlighting and other IDE features for source editing. TemplateWizard guides users through inserting templates correctly.
These editor-focused modules make editing pages more intuitive for newcomers and experienced users. They demonstrate how modules can modify and enhance core MediaWiki functionality.
Best Practices For Working With MediaWiki
When working with MediaWiki modules, keep these best practices in mind:
Only enable modules you need. Unused modules can impact performance.
Check requirements for memory, CPU, and PHP versions. Make sure your server meets them.
Monitor performance after enabling new modules. Check page load times, memory usage, etc.
Cache modules that do intensive processing. Caching can improve performance dramatically.
Batch database writes where possible instead of running 1 query per edit.
Keep modules updated to the latest stable version for security and bug fixes.
Review release notes when updating to see if configuration changes are needed.
Test updates on a development/staging wiki first before updating production.
Check the module documentation for help troubleshooting issues.
Search existing bug reports and forum discussions for potential solutions.
When reporting a new issue, provide reproducing steps, wiki version, logs, and screenshots.
You may need to downgrade the module for critical issues until a fix is available.
Installing modules is a great way to extend the functionality of your MediaWiki install. We covered what modules are, where to find them, how to install and configure them, and some popular examples.
Modules let you add features to MediaWiki without modifying core code. They are stored in the extensions/ folder or can be installed via Special: Export. The MediaWiki website lists many modules to browse through. You enable modules in LocalSettings.php and set parameters there too. Some useful modules are VisualEditor, Scribunto, and ImportJS.
With modules, you can add syntax highlighting, import templates or content, and enhance user editing experience. Take care when adding modules so as not to impact performance too much. Keep modules up to date and report any issues you find.
To learn more, check out the MediaWiki documentation on installing extensions. The extension directory also has details on specific modules. With this knowledge, you should feel empowered to find and install modules to take your wiki to the next level!
I’m a writer, artist, and designer working in the gaming and tech industries. I have held staff and freelance positions at large publications including Digital Trends, Lifehacker, Popular Science Magazine, Electronic Gaming Monthly, IGN, The Xplore Tech, and others, primarily covering gaming criticism, A/V and mobile tech reviews, and data security advocacy.