From eb851db5d39d24cab1eab08e909050ac30c13d0d Mon Sep 17 00:00:00 2001 From: umherirrender Date: Fri, 20 Jul 2012 19:46:08 +0200 Subject: [PATCH] (bug 27610) Add archivename to list=filearchive Change-Id: I485ff58ad57030cbfb3a0ee7803bf0e25c363d95 --- RELEASE-NOTES-1.20 | 1 + includes/api/ApiQueryFilearchive.php | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES-1.20 b/RELEASE-NOTES-1.20 index d09b7ded6b..b859eb1959 100644 --- a/RELEASE-NOTES-1.20 +++ b/RELEASE-NOTES-1.20 @@ -200,6 +200,7 @@ upgrade PHP if you have not done so prior to upgrading MediaWiki. * (bug 30836) siteinfo prop=specialpagealiases will no longer return nonexistent special pages * (bug 38190) Add "required" flag to some token params for hint in api docs. * (bug 27567) Add file repo support to prop=duplicatefiles. +* (bug 27610) Add archivename for non-latest image version to list=filearchive === Languages updated in 1.20 === diff --git a/includes/api/ApiQueryFilearchive.php b/includes/api/ApiQueryFilearchive.php index eed9d7c8ed..a5486ef4a0 100644 --- a/includes/api/ApiQueryFilearchive.php +++ b/includes/api/ApiQueryFilearchive.php @@ -59,6 +59,7 @@ class ApiQueryFilearchive extends ApiQueryBase { $fld_mediatype = isset( $prop['mediatype'] ); $fld_metadata = isset( $prop['metadata'] ); $fld_bitdepth = isset( $prop['bitdepth'] ); + $fld_archivename = isset( $prop['archivename'] ); $this->addTables( 'filearchive' ); @@ -72,6 +73,7 @@ class ApiQueryFilearchive extends ApiQueryBase { $this->addFieldsIf( 'fa_media_type', $fld_mediatype ); $this->addFieldsIf( 'fa_metadata', $fld_metadata ); $this->addFieldsIf( 'fa_bits', $fld_bitdepth ); + $this->addFieldsIf( 'fa_archive_name', $fld_archivename ); if ( !is_null( $params['continue'] ) ) { $cont = explode( '|', $params['continue'] ); @@ -194,6 +196,9 @@ class ApiQueryFilearchive extends ApiQueryBase { if ( $fld_mime ) { $file['mime'] = "$row->fa_major_mime/$row->fa_minor_mime"; } + if ( $fld_archivename && !is_null( $row->fa_archive_name ) ) { + $file['archivename'] = $row->fa_archive_name; + } if ( $row->fa_deleted & File::DELETED_FILE ) { $file['filehidden'] = ''; @@ -256,7 +261,8 @@ class ApiQueryFilearchive extends ApiQueryBase { 'mime', 'mediatype', 'metadata', - 'bitdepth' + 'bitdepth', + 'archivename', ), ), ); @@ -285,6 +291,7 @@ class ApiQueryFilearchive extends ApiQueryBase { ' mediatype - Adds the media type of the image', ' metadata - Lists EXIF metadata for the version of the image', ' bitdepth - Adds the bit depth of the version', + ' archivename - Adds the file name of the archive version for non-latest versions' ), ); } @@ -346,7 +353,10 @@ class ApiQueryFilearchive extends ApiQueryBase { ), 'mediatype' => array( 'mediatype' => 'string' - ) + ), + 'archivename' => array( + 'archivename' => 'string' + ), ); } -- 2.20.1