Settings class

From Apibot
Revision as of 03:21, 14 April 2014 by Grigor Gatchev (talk | contribs) (1 replacements)
Jump to: navigation, search

Apibot can be configured extensively - so much that its settings deserve the support of a special module, the Settings module. It is situated in the Mains module.

Like some other Mains objects, this one is identity-specific. Login into another wiki or user will demand creating it anew and replacing with it the old one in the Mains object.

Creating

Creating an object of the Settings class requires two parameters:

  • $settings - an array with the general bot settings
  • $account - the bot account settings structure

Public methods

  • get ( $key1, $key2 = NULL, $key3 = NULL, $key4 = NULL, $key5 = NULL ) - acquire the settings value (or array) for $key1 (and the consequent sub-keys, if not NULL)
  • get_withbackend ( $backend, $key1, $key2 = NULL, $key3 = NULL, $key4 = NULL, $key5 = NULL ) - like get(), but also checks in the result for a subkey named after this backend. If yes, removes it and merges its contents with the result. (Thus, you can have different overriding subarrays of settings for the different task backends.)