Finding software in MediaWiki

The software that runs the MediaWiki wiki you are using is likely not just stored only in the main MediaWiki repository, mediawiki/core. Everything from the skin you are using (likely Vector), to the extensions that are enabled (maybe VisualEditor), to the userscripts that you've enabled are stored somewhere else other than mediawiki/core.

If you want to add a feature or fix a bug part of one of these software, finding which repository or file that code is stored in and where the code that you want to fix is a necessary, and sometimes challenging step.

Custom software edit

First, make sure that the software you are looking to find is not a custom JavaScript or CSS resource that is unique to your account or the wiki you are on. Most custom resources are stored on-wiki and are not part of an external repository so searching for them outside of the wiki will not work.

To verify what you are looking for is not something custom to your account, make sure that it is feature available to users who are not logged-in. You can do this by opening a private browser window and navigating to the page you are interested in on the wiki. If something is a resource custom to your account, look through your scripts and styles enabled in your user common.js and common.css pages and find which script the feature might be associated with. Also be sure to check the gadgets that are enabled on your account. The script locations of gadgets on a wiki can be found at Special:Gadgets.

To verify that what you are looking for is not custom to the wiki, make sure the feature exists on other MediaWiki wikis and be sure to check the MediaWiki:Common.js and MediaWiki:common.css pages on your wiki to verify it isn't a feature loaded for all users.

If what your looking for is created through custom software but you can't find the origin page the feature is created by, searching the wiki for the code the software defines can help you locate the software. Right click on the custom feature and click "Inspect". Copy a unique part of the HTML code the software defines and try plugging it into Special:Search. If you still cannot find it by searching, asking the community members of the wiki about where the feature comes from can help.

MediaWiki software edit

If the feature you're looking for is not a custom resource, then it's likely part of MediaWiki core, an extension, or another feature of MediaWiki installed as part of the MediaWiki instance itself.

Searching code edit

Because MediaWiki is a website, one of the first things you should check is the HTML code on the page that is relevant to the feature that you are looking to changing. Right click on the element that is of interest on the web page and clicking "Inspect" will open the browser tools with the HTML code of the element you just selected. Take your time exploring the HTML code of this page near the element to get an idea of how it works. Next, use Codesearch to look up parts of the HTML code that are of interest to you. Codesearch will allow you to search for code stored across many Wikimedia repositories stored in Gerrit. Gerrit is not indexed by search engines and will therefore not show up in the results of a search engine query, so you should use Codesearch instead. Codesearch results will point you towards the repositories this code is defined in and exactly what file and line they are defined on.

Getting to a repository from a Codesearch result edit

When you click on a Codesearch result, you will be directed to a file of the repository that has that search result at a certain commit (point in the repository's change history). To get to the root repository in its current state, if

gerrit.wikimedia.org / mediawiki / extensions / Wikibase / a856c41cb996fb83f3ea16a40f866866e75d12e7 / . / docs / namespaces.php

is the path of the file shown at the top of the page, then you can get back to the root repository by clicking on the directory that is to the left of the commit hash a856c41cb996fb83f3ea16a40f866866e75d12e7 (Wikibase). Next click on the master branch that is in the left sidebar to view the current repository code. To navigate back to the file that had the code you were looking for, go through the repository in the path order that is to the right of the / . / (docs / namespaces.php).

If you do not get any results from Codesearch edit

If you do not get any results with your first query on Codesearch, try multiple other similar queries and utilize file type filtering as well. It may take multiple queries until you find what you're looking for.

If you cannot find the code you are looking for using Codesearch, try:

  1. Looking it up using a search engine. The code may be part of a repository that is not included in Gerrit and instead stored on another platform like GitHub or GitLab.
  2. Looking at Special:Version to see all of the additional software installed on wiki and if the feature you're looking for is part of any of them.
  3. Asking community members of your wiki where the feature comes from.

Searching mediawiki.org edit

Almost all MediaWiki features and extensions are documented here on mediawiki.org. Looking up the name of a feature or piece of software here may yield what you are looking for.

If you get to the page of a MediaWiki extension, its source code can be found by clicking on the browse repository link part of the Download section in the extension infobox on the right at the top of the page.

If you cannot find what you are looking for on mediawiki.org, looking up software using a search engine may yield better results.

Next steps edit

After finding the software, you may be looking into how you can change it to add a feature or fix a bug.

To contribute to userscripts, see Gadget_kitchen#Contributing_to_user_scripts.

To contribute to MediaWiki software, see How to become a MediaWiki hacker.