A MediaWiki installation can provide 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 Core 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 you call an Info function that returns information unknown to the bot, it will try to auto-fetch and possibly cache it. If the information is still unavailable, the function will return
Types of info
Apibot divides the information from the wiki into several types. Currently are supported the following ones:
- 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
The Core object has a property called
$info, which is an object of the Info class. All its functions can be accessed there. Some other Apibot objects, eg. the Bridge interface, export it not only as a Core property, but also directly as their own property, for backwards compatibility and convenience.
Info is actually a container class that collects the Info objects of the different Apibot backends. It has almost no methods of its own. When called with a method other than
log(), it will check the present backend Info objects for this method, in a specified order (first API, then Web). If the method is found, it will be called and its result will be returned.
As of Apibot 0.40.12, only the API backend is able to obtain wiki info. In future Apibot versions, the Web backend may also gain some functionality, as the Web backend can also supply some of the info needed, and even a few bits of info that are currently not available conveniently through the API backend.
Creating an object of the class
Info requires one parameter:
$core- a Core object. (It carries some objects the Info object needs to fetch, store and/or retrieve its payload.)
The resulting Info object does not self-attach to the Core object it was created with. If the goal of creating it is to replace the current Info object of this Core object (or to supply one during the Core object construction), it must be explicitly assigned:
$info = new Info ( $core ); $core->info = $info;
Due to their big number, 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.)