Extension:SiteMatrix

From MediaWiki.org
Jump to: navigation, search
Note: This extension is made for Wikimedia wikis. It may work for other wikis, but note that the extension contains Wikimedia-specific text.
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
SiteMatrix

Release status:Extension status stable

ImplementationTemplate:Extension#type Special page, API
DescriptionTemplate:Extension#description adds a special page with a matrix of all Wikimedia sites
Author(s)Template:Extension#username Tim Starling, Brion Vibber, Victor Vasiliev, Alexandre Emsenhuber
Latest versionTemplate:Extension#version 1.4.0 (2016-07-22)
LicenseTemplate:Extension#license GNU General Public License 2.0 or later
Download
ExampleTemplate:Extension#example Special:SiteMatrix
ParametersTemplate:Extension#parameters
  • $wgSiteMatrixFile
  • $wgSiteMatrixSites
  • $wgSiteMatrixPrivateSites
  • $wgSiteMatrixFishbowlSites
  • $wgSiteMatrixClosedSites
Hooks usedTemplate:Extension#hook
APIQuerySiteInfoGeneralInfoManual:Hooks/APIQuerySiteInfoGeneralInfo

Translate the SiteMatrix extension if it is available at translatewiki.net

Check usage and version matrix.

IssuesPhabricator

Open tasks · Report a bug

The SiteMatrix extension adds a special page with a matrix of all sites of the Wikimedia Foundation. First a table of all normal language wikis, with blue links for existing wikis and red links for non-existing wikis. Below a list of other special projects (like Meta, Commons, Wikimania, ...), mostly the sites like *.wikimedia.org.

Installation

  • Download and place the file(s) in a directory called SiteMatrix in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
wfLoadExtension( 'SiteMatrix' );
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

To users running MediaWiki 1.24 or earlier:

The instructions above describe the new way of installing extensions using wfLoadExtension(), since MediaWiki 1.25. If you need to install this extension in earlier versions, instead of wfLoadExtension( 'SiteMatrix' );, you need to use:

require_once "$IP/extensions/SiteMatrix/SiteMatrix.php";

Configuration

There are some variables that you need to change:

  • $wgSiteMatrixFile - The path to a list of language codes recognised by MediaWiki (example).
  • $wgSiteMatrixPrivateSites - The path to a list of wiki databases that are private (optional)
  • $wgSiteMatrixFishbowlSites - The path to a list of wiki databases that are public, but only logged in users can edit. (optional)
  • $wgSiteMatrixClosedSites - The path of a list of wiki databases that "closed" (optional)

You would also need to customise $wgSiteMatrixSites to list the different wikis in your own wikifarm. To add a new site, follow the template in extension.json as a guide (but be sure to convert the syntax to PHP). However, you cannot remove any of the default sites (Wikipedia, Wiktionary, etc.) unless you edit extension.json directly, because extension loading does an 2D array merge.

Additional requirements

To ensure that the extension works correctly to your needs, there are a few dependencies to this extension:

  • $wgLocalDatabases - To tell the extension all the wiki databases that exist in your wikifarm.
  • $wgConf - To feed the extension with the correct links to the different wikis in your wikifarm.

API

This extension adds an API module that provides the same information as Special:SiteMatrix: a set of language groups plus special wikis.

action=sitematrix (sm)

(main | sitematrix)
  • This module requires read rights.
  • Source: SiteMatrix
  • License: GPL-2.0+

Get Wikimedia sites list.

The code (technically dbname/wikiid) is either the language code + project code for content projects or the subdomain + main domain for all the others.

Parameters:
smtype

Filter the Site Matrix by type:

special
One off and multilingual Wikimedia projects.
language
Wikimedia projects under this language code.
Values (separate with |): special, language
Default: special|language
smstate

Filter the Site Matrix by wiki state:

Values (separate with |): all, closed, private, fishbowl, nonglobal
Default: all
smlangprop

Which information about a language to return.

Values (separate with |): code, name, site, localname
Default: code|name|site|localname
smsiteprop

Which information about a site to return.

Values (separate with |): url, dbname, code, sitename
Default: url|dbname|code|sitename
smlimit

Maximum number of results.

No more than 5,000 (5,000 for bots) allowed.
Type: integer or max
Default: 5000
smcontinue

When more results are available, use this to continue.

Example:
Show the site matrix
api.php?action=sitematrix [open in sandbox]

More examples

Show site matrix (only parts are shown here)

See also