A MediaWiki installation is able to supply an enormous wealth of info that can be useful for bot tasks. Apibot is able to fetch this info and supply it to the programs that use it. To decrease the wiki online traffic, the info is cached and reused according to specified settings. All this is done by the
Info object, which is part of the Apibot Mains object.
This class exports over 500 functions that return wiki and user info, as well as some useful conversions and tasks that rely on this info - more than any other part of Apibot. If the bot doesn't know the information returned by the function you called, it will try to auto-fetch and possibly cache it. If the information is still unavailable, the function will typically return
Types of info
Apibot divides the information from the wiki into several types:
- general - common things about the wiki; matches the General subtype of the MediaWiki Meta Siteinfo.
- siteinfo - all other MediaWiki Meta Siteinfo
- userinfo - the MediaWiki Meta Userinfo
- allmessages - the MediaWiki Meta Allmessages
- paraminfo - the MediaWiki Paraminfo
Info class is actually the last descendant in a class hierarchy:
Info_Fetcher- fetches the info; also, exports functions that return the general info
Info_Fetcher; exports functions that return the siteinfo, userinfo, allmessages and paraminfo
Base_Info; exports functions that are convenient shortcuts for some frequently used specific function calls, and functions that provide useful stuff relying on the wiki info
Extended_Info; by default implements no new functions - it is a place for the bot user's custom functions, should s/he implement some. The
Infoobject in the Apibot
Mainsobject is of this class.
All of these classes are implemented in PHP files with matching names, situated in the directory
Creating an object of the class
Info requires three parameters:
$exchanger_api- an API exchanger object
$infostore- an Infostore object
$settings- a Settings object
In addition, it can also take forth paramerer:
$force_load- if true, will automatically fetch all wiki info on the object creation. Default is
false- this allows fetching the info from the wiki only when it is needed.
$autoload- whether to request the info from the wiki automatically on need. Default is
false, info will be requested from wiki only if the wiki info fetching functions are explicitly called.
Due to their numbers, the functions are listed in separate subpages:
- Global info management
- Wiki general info
- Wiki siteinfo
- Wiki paraminfo
- Wiki userinfo
- Wiki allmessages
- Extended wiki info
(The class may also contain other types of info functions, eg. global user info, which are still not official.)