Info object/Global

From Apibot
Jump to: navigation, search

Part of the handling of the wiki and user information by the Info object is fetching, loading and storing it. There are also some functions that return info by structure rather than by sense and logic. Finally, there might be some "other" functions.

Loading and clearing

These functions will try to read the requested info from the cache. If the info is not cached, or is obsolete according to the info settings, it will be (re-)fetched, if allowed by the $autoload property and returned by the wiki.

  • load_info ( $type ) - will try to load this type of info ("general", "param", "site", "user", "allmessages"). Returns true on success, false on failure.
  • load_all_info() - will try to load all known types of info
  • clear_loaded_info ( $type ) - will clear from the object memory this type of info
  • clear_all_loaded_info() - will clear from the object memory all loaded info

Info structures

Through these functions you can access all elements of the info structures present. This may include some elements for which there are no specific retrieval functions (for example, info structures elements that are introduced after releasing the version of Apibot you use).

  • infotype ( $type ) - returns the specified infotype, as a complex array structure
  • infotype_isset ( $type ) - whether this info type is available (also attempts to load it)
  • infotype_element ( $type, $key ) - returns the specified element of this infotype
  • infotype_element_isset ( $type, $key ) - whether the specified element of this info type is available (also attempts to load it)
  • infotype_element_arraykeys ( $type, $key ) - returns all keys in this infotype element array
  • infotype_element_subs_count ( $type, $key ) - returns the number of the elements in this infotype element array
  • infotype_sub ( $type, $key, $subkey ) - returns the specified sub-element of this infotype and element

Indexed info structures

Some types of info are specially indexed in a way, different from their order in the standard info arrays. These functions retrieve them according to their indexed structures.

  • indextype ( $type ) - returns the specified indexed info type, as an array structure
  • indextype_element ( $type, $key ) - returns the specified element of this indexed info type
  • indextype_element_isset ( $type, $key ) - true the specified element of this indexed info type is available (also attempts to load it), false if it is not

See also