API: Add iiprop=canonicaltitle
With recent changes to the filerepo backends, prop=imageinfo will now return information for the target file when file redirects are queried. To make this more transparent to clients, add an iiprop to return the canonical title for the imageinfo data. Change-Id: I62e368ffe09512f1af6677994f1ccca776b97651
This commit is contained in:
parent
0886ddb2e9
commit
7b9b91ead5
1 changed files with 13 additions and 1 deletions
|
|
@ -385,6 +385,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
|
|||
}
|
||||
}
|
||||
|
||||
$canonicaltitle = isset( $prop['canonicaltitle'] );
|
||||
$url = isset( $prop['url'] );
|
||||
$sha1 = isset( $prop['sha1'] );
|
||||
$meta = isset( $prop['metadata'] );
|
||||
|
|
@ -395,7 +396,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
|
|||
$bitdepth = isset( $prop['bitdepth'] );
|
||||
$uploadwarning = isset( $prop['uploadwarning'] );
|
||||
|
||||
if ( ( $url || $sha1 || $meta || $mime || $mediatype || $archive || $bitdepth )
|
||||
if ( ( $canonicaltitle || $url || $sha1 || $meta || $mime || $mediatype || $archive || $bitdepth )
|
||||
&& $file->isDeleted( File::DELETED_FILE )
|
||||
) {
|
||||
$vals['filehidden'] = '';
|
||||
|
|
@ -404,6 +405,10 @@ class ApiQueryImageInfo extends ApiQueryBase {
|
|||
return $vals;
|
||||
}
|
||||
|
||||
if ( $canonicaltitle ) {
|
||||
$vals['canonicaltitle'] = $file->getTitle()->getPrefixedText();
|
||||
}
|
||||
|
||||
if ( $url ) {
|
||||
if ( !is_null( $thumbParams ) ) {
|
||||
$mto = $file->transform( $thumbParams );
|
||||
|
|
@ -618,6 +623,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
|
|||
'userid' => ' userid - Add the user ID that uploaded the image version',
|
||||
'comment' => ' comment - Comment on the version',
|
||||
'parsedcomment' => ' parsedcomment - Parse the comment on the version',
|
||||
'canonicaltitle' => ' canonicaltitle - Adds the canonical title of the image file',
|
||||
'url' => ' url - Gives URL to the image and the description page',
|
||||
'size' => ' size - Adds the size of the image in bytes ' .
|
||||
'and the height, width and page count (if applicable)',
|
||||
|
|
@ -737,6 +743,12 @@ class ApiQueryImageInfo extends ApiQueryBase {
|
|||
ApiBase::PROP_NULLABLE => true
|
||||
)
|
||||
),
|
||||
'canonicaltitle' => array(
|
||||
'canonicaltitle' => array(
|
||||
ApiBase::PROP_TYPE => 'string',
|
||||
ApiBase::PROP_NULLABLE => true
|
||||
)
|
||||
),
|
||||
'url' => array(
|
||||
'filehidden' => 'boolean',
|
||||
'thumburl' => array(
|
||||
|
|
|
|||
Loading…
Reference in a new issue