(bug 27610) Add archivename to list=filearchive
authorumherirrender <umherirrender_de.wp@web.de>
Fri, 20 Jul 2012 17:46:08 +0000 (19:46 +0200)
committerCatrope <roan.kattouw@gmail.com>
Tue, 24 Jul 2012 22:38:54 +0000 (15:38 -0700)
Change-Id: I485ff58ad57030cbfb3a0ee7803bf0e25c363d95

RELEASE-NOTES-1.20
includes/api/ApiQueryFilearchive.php

index d09b7de..b859eb1 100644 (file)
@@ -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 ===
 
index eed9d7c..a5486ef 100644 (file)
@@ -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'
+                       ),
                );
        }