From: Umherirrender Date: Thu, 9 May 2019 19:36:30 +0000 (+0200) Subject: Fix property filter for ApiQueryStashImageInfo::getPropertyNames X-Git-Tag: 1.34.0-rc.0~275^2 X-Git-Url: http://git.cyclocoop.org/data/Fool?a=commitdiff_plain;h=0e4b7631097508cd7982559569eda464b6ca47d3;p=lhc%2Fweb%2Fwiklou.git Fix property filter for ApiQueryStashImageInfo::getPropertyNames The property filter in ApiQueryStashImageInfo was only applied on calls from the class itself. The call from UploadBase does not applied the filter and than after successful upload of a stashed file the attributes like user or mediatype are shown, but empty and not needed. Change-Id: I89b2a935bacea81b4c8807d7ee77021377c8635c --- diff --git a/includes/api/ApiQueryStashImageInfo.php b/includes/api/ApiQueryStashImageInfo.php index 1924ca0339..c84de8c974 100644 --- a/includes/api/ApiQueryStashImageInfo.php +++ b/includes/api/ApiQueryStashImageInfo.php @@ -70,11 +70,37 @@ class ApiQueryStashImageInfo extends ApiQueryImageInfo { } } - private $propertyFilter = [ + private static $propertyFilter = [ 'user', 'userid', 'comment', 'parsedcomment', 'mediatype', 'archivename', 'uploadwarning', ]; + /** + * Returns all possible parameters to siiprop + * + * @param array|null $filter List of properties to filter out + * @return array + */ + public static function getPropertyNames( $filter = null ) { + if ( $filter === null ) { + $filter = self::$propertyFilter; + } + return parent::getPropertyNames( $filter ); + } + + /** + * Returns messages for all possible parameters to siiprop + * + * @param array|null $filter List of properties to filter out + * @return array + */ + public static function getPropertyMessages( $filter = null ) { + if ( $filter === null ) { + $filter = self::$propertyFilter; + } + return parent::getPropertyMessages( $filter ); + } + public function getAllowedParams() { return [ 'filekey' => [ @@ -87,9 +113,9 @@ class ApiQueryStashImageInfo extends ApiQueryImageInfo { 'prop' => [ ApiBase::PARAM_ISMULTI => true, ApiBase::PARAM_DFLT => 'timestamp|url', - ApiBase::PARAM_TYPE => self::getPropertyNames( $this->propertyFilter ), + ApiBase::PARAM_TYPE => self::getPropertyNames(), ApiBase::PARAM_HELP_MSG => 'apihelp-query+imageinfo-param-prop', - ApiBase::PARAM_HELP_MSG_PER_VALUE => self::getPropertyMessages( $this->propertyFilter ) + ApiBase::PARAM_HELP_MSG_PER_VALUE => self::getPropertyMessages() ], 'urlwidth' => [ ApiBase::PARAM_TYPE => 'integer',