Query functions

From Apibot
Jump to: navigation, search

This is a list of all functions exported by an backend-independent Query object.

(This is the type of object returned by the Bridge class Query functions.)

Constructing the object

The class constructor parameters profile is:

__construct ( $core, $default_params = array(), $settings = array() );

where $core is an object of the Core type, $default_params is an array with the default call parameters and $settings is an array with the default settings.

Generic Query module functions

log()

Syntax
log ( $message, $loglevel = LL_INFO, $logpreface = NULL )
Function
Writes a message in the bot logfile.

xfer()

Syntax
xfer()
Function
Makes a starting request for information to the wiki.

next()

Syntax
next()
Function
Continuing a started request for information to the wiki.

element()

Syntax
element ( $with_key = false )
Function
Returns the next element from the query (internally using xfer() and next() to obtain the data). If $with_key is true, returns an array with two elements: array ( 'value' => element, 'key' => query element key ).
If there are no more elements to be returned, returns false.

get_params()

Syntax
get_params()
Function
Obtains an array with the currently set query parameters (their names as the array keys and their values as the corresponding array values).

set_params()

Syntax
set_params ( $params )
Function
Sets the query parameters from the array $params (the array keys are used as parameter names and the corresponding values are used as parameter values).

queryname()

Syntax
queryname()
Function
Returns the name of the query (typically, the name of the MW API querymodule).

is_paramname_ok()

Syntax
is_paramname_ok ( $name )
Returns
true if the parameter with this name is supported, false otherwise.

is_paramvalue_ok()

Syntax
is_paramvalue_ok ( $name, $value, $setmode = NULL )
Returns
true if this value is OK for this parameter or $setmode is true, false if it is not acceptable, or the parameter is not supported.