Info object/Extended

From Apibot
Revision as of 01:44, 10 November 2014 by Grigor Gatchev (talk | contribs) (Mains -> Core)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

In addition to the wiki info direct access, The Apibot Info object (a property of the Core object) provides also convenient shortcuts of some popular types of wiki info. Also, it provides some functions that help parsing wiki info-based (eg. namespaces-based) operations, eg. creating page titles from page names etc.

Elements availability

  • available_xfer_formats() - returns all available API transfer formats. (Currently Apibot supports only the PHP format.)
  • is_available_xfer_format ( $format ) - true if this is an available API transfer format, false if it is not.
  • available_actions() - returns all available API actions.
  • is_available_action ( $action ) - true if this is an available API action, false if it is not.
  • available_properties() - returns all available page properties.
  • is_available_property ( $property ) - true if this is an available page property, false if it is not.
  • available_lists() - returns all available API lists.
  • is_available_list ( $list ) - true if this is an available API list, false if it is not.
  • available_generators() - returns all available API generators.
  • is_available_generator ( $generator ) - true if this is an available API generator, false if it is not.
  • available_meta() - returns all available API meta requests.
  • is_available_meta ( $meta ) - true if this is an available API meta request, false if it is not.

Module limits

  • anymodule_available_limit ( $modulename, $rootmodulename ) - returns the limit for this module, available to the current user.
  • module_available_limit ( $modulename ) - returns the limit for this "proper" module, available to the current user.
  • querymodule_available_limit ( $modulename ) - returns the limit for this querymodule, available to the current user.

Module parameters

  • mainmodule_paramnames() - returns all available parameter names for the mainmodule
  • pagesetmodule_paramnames() - returns all available parameter names for the pagesetmodule
  • module_paramnames ( $module ) - returns all available parameter names for this "proper" module
  • querymodule_paramnames ( $module ) - returns all available parameter names for this query module
  • universal_query_paramnames() - returns the available parameter names that are valid for all API queries, regardless of the module
  • param_is_ok ( $paramname, $modulename, $rootmodulename ) - true if this parameter is available for this API module, false if it is not.
  • module_param_is_ok ( $paramname, $modulename ) - true if this parameter is available for this "proper" module, false if it is not.
  • querymodule_param_is_ok ( $paramname, $modulename ) - true if this parameter is available for this querymodule, false if it is not.

User data

Common

  • am_i_anonymous() - true if the bot is logged in with an existing account, false if it is not.

Groups

  • am_i_member_of_sysops() - true if the bot account is member of the "sysop" group, false if it is not.
  • am_i_member_of_bureaucrats() - true if the bot account is member of the "bureaucrat" group, false if it is not.
  • am_i_member_of_bots() - true if the bot account is member of the "bot" group, false if it is not.

Permissions

  • permission_min_wv ( $permission ) - the minimal MediaWiki version that supports this permission (NULL - the minimal MW version is unknown)
  • permission_max_wv ( $permission ) - the maximal MediaWiki version that supports this permission (NULL - the maximal MW version is unknown)
  • have_i_permission ( $permission ) - true if the bot account has this permission, false if it does not.
  • am_i_bot() - true if the bot account has the permission "bot", false if it does not.
  • am_i_autoconfirmed() - true if the bot account has the permission "autoconfirmed", false if it does not.
  • am_i_emailconfirmed() - true if the bot account has the permission "emailconfirmed", false if it does not.
  • am_i_ipblock_exempt() - true if the bot account has the permission "ipblock-exempt", false if it does not.
  • am_i_proxyunbannable() - true if the bot account has the permission "proxyunbannable", false if it does not.
  • have_i_highlimits() - true if the bot account has the permission "highlimits", false if it does not.
  • have_i_noratelimit() - true if the bot account has the permission "noratelimit", false if it does not.
  • can_i_read() - true if the bot account has the permission "read", false if it does not.
  • can_i_edit() - true if the bot account has the permission "edit", false if it does not.
  • can_i_editprotected() - true if the bot account has the permission "editprotected", false if it does not.
  • can_i_minoredit() - true if the bot account has the permission "minoredit", false if it does not.
  • can_i_skipcaptcha() - true if the bot account has the permission "skipcaptcha", false if it does not.
  • can_i_createpage() - true if the bot account has the permission "createpage", false if it does not.
  • can_i_createtalk() - true if the bot account has the permission "createtalk", false if it does not.
  • can_i_nominornewtalk() - true if the bot account has the permission "nominornewtalk", false if it does not.
  • can_i_writeapi() - true if the bot account has the permission "writeapi", false if it does not. (Unlike api_write_enabled(), this function is user-specific.)
  • can_i_rollback() - true if the bot account has the permission "rollback", false if it does not.
  • can_i_markbotedits() - true if the bot account has the permission "markbotedits", false if it does not.
  • can_i_import() - true if the bot account has the permission "import", false if it does not.
  • can_i_importupload() - true if the bot account has the permission "importupload", false if it does not.
  • can_i_move() - true if the bot account has the permission "move", false if it does not.
  • can_i_movefile() - true if the bot account has the permission "movefile", false if it does not.
  • can_i_move_subpages() - true if the bot account has the permission "move-subpages", false if it does not.
  • can_i_move_rootuserpages() - true if the bot account has the permission "move-rootuserpages", false if it does not.
  • can_i_suppressredirect() - true if the bot account has the permission "suppressredirect", false if it does not.
  • can_i_upload() - true if the bot account has the permission "upload", false if it does not.
  • can_i_reupload() - true if the bot account has the permission "reupload", false if it does not.
  • can_i_reupload_own() - true if the bot account has the permission "reupload-own", false if it does not.
  • can_i_reupload_shared() - true if the bot account has the permission "reupload-shared", false if it does not.
  • can_i_upload_by_url() - true if the bot account has the permission "upload_by_url", false if it does not.
  • can_i_see_deletedhistory() - true if the bot account has the permission "deletedhistory", false if it does not.
  • can_i_delete() - true if the bot account has the permission "delete", false if it does not.
  • can_i_bigdelete() - true if the bot account has the permission "bigdelete", false if it does not.
  • can_i_purge() - true if the bot account has the permission "purge", false if it does not.
  • can_i_undelete() - true if the bot account has the permission "undelete", false if it does not.
  • can_i_browsearchive() - true if the bot account has the permission "browsearchive", false if it does not.
  • can_i_mergehistory() - true if the bot account has the permission "mergehistory", false if it does not.
  • can_i_suppressrevision() - true if the bot account has the permission "suppressrevision", false if it does not.
  • can_i_deleterevision() - true if the bot account has the permission "deleterevision", false if it does not.
  • can_i_protect() - true if the bot account has the permission "protect", false if it does not.
  • can_i_patrol() - true if the bot account has the permission "patrol", false if it does not.
  • can_i_autopatrol() - true if the bot account has the permission "autopatrol", false if it does not.
  • can_i_hideuser() - true if the bot account has the permission "hideuser", false if it does not.
  • can_i_block() - true if the bot account has the permission "block", false if it does not.
  • can_i_blockemail() - true if the bot account has the permission "blockemail", false if it does not.
  • can_i_createaccount() - true if the bot account has the permission "createaccount", false if it does not.
  • can_i_userrights() - true if the bot account has the permission "userrights", false if it does not.
  • can_i_userrights_interwiki() - true if the bot account has the permission "userrights-interwiki", false if it does not.
  • can_i_editinterface() - true if the bot account has the permission "editinterface", false if it does not.
  • can_i_editusercssjs() - true if the bot account has the permission "editusercssjs", false if it does not.
  • can_i_sendemail() - true if the bot account has the permission "sendemail", false if it does not.
  • can_i_remove_trackbacks() - true if the bot account has the permission "trackback", false if it does not.
  • can_i_sendemail() - true if the bot account has the permission "sendemail", false if it does not.

Namespaces support

  • is_main_namespace_type ( $id_or_name ) - true if this namespace is a main (not a talk) one, false if it is not.
  • is_talk_namespace_type ( $id_or_name ) - true if this namespace is a talk one, false if it is not.
  • is_special_namespace_type ( $id_or_name ) - true if this namespace is a special one, false if it is not.
  • namespace_names_and_aliases ( $id_or_name ) - all names and aliases of this namespace
  • given_namespaces_ids ( $ids_or_names ) - the ids of the namespaces passed to the function (as an array)

Page titles support

  • title_parts ( $title, $partname = NULL ) - the title part with this name ("wiki", "namespace", "name"); if $partname is </code>NULL</code> - an array with all title parts
  • parts_title ( $parts ) - the title assembled from these parts
  • title_interwiki ( $title ) - the title interwiki
  • title_namespace ( $title ) - the title namespace
  • title_name ( $title ) - the title name
  • title_namespace_id ( $title ) - the ID of the title namespace
  • is_main_page ( $title ) - true if this title is in a main (non-talk) namespace, false if it is not.
  • is_talk_page ( $title ) - true if this title is in a talk namespace, false if it is not.
  • is_special_page ( $title ) - true if this title is in a special namespace, false if it is not.
  • talk_page_title ( $title ) - the title of the talk page belonging to this main (non-talk) page
  • main_page_title ( $title ) - the title of the main page belonging to this talk page
  • maintalk_pages_titles ( $title ) - an array with the main and the talk pages titles, related to this page (it and its talk page if it is main, it and its main page if it is talk, and it only if it is special page)
  • wikititle_to_url ( $title ) - the URL of the page with this title
  • url_to_wikititle ( $url ) - the title of the page with this URL

Regexes support

  • regex_wikicase ( $string ) - a regex that will match this string according to the wiki case policy (eg. first-letter)
  • namespace_barsepnames ( $id_or_name, $preg_quote = false, $regex_wikicase = false ) - a bar-separated string with all names of this namespace, possibly regex-escaped and / or in regex wikicase (see the previous function)
  • namespaces_barsepnames ( $preg_quote = false, $regex_wikicase = false ) - a bar-separated string with all names of all wiki namespaces, possibly regex-escaped and / or in regex wikicase
  • namespace_namesregex ( $id_or_name ) - a regex part that will match all names of this namespace
  • namespaces_namesregex() - a regex part that will match all names of all wiki namespaces
  • interwikis_barsepprefixes() - a bar-separated string with the prefixes of all interwikis, possibly regex-escaped and / or in regex wikicase
  • interwikis_prefixesregex() - a regex part that will match all prefixes of all interwikis
  • magicword_barsepnames ( $name_or_alias ) - a bar-separated string with all names of this magicword, possibly regex-escaped and / or in regex wikicase
  • magicword_namesregex ( $name_or_alias ) - a regex part that will match all names of this magicword

Misc

  • is_interwikis_import_ok() - true if it is OK to import interwikis, false if it is not.
  • is_interwiki_import_ok ( $wiki = NULL ) - true if it is OK to import this interwiki (or any interwiki, if NULL is passed), false if it is not.

See also