MediaWiki  REL1_22
ApiQueryImageInfo Class Reference

A query action to get image information and upload history. More...

Inheritance diagram for ApiQueryImageInfo:
Collaboration diagram for ApiQueryImageInfo:

List of all members.

Public Member Functions

 __construct ($query, $moduleName, $prefix= 'ii')
 Constructor.
 execute ()
 Evaluates the parameters, performs the requested query, and sets up the result.
 getAllowedParams ()
 Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (array with PARAM_* constants as keys) Don't call this function directly: use getFinalParams() to allow hooks to modify parameters as needed.
 getCacheMode ($params)
 Get the cache mode for the data generated by this module.
 getDescription ()
 Returns the description string for this module.
 getExamples ()
 Returns usage examples for this module.
 getHelpUrls ()
 getParamDescription ()
 Return the API documentation for the parameters.
 getPossibleErrors ()
 getResultProperties ()
 Returns possible properties in the result, grouped by the value of the prop parameter that shows them.
 getScale ($params)
 From parameters, construct a 'scale' array.

Static Public Member Functions

static getInfo ($file, $prop, $result, $thumbParams=null, $version= 'latest')
 Get result information for an image revision.
static getPropertyDescriptions ($filter=array(), $modulePrefix= '')
 Returns the descriptions for the properties provided by getPropertyNames()
static getPropertyNames ($filter=array())
 Returns all possible parameters to iiprop.
static getResultPropertiesFiltered ($filter=array())
static getTransformCount ()
 Get the count of image transformations performed.
static processMetaData ($metadata, $result)

Public Attributes

const TRANSFORM_LIMIT = 50

Protected Member Functions

 getContinueStr ($img, $start=null)
 mergeThumbParams ($image, $thumbParams, $otherParams)
 Validate and merge scale parameters with handler thumb parameters, give error if invalid.

Static Private Member Functions

static getProperties ($modulePrefix= '')
 Returns array key value pairs of properties and their descriptions.

Static Private Attributes

static $transformCount = 0

Detailed Description

A query action to get image information and upload history.

Definition at line 32 of file ApiQueryImageInfo.php.


Constructor & Destructor Documentation

ApiQueryImageInfo::__construct ( mainModule,
moduleName,
modulePrefix = 'ii' 
)

Constructor.

Parameters:
$mainModuleApiMain object
string$moduleNameName of this module
string$modulePrefixPrefix to use for parameter names

Reimplemented from ApiBase.

Definition at line 36 of file ApiQueryImageInfo.php.

References $query.


Member Function Documentation

Evaluates the parameters, performs the requested query, and sets up the result.

Concrete implementations of ApiBase must override this method to provide whatever functionality their module offers. Implementations must not produce any output on their own and are not expected to handle any errors.

The execute() method will be invoked directly by ApiMain immediately before the result of the module is output. Aside from the constructor, implementations should assume that no other methods will be called externally on the module before the result is processed.

The result data should be stored in the ApiResult object available through getResult().

Reimplemented from ApiBase.

Reimplemented in ApiQueryStashImageInfo.

Definition at line 45 of file ApiQueryImageInfo.php.

References $count, $key, $params, $result, $title, $titles, ApiQueryBase\addPageSubItem(), array(), as, ApiBase\dieContinueUsageIf(), empty, ApiBase\extractRequestParams(), getContinueStr(), ApiQueryBase\getPageSet(), ApiBase\getResult(), getScale(), getTransformCount(), mergeThumbParams(), ApiQueryBase\setContinueEnumParameter(), RepoGroup\singleton(), wfLocalFile(), and wfTimestamp().

Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (array with PARAM_* constants as keys) Don't call this function directly: use getFinalParams() to allow hooks to modify parameters as needed.

Some derived classes may choose to handle an integer $flags parameter in the overriding methods. Callers of this method can pass zero or more OR-ed flags like GET_VALUES_FOR_HELP.

Returns:
array|bool

Reimplemented from ApiBase.

Reimplemented in ApiQueryStashImageInfo.

Definition at line 493 of file ApiQueryImageInfo.php.

References array(), ApiBase\LIMIT_BIG1, ApiBase\LIMIT_BIG2, ApiBase\PARAM_DFLT, ApiBase\PARAM_ISMULTI, ApiBase\PARAM_MAX, ApiBase\PARAM_MAX2, ApiBase\PARAM_MIN, and ApiBase\PARAM_TYPE.

Get the cache mode for the data generated by this module.

Override this in the module subclass. For possible return values and other details about cache modes, see ApiMain::setCacheMode()

Public caching will only be allowed if *all* the modules that supply data for a given request return a cache mode of public.

Parameters:
$params
Returns:
string

Reimplemented from ApiQueryBase.

Definition at line 477 of file ApiQueryImageInfo.php.

ApiQueryImageInfo::getContinueStr ( img,
start = null 
) [protected]
Parameters:
$imgFile
null | string$start
Returns:
string

Definition at line 486 of file ApiQueryImageInfo.php.

Referenced by execute().

Returns the description string for this module.

Returns:
mixed string or array of strings

Reimplemented from ApiBase.

Reimplemented in ApiQueryStashImageInfo.

Definition at line 735 of file ApiQueryImageInfo.php.

Returns usage examples for this module.

Return false if no examples are available.

Returns:
bool|string|array

Reimplemented from ApiBase.

Reimplemented in ApiQueryStashImageInfo.

Definition at line 748 of file ApiQueryImageInfo.php.

References array().

Returns:
bool|string|array Returns a false if the module has no help url, else returns a (array of) string

Reimplemented from ApiBase.

Definition at line 755 of file ApiQueryImageInfo.php.

static ApiQueryImageInfo::getInfo ( file,
prop,
result,
thumbParams = null,
version = 'latest' 
) [static]

Get result information for an image revision.

Parameters:
$fileFile object
array$propof properties to get (in the keys)
$resultApiResult object
array$thumbParamscontaining 'width' and 'height' items, or null
string$versionVersion of image metadata (for things like jpeg which have different versions).
Returns:
Array: result array

Definition at line 302 of file ApiQueryImageInfo.php.

References $comment, $file, $mime, $result, $user, array(), File\DELETED_COMMENT, File\DELETED_FILE, File\DELETED_USER, Linker\formatComment(), SpecialUpload\getExistsWarning(), UploadBase\getExistsWarning(), list, processMetaData(), wfBaseConvert(), wfExpandUrl(), wfRestoreWarnings(), wfSuppressWarnings(), and wfTimestamp().

Referenced by ApiQueryStashImageInfo\execute(), UploadBase\getImageInfo(), and ApiQueryAllImages\run().

Return the API documentation for the parameters.

Returns:
Array parameter documentation.

Reimplemented from ApiBase.

Reimplemented in ApiQueryStashImageInfo.

Definition at line 591 of file ApiQueryImageInfo.php.

References array(), and ApiBase\getModulePrefix().

Returns:
array

Reimplemented from ApiQueryBase.

Definition at line 739 of file ApiQueryImageInfo.php.

References array(), and ApiBase\getModulePrefix().

static ApiQueryImageInfo::getProperties ( modulePrefix = '') [static, private]

Returns array key value pairs of properties and their descriptions.

Parameters:
string$modulePrefix
Returns:
array

Definition at line 551 of file ApiQueryImageInfo.php.

References array().

static ApiQueryImageInfo::getPropertyDescriptions ( filter = array(),
modulePrefix = '' 
) [static]

Returns the descriptions for the properties provided by getPropertyNames()

Parameters:
array$filterList of properties to filter out
string$modulePrefix
Returns:
array

Definition at line 580 of file ApiQueryImageInfo.php.

References array().

Referenced by ApiQueryAllImages\getParamDescription().

static ApiQueryImageInfo::getPropertyNames ( filter = array()) [static]

Returns all possible parameters to iiprop.

Parameters:
array$filterList of properties to filter out
Returns:
Array

Definition at line 541 of file ApiQueryImageInfo.php.

Referenced by ApiQueryAllImages\getAllowedParams(), and UploadBase\getImageInfo().

Returns possible properties in the result, grouped by the value of the prop parameter that shows them.

Properties that are shown always are in a group with empty string as a key. Properties that can be shown by several values of prop are included multiple times. If some properties are part of a list and some are on the root object (see ApiQueryQueryPage), those on the root object are under the key PROP_ROOT. The array can also contain a boolean under the key PROP_LIST, indicating whether the result is a list.

Don't call this function directly: use getFinalResultProperties() to allow hooks to modify descriptions as needed.

Returns:
array|bool False on no properties

Reimplemented from ApiBase.

Reimplemented in ApiQueryStashImageInfo.

Definition at line 731 of file ApiQueryImageInfo.php.

References getResultPropertiesFiltered().

From parameters, construct a 'scale' array.

Parameters:
array$paramsParameters passed to api.
Returns:
Array or Null: key-val array of 'width' and 'height', or null

Definition at line 207 of file ApiQueryImageInfo.php.

References $params, array(), ApiBase\dieUsage(), and ApiBase\getModulePrefix().

Referenced by ApiQueryStashImageInfo\execute(), and execute().

Get the count of image transformations performed.

If this is >= TRANSFORM_LIMIT, you should probably stop processing images.

Returns:
integer count

Definition at line 450 of file ApiQueryImageInfo.php.

References $transformCount.

Referenced by execute().

ApiQueryImageInfo::mergeThumbParams ( image,
thumbParams,
otherParams 
) [protected]

Validate and merge scale parameters with handler thumb parameters, give error if invalid.

We do this later than getScale, since we need the image to know which handler, since handlers can make their own parameters.

Parameters:
File$imageImage that params are for.
array$thumbParamsthumbnail parameters from getScale
string$otherParamsof otherParams (iiurlparam).
Returns:
Array of parameters for transform.

Definition at line 238 of file ApiQueryImageInfo.php.

References $name, $value, as, ApiBase\dieUsage(), ApiBase\getModulePrefix(), global, and ApiBase\setWarning().

Referenced by ApiQueryStashImageInfo\execute(), and execute().

static ApiQueryImageInfo::processMetaData ( metadata,
result 
) [static]
Parameters:
$metadataArray
$resultApiResult
Returns:
Array

Definition at line 460 of file ApiQueryImageInfo.php.

References $key, $result, $retval, $value, array(), and as.

Referenced by ApiQueryFilearchive\execute(), and getInfo().


Member Data Documentation

ApiQueryImageInfo::$transformCount = 0 [static, private]

Definition at line 34 of file ApiQueryImageInfo.php.

Referenced by getTransformCount().

Definition at line 33 of file ApiQueryImageInfo.php.


The documentation for this class was generated from the following file: