MediaWiki
REL1_24
|
A query action to get image information and upload history. More...
Public Member Functions | |
__construct (ApiQuery $query, $moduleName, $prefix= 'ii') | |
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. | |
getScale ($params) | |
From parameters, construct a 'scale' array. | |
Static Public Member Functions | |
static | getInfo ($file, $prop, $result, $thumbParams=null, $opts=false) |
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 | getTransformCount () |
Get the count of image transformations performed. | |
static | processMetaData ($metadata, $result) |
Public Attributes | |
const | TRANSFORM_LIMIT = 50 |
Protected Member Functions | |
checkParameterNormalise ($image, $finalParams) | |
Verify that the final image parameters can be normalised. | |
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 |
A query action to get image information and upload history.
Definition at line 32 of file ApiQueryImageInfo.php.
ApiQueryImageInfo::__construct | ( | ApiQuery $ | queryModule, |
$ | moduleName, | ||
$ | paramPrefix = 'ii' |
||
) |
ApiQuery | $queryModule | |
string | $moduleName | |
string | $paramPrefix |
Reimplemented from ApiQueryBase.
Definition at line 36 of file ApiQueryImageInfo.php.
ApiQueryImageInfo::checkParameterNormalise | ( | $ | image, |
$ | finalParams | ||
) | [protected] |
Verify that the final image parameters can be normalised.
This doesn't use the normalised parameters, since $file->transform expects the pre-normalised parameters, but doing the normalisation allows us to catch certain error conditions early (such as missing required parameter).
$image | File |
$finalParams | array List of parameters to transform image with |
Definition at line 333 of file ApiQueryImageInfo.php.
References ApiBase\dieUsage().
Referenced by mergeThumbParams().
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 46 of file ApiQueryImageInfo.php.
References $count, $key, $params, $result, $title, $titles, $user, ApiQueryBase\addPageSubItem(), array(), as, ApiBase\dieContinueUsageIf(), empty, ApiBase\extractRequestParams(), getContinueStr(), ApiQueryBase\getPageSet(), ApiBase\getResult(), getScale(), getTransformCount(), ContextSource\getUser(), 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.
Reimplemented from ApiBase.
Reimplemented in ApiQueryStashImageInfo.
Definition at line 628 of file ApiQueryImageInfo.php.
References $wgContLang, array(), global, 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.
ApiQueryImageInfo::getCacheMode | ( | $ | params | ) |
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.
array | $params |
Reimplemented from ApiQueryBase.
Definition at line 607 of file ApiQueryImageInfo.php.
References ApiQueryBase\userCanSeeRevDel().
ApiQueryImageInfo::getContinueStr | ( | $ | img, |
$ | start = null |
||
) | [protected] |
File | $img | |
null | string | $start |
Definition at line 620 of file ApiQueryImageInfo.php.
Referenced by execute().
Returns the description string for this module.
Reimplemented from ApiBase.
Reimplemented in ApiQueryStashImageInfo.
Definition at line 784 of file ApiQueryImageInfo.php.
Returns usage examples for this module.
Return false if no examples are available.
Reimplemented from ApiBase.
Reimplemented in ApiQueryStashImageInfo.
Definition at line 788 of file ApiQueryImageInfo.php.
References array().
Reimplemented from ApiBase.
Definition at line 796 of file ApiQueryImageInfo.php.
static ApiQueryImageInfo::getInfo | ( | $ | file, |
$ | prop, | ||
$ | result, | ||
$ | thumbParams = null , |
||
$ | opts = false |
||
) | [static] |
Get result information for an image revision.
File | $file | |
array | $prop | Array of properties to get (in the keys) |
ApiResult | $result | |
array | $thumbParams | Containing 'width' and 'height' items, or null |
array | bool | string | $opts | Options for data fetching. This is an array consisting of the keys: 'version': The metadata version for the metadata option 'language': The language for extmetadata property 'multilang': Return all translations in extmetadata property 'revdelUser': User to use when checking whether to show revision-deleted fields. |
Definition at line 361 of file ApiQueryImageInfo.php.
References $comment, $file, $mime, $result, $user, $wgContLang, array(), File\DELETED_COMMENT, File\DELETED_FILE, File\DELETED_RESTRICTED, File\DELETED_USER, Linker\formatComment(), SpecialUpload\getExistsWarning(), UploadBase\getExistsWarning(), global, list, processMetaData(), File\RAW, FormatMetadata\setSingleLanguage(), wfBaseConvert(), wfExpandUrl(), wfRestoreWarnings(), wfSuppressWarnings(), and wfTimestamp().
Referenced by ApiQueryStashImageInfo\execute(), UploadBase\getImageInfo(), and ApiQueryAllImages\run().
Return the API documentation for the parameters.
Reimplemented from ApiBase.
Reimplemented in ApiQueryStashImageInfo.
Definition at line 748 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.
string | $modulePrefix |
Definition at line 700 of file ApiQueryImageInfo.php.
References array().
static ApiQueryImageInfo::getPropertyDescriptions | ( | $ | filter = array() , |
$ | modulePrefix = '' |
||
) | [static] |
Returns the descriptions for the properties provided by getPropertyNames()
array | $filter | List of properties to filter out |
string | $modulePrefix |
Definition at line 737 of file ApiQueryImageInfo.php.
References array().
Referenced by ApiQueryAllImages\getParamDescription().
static ApiQueryImageInfo::getPropertyNames | ( | $ | filter = array() | ) | [static] |
Returns all possible parameters to iiprop.
array | $filter | List of properties to filter out |
Definition at line 690 of file ApiQueryImageInfo.php.
Referenced by ApiQueryAllImages\getAllowedParams(), and UploadBase\getImageInfo().
ApiQueryImageInfo::getScale | ( | $ | params | ) |
From parameters, construct a 'scale' array.
array | $params | Parameters passed to api. |
Definition at line 227 of file ApiQueryImageInfo.php.
References $params, array(), and ApiBase\getModulePrefix().
Referenced by ApiQueryStashImageInfo\execute(), and execute().
static ApiQueryImageInfo::getTransformCount | ( | ) | [static] |
Get the count of image transformations performed.
If this is >= TRANSFORM_LIMIT, you should probably stop processing images.
Definition at line 579 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.
File | $image | Image that params are for. |
array | $thumbParams | Thumbnail parameters from getScale |
string | $otherParams | String of otherParams (iiurlparam). |
Definition at line 260 of file ApiQueryImageInfo.php.
References $name, $value, as, checkParameterNormalise(), ApiBase\dieUsage(), ContextSource\getConfig(), ApiBase\getModulePrefix(), and ApiBase\setWarning().
Referenced by ApiQueryStashImageInfo\execute(), and execute().
static ApiQueryImageInfo::processMetaData | ( | $ | metadata, |
$ | result | ||
) | [static] |
ApiQueryImageInfo::$transformCount = 0 [static, private] |
Definition at line 34 of file ApiQueryImageInfo.php.
Referenced by getTransformCount().
const ApiQueryImageInfo::TRANSFORM_LIMIT = 50 |
Definition at line 33 of file ApiQueryImageInfo.php.