Info object/General

From Apibot
Revision as of 23:53, 22 April 2013 by Grigor Gatchev (talk | contribs) (some info)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The info supplied by the "general" property of the MediaWiki API Meta Siteinfo request contains a set of general data about the wiki. Apibot considers it to be a separate type of info - the "general" type.

In principle, all of this info can be retrieved through the infotype_element ( "info", $element ) function, where $element is the info element key in the general info array. However, retrieving this info through special functions might be more convenient (and might make the PHP code more readable). A list of the implemented general info functions follows.

Common

  • general_info() - returns the entire general info structure
  • general_info_isset() - true if the general info is available, false if it is not
  • general_element ( $key ) - returns the general info element with this key
  • general_element_isset ( $key ) - true if this general info element is present, false if it is not

Specific

  • site_mainpage() - the site main page title
  • site_base() - the site main page URL
  • site_name() - the site name
  • site_generator() - the site software (ie. MediaWiki) and version
  • site_phpversion() - the version of the PHP used by the site
  • site_phpsapi() - the site PHP API
  • site_dbtype() - the site database type
  • site_dbversion() - the database server version
  • site_revision() - the site software revision (not supported by some sites)
  • site_case() - the site title case policy (eg. "first-letter")
  • site_rights() - the site copyright string
  • site_lang() - the site language
  • site_fallback() - the site fallback language
  • site_fallback8bitencoding() - the site fallback 8-bit encoding (typically MW uses UTF-8)
  • site_writeapi() - true if this site allows writing through the API, false if it doesn't. (Even if true, the bot account might need some rights to be able to use it.)
  • site_timezone() - the site timezone
  • site_timeoffset() - the site time offset
  • site_articlepath() - the site URL path to find the wiki articles (eg. Main Page) at
  • site_scriptpath() - the site URL path to find the scripts (eg. index.php or api.php) at
  • site_script() - the site URL path of its index.php script
  • site_variantarticlepath() - an alternative article path, if present
  • site_server() - the site domain name
  • site_wikiid() - the site wiki ID
  • site_time() - the site time at the moment of the information request (might be badly obsolete if the info is cached!)
  • site_misermode() - the site misermode

Additional

These are not supplied by the site, but calculated by Apibot, based on the supplied info:

  • site_timediff() - the difference between the site time and the local time
  • remote_time() - the time at the site, at the current moment (site_timediff()-based)
  • site_generator_version() - only the version part of the site generator string
  • mw_version_number() - the site generator version as 5-digit number (useful for comparing which version is later)