X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fapi%2FApiQueryFilearchive.php;h=ebffb151c89ac6f1b8bdbe76db40354a7feca3e7;hp=7383cba6cb19b5d611448c28b9b40cf1fb4b0478;hb=faf7cc4a09848c538320bd2b9067b1a77c0a0183;hpb=d5a7166771613dfe4ed9fb75fa5efeced6134bd1 diff --git a/includes/api/ApiQueryFilearchive.php b/includes/api/ApiQueryFilearchive.php index 7383cba6cb..ebffb151c8 100644 --- a/includes/api/ApiQueryFilearchive.php +++ b/includes/api/ApiQueryFilearchive.php @@ -2,8 +2,6 @@ /** * API for MediaWiki 1.12+ * - * Created on May 10, 2010 - * * Copyright © 2010 Sam Reed * Copyright © 2008 Vasiliev Victor vasilvv@gmail.com, * based on ApiQueryAllPages.php @@ -43,6 +41,7 @@ class ApiQueryFilearchive extends ApiQueryBase { $user = $this->getUser(); $db = $this->getDB(); + $commentStore = CommentStore::getStore(); $params = $this->extractRequestParams(); @@ -59,19 +58,10 @@ class ApiQueryFilearchive extends ApiQueryBase { $fld_bitdepth = isset( $prop['bitdepth'] ); $fld_archivename = isset( $prop['archivename'] ); - $this->addTables( 'filearchive' ); - - $this->addFields( ArchivedFile::selectFields() ); - $this->addFields( [ 'fa_id', 'fa_name', 'fa_timestamp', 'fa_deleted' ] ); - $this->addFieldsIf( 'fa_sha1', $fld_sha1 ); - $this->addFieldsIf( [ 'fa_user', 'fa_user_text' ], $fld_user ); - $this->addFieldsIf( [ 'fa_height', 'fa_width', 'fa_size' ], $fld_dimensions || $fld_size ); - $this->addFieldsIf( 'fa_description', $fld_description ); - $this->addFieldsIf( [ 'fa_major_mime', 'fa_minor_mime' ], $fld_mime ); - $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 ); + $fileQuery = ArchivedFile::getQueryInfo(); + $this->addTables( $fileQuery['tables'] ); + $this->addFields( $fileQuery['fields'] ); + $this->addJoinConds( $fileQuery['joins'] ); if ( !is_null( $params['continue'] ) ) { $cont = explode( '|', $params['continue'] ); @@ -165,10 +155,10 @@ class ApiQueryFilearchive extends ApiQueryBase { if ( $fld_description && Revision::userCanBitfield( $row->fa_deleted, File::DELETED_COMMENT, $user ) ) { - $file['description'] = $row->fa_description; + $file['description'] = $commentStore->getComment( 'fa_description', $row )->text; if ( isset( $prop['parseddescription'] ) ) { $file['parseddescription'] = Linker::formatComment( - $row->fa_description, $title ); + $file['description'], $title ); } } if ( $fld_user &&