Difference between revisions of "Settings class"

From Apibot
Jump to: navigation, search
(some info)
 
m (moved Apibot 0.40 Settings class to Settings class: 0.40 is the stable version now - why numbering it?)
(No difference)

Revision as of 15:39, 13 April 2014

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.)