API:Siteinfo

From MediaWiki.org
Jump to: navigation, search
Tools clipart.png This page is part of the MediaWiki action API documentation.

MediaWiki action API

v · d · e

Siteinfo returns overall site information. The code for the siteinfo function is located at ApiQuerySiteinfo.php.

Parameters[edit]

  • siprop: Which properties to get. (Default: general)
    • general: General site information.
    • namespaces: Provides a list of all namespaces.
    • namespacealiases: A list of all namespace aliases 1.12+
    • specialpagealiases: A list of all special page aliases 1.13+
    • magicwords: A list of magic words and their aliases 1.14+
    • interwikimap: A list of each interwiki prefix, provided within its own element. 1.11+
    • dbrepllag: If sishowalldb is not set, provides information about the database server with the highest replication lag. If sishowalldb is set, shows replication lag for each database server. 1.11+
    • statistics: Site statistics in Special:Statistics, plus job queue. Note: For historical reasons, the number of files on the wiki is labelled as images not files. This number refers to uploaded files of all types, not just images. 1.11+
    • usergroups: A list of all user groups and their permissions 1.13+
    • libraries: Returns libraries installed on the wiki. 1.25+
    • extensions: A list of extensions installed on the wiki including, as of 1.23, revision (date and hash) and, if possible, licensing information. (See also: phab:T50418) 1.14+
    • fileextensions: A list of file extensions allowed to be uploaded 1.15+
    • rightsinfo: Get information about the license governing the wiki's content 1.15+
    • restrictions: Protection levels 1.23+
    • languages: Get available languages as seen in preferences 1.16+
    • skins: A list of skins installed on the wiki 1.18+
    • extensiontags: Returns a list of parser extension tags. 1.18+
    • functionhooks: A list of function hooks 1.18+
    • showhooks: Returns a list of all subscribed hooks (contents of $wgHooks). 1.18+
    • variables: Returns a list of variable IDs. 1.20+
    • protocols: URL protocol recognised 1.21+
    • defaultoptions: Default preferences 1.23+
  • sifilteriw: Criteria to filter the interwiki map by (ignored if siprop=interwikimap isn't set) 1.11+
    • local: Only list local interwiki prefixes
    • !local: Only list non-local interwiki prefixes
  • sishowalldb: Show information about all DB servers (ignored if siprop=dbrepllag isn't set) 1.11+
  • sinumberingroup: When set to true and siprop includes usergroups the number of users in each usergroup and the groups it can add/remove are included 1.16+
  • siinlanguagecode: Language code for localised language names (best effort) and skin names. 1.19+

Example[edit]

General site info

Specific site info

Copyright site info

List namespaces and aliases

Results[edit]

This section documents only those result sections where there are numerous or non-obvious return values. Results like those found in namespacealiases or libraries, where the meaning of each item can be readily inferred, are not listed here.

Extensions[edit]

  • type: The extension type. The same extension can be registered in more than one type, in which case the results will be repeated for each different type. Default values include specialpage, parserhook, variable, media, antispam, skin, api, and other. Extension-defined types are allowed, though only the coded value is emitted—there is currently no way to retrieve the user-friendly type name (as seen on Special:Version) via the API. 1.14+
  • name: The class name of the extension. 1.14+
  • namemsg: The system message name for the user-friendly name of the extension. 1.24+
  • description: User-friendly description of the extension. 1.14+
  • descriptionmsg: The system message name for the user-friendly description of the extension. This can be emitted in conjunction with the description value. 1.14+
  • descriptionmsgparams: If the descriptionmsg takes parameters, they will be emitted here as an array. 1.16+
  • author: The author or authors as a comma-delimited string. 1.14+
  • url: The URL for the homepage of the extensions. 1.16+
  • version: The version of the extension. This can be taken either from its version or svn-revision entry, with priority given to version in the event of a conflict. 1.14+
  • vcs-system: Which version control system is in use for the extension, if any. This can be either git or svn 1.23+
  • vcs-version: The version number of the extension in the version control system. 1.23+
  • vcs-url: The URL of the repository. 1.23+
  • vcs-date: (Git only) The date of the latest version. 1.23+
  • license-name: The license name under which the extension is published (e.g., GPL-2.0) 1.23+
  • license: The relative path to the license page published on the wiki (equivalent to Special:Version/License/Extension) 1.23+
  • credits: The relative path to the credits page published on the wiki (equivalent to Special:Version/Credits/Extension) 1.23+

General[edit]

The general option can return the following results:

  • articlepath: The relative or absolute path to any article. $1 should be replaced by the article name. See $wgArticlePath. 1.16+
  • base: The absolute path to the main page. 1.8+
  • case: Whether the first letter in a title is case-insensitive ("first-letter") or case-sensitive ("case-sensitive"). See $wgCapitalLinks. 1.8+
  • dbtype: The database type, as found in $wgDBtype. 1.16+
  • dbversion: The database version, as output by the relevant database (see dbtype, above). 1.16+
  • externalimages: If external images are disallowed by default, a list of URL fragments that are exceptions to that policy. See $wgAllowExternalImagesFrom. 1.22+
  • fallback: For wikis using language variants, a list of fallback languages for the UI and messages. 1.19+
  • fallback8bitEncoding: (Note the uppercase E.) The code page to use if a URL is not in UTF-8 format. See Language::fallback8bitencoding. 1.13+
  • favicon: The absolute URL to the site's Favicon. See $wgFavicon. 1.23+
  • generator: API version information as found in $wgVersion. 1.8+
  • git-branch: The current Git branch, if applicable. 1.24+
  • git-hash: The SHA1 hash of the HEAD of the current Git repository, if applicable. 1.20+
  • hhvmversion: If applicable, the HHVM version, as defined by the HHVM_VERSION constant. 1.24+
  • imagelimits: A list of maximum image sizes, as seen in preferences. See $wgImageLimits. 1.23+
  • imagewhitelistenabled: Whether the external image whitelist is enabled. See $wgEnableImageWhitelist. Type: boolean 1.22+
  • invalidusernamechars: Characters to prevent during new account creations. See $wgInvalidUsernameCharacters. 1.26+
  • lang: The language code for the wiki. See $wgLanguageCode. 1.11+
  • langconversion: The boolean opposite of $wgDisableLangConversion. 1.21+
  • legaltitlechars: The Perl-compatible regular expression that defines all legal characters in a wiki title. See $wgLegalTitleChars. 1.25+
  • linkprefix: See linkprefixcharset, below. This version includes additional regular expression fragments before and after the character set, but is otherwise the same. 1.21+ (Deprecated in 1.23)
  • linkprefixcharset: The Perl-compatible regular expression that defines any prefix characters that should be included as part of a wiki link. See Language::linkPrefixCharset(). 1.23+
  • linktrail: The Perl-compatible regular expression that defines any trailing characters that should be included as part of a wiki link. See Language::linkTrail(). 1.21+
  • : The protocol-relative path to the main logo based on $wgLogo. 1.22+
  • mainpage: The title of the main page, as found in MediaWiki:Mainpage. 1.8+
  • maxuploadsize: The maximum upload size on the wiki. See $wgMaxUploadSize. Note: this is always an integer for the primary maximum upload size; retrieving the by-URL size is not currently available. 1.20+
  • misermode: Whether the wiki is running in miser mode. See $wgMiserMode. 1.18+
  • phpsapi: The PHP Server API version, as defined by the PHP_SAPI constant. 1.16+
  • phpversion: The PHP version, as defined by the PHP_VERSION constant. 1.16+
  • readonly: Emitted if the wiki is in read-only mode. 1.13+
  • readonlyreason: The reason the wiki is in read-only mode, if applicable. See $wgReadOnly and $wgReadOnlyFile. 1.16+
  • rev: The revision number of the current Subversion build, if applicable. 1.12+
  • rights: The rights text. See $wgRightsText. 1.9-1.23 (Removed in 1.23)
  • rightscode: This was intended to be the lower-case code associated with the wiki license (e.g., gfdl). In practice, however, Siteinfo was the only place it was ever used. 1.15-1.23 (Removed in 1.23)
  • rtl: This will be emitted if the wiki's language reads right-to-left. 1.13+
  • script: The path of index.php relative to the document root. See $wgScript. 1.16+
  • scriptpath: The base URL path relative to the document root. See $wgScriptPath. 1.16+
  • server: The absolute or protocol-relative base URL for the server. See $wgServer. 1.16+
  • servername: The base URL of the server with no protocol or trailing slash. See $wgServerName. 1.24+
  • sitename: The name of the wiki from $wgSitename. 1.8+
  • thumblimits: A list of allowable thumbnail sizes. See $wgThumbLimits. 1.23+
  • time: The current time on the server, in ISO 8601 format. 1.16+
  • timeoffset: The offset of the wiki's time zone, in minutes, from UTC. See $wgLocalTZoffset. 1.13+
  • timezone: The name of the wiki's time zone. See $wgLocaltimezone. 1.13+
  • titleconversion: The binary opposite of $wgDisableTitleConversion. 1.21+
  • variantarticlepath: Similar to articlepath, but incorporates appropriate language variant into the link as $2, if applicable. In JSON, this value can be emitted as false. See $wgVariantArticlePath. 1.16+
  • variants: All possible language variants for the wiki's parent language (e.g., zh, zh-hans, zh-cn, etc.). 1.20+
  • wikiid: An ASCII string identifying the wiki. See wfWikiID(). 1.16+
  • writeapi: Emitted if the API can be used to perform data-modifying actions like editing or deleting pages. See $wgEnableWriteAPI. 1.13+

Interwikimap[edit]

The attributes provided in each iw element include:

  • prefix: Is the prefix of the interwiki link; this is used the same way as a namespace is used when editing. 1.11+
  • local: Whether the interwiki prefix points to a site belonging to the current wiki farm. The value is read straight out of the iw_local column of the interwiki table. 1.11+
  • trans: Whether transcluding pages from this wiki is allowed. Note that this has no effect unless crosswiki transclusion is enabled on the current wiki. 1.23+
  • language: If the interwiki prefix is a language code defined in Language::fetchLanguageNames() from $wgExtraLanguageNames, this will be the name of that language. 1.13+
  • localinterwiki: Whether the interwiki link points to the current wiki, based on Manual:$wgLocalInterwikis. 1.24+
  • extralanglink: Whether the interwiki prefix is to be considered a language link, despite the prefix not matching a known language code. 1.24+
  • linktext: If the interwiki prefix is an extra language link, this will contain the display text used for the links. 1.24+
  • sitename: If the interwiki prefix is an extra language link, this will contain the friendly site name used in the tooltip text of the links. 1.24+
  • url: The URL of the wiki, with "$1" as a placeholder for an article name. 1.11+
  • protorel: Whether the value of url can be treated as protocol-relative. Note, however, that the URL actually returned will always include the current protocol. 1.24+
  • wikiid: The internal name of the database. Not filled in by default; it may be missing for you. The value is read straight out of the iw_wikiid column of the interwiki table. 1.18+
  • api: The URL of the file api.php on that wiki. Not filled in by default; it may be missing for you. The value is read straight out of the iw_api column of the interwiki table. 1.18+

Namespaces[edit]

Each namespace is given within its own element, which contains several attributes:

  • id: An integer identification number which is unique for each namespace.
  • case: Either "first-letter" or "case-sensitive". If the first letter of the namespace name is capitalized (the default), then the value of this attribute will be "first-letter". Otherwise, the value will be "case-sensitive" in order to indicate that the namespace name in question intentionally does not use a capital first letter. Note: "case-insensitive" is reserved for future use 1.16+
  • name: The displayed name for the namespace. In XML formats, this is the value for the ns element, not a property, and therefore has no name. In JSON, prior to MediaWiki 1.25, the parameter name was *.
  • subpages: This attribute indicates that subpages are allowed within the namespace. Type: boolean 1.13+
  • canonical: Provides the canonical namespace name of the namespace, which may or may not be the same as the actual namespace name. For example, all wikis have a "Project:" namespace, but the actual namespace name is normally changed to the name of the wiki (on Wikipedia for example, the "Project:" namespace is "Wikipedia:"). 1.14+
  • content: This attribute indicates that pages within this namespace should be treated as the main content of the wiki. Pages within namespaces with the content value set are counted for statistical purposes, among other things. Type: boolean 1.16+
  • nonincludable: Whether or not pages in this namespace can be transcluded. Type: boolean 1.20+
  • defaultcontentmodel: The default content model for the namespace 1.21+

Restrictions[edit]

Provides information about the various forms of page protection available.

Rightsinfo[edit]

In the best case this will provide:

  • url: A URL for the license applied to the wiki. If $wgRightsPage is set, this will be the external link to that page; otherwise, $wgRightsUrl is used.
  • text: The text to display for the license link (usually the license name). If $wgRightsText is set, that value will be used; otherwise, the title of $wgRightsPage is used. Prior to version 1.23, the license text (only) was also provided in the general section.

Statistics[edit]

This section provides similar info to Special:Statistics, along with the number of jobs in the job queue, in the following elements:

  • pages: The total number of pages on the wiki, including talk pages, redirects, etc. 1.11+
  • articles: The number of content pages on the wiki. 1.11+
  • views: The total number of page views across the entire wiki. Only emitted if $wgDisableCounters is false. 1.11-1.25 (Removed in 1.25)
  • edits: The number of edits since the wiki began. 1.11+
  • images: The number of files in File space. 1.11+
  • users: The number of registered users. 1.11+
  • activeusers: The number of users who have performed an action in the last $wgActiveUserDays days. 1.14+
  • admins: The number of administrators on the site. 1.11+
  • jobs: The number of jobs remaining in the job queue. This number may be estimated. See Job queue for more information. 1.11+

Other statistics may be included via the APIQuerySiteInfoStatisticsInfo hook.

Usergroups[edit]

This retrieves a list of all groups on the wiki, along with their rights and possibly other statistics.

  • name: The internal name of the group. 1.13+
  • rights: The internal name of the rights for the group. For a description of each right, look at the same group on Special:ListGroupRights. 1.13+
  • number: The number of users in this group. This will not be emitted for the all-users (*) group or autopromoted groups. Requires sinumberingroup parameter to bet set. 1.16+
  • add: Groups that members of this group can add other users to. 1.17+
  • remove: Groups that members of this group can remove other users from. 1.17+
  • add-self: Groups that members of this group can add themselves to. 1.17+
  • remove-self: Groups that members of this group can remove themselves from. 1.17+

Possible errors[edit]

Code Info
includeAllDenied Cannot view all servers info unless $wgShowHostnames is true