Core object

From Apibot
Revision as of 01:38, 10 November 2014 by Grigor Gatchev (talk | contribs) (Undo revision 779 by Grigor Gatchev (talk))
Jump to: navigation, search

This object is the Apibot core. It provides all the functionality the bot interfaces and their objects give access to. It is required for creating nearly every Apibot interfaces or data object.

Nearly every script that uses Apibot will probably start with creating this object.

Before version 0.40.19 it was known as the Mains object.


Requires two parameters:

Public properties

Except for the $info property, best do not access the others - unless you know really well what you are doing.

  • $info - the object that exports methods providing info about the wiki, bot account etc. A very useful one.
  • $browser - the object that provides the HTTP(S) level exchange
  • $infostore - the object that stores in files and retrieves different info (wiki etc)
  • $settings - the object that keeps and manages the bot global settings
  • $hooks - the object that keeps and manages the Apibot internal calls hooks
  • $log - the object that provides the bot logging facilities
  • $backends - an array with objects that implement the Apibot backends
  • $account -

Public methods

  • log ( $message, $loglevel = LL_INFO, $logpreface = "" ) - writes a message to the bot log
  • version() - returns the Apibot version (eg. 0.40.20)
  • backend ( $name ) - returns the Backend object with this name, or NULL if no such object exists
  • available_backends_names() - returns an array with the names of the available backends (both operable and non-operable)
  • active_backends_names() - returns an array with the names of the active (can be used on this type of wiki, but might be non-operable for some reason on this specific wiki) backends
  • operable_backends_names() - returns an array with the names of the operable (able to work on this wiki, maybe not for all possible tasks) backends

See also