X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryStashImageInfo.php;h=c84de8c97448c71d51b2e26d15c1e675377effc2;hb=9adf80d25343b7377fa41fe13cecfdddace91e31;hp=981cb09483596dffa8698d16d4851e02ea05091f;hpb=70d23443d4c2c140a350bc365fb22b9d0daeca57;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryStashImageInfo.php b/includes/api/ApiQueryStashImageInfo.php index 981cb09483..c84de8c974 100644 --- a/includes/api/ApiQueryStashImageInfo.php +++ b/includes/api/ApiQueryStashImageInfo.php @@ -63,19 +63,44 @@ class ApiQueryStashImageInfo extends ApiQueryImageInfo { $result->addIndexedTagName( [ 'query', $this->getModuleName() ], $modulePrefix ); } // @todo Update exception handling here to understand current getFile exceptions - // @todo Internationalize the exceptions } catch ( UploadStashFileNotFoundException $e ) { - $this->dieWithError( [ 'apierror-stashedfilenotfound', wfEscapeWikiText( $e->getMessage() ) ] ); + $this->dieWithException( $e, [ 'wrap' => 'apierror-stashedfilenotfound' ] ); } catch ( UploadStashBadPathException $e ) { - $this->dieWithError( [ 'apierror-stashpathinvalid', wfEscapeWikiText( $e->getMessage() ) ] ); + $this->dieWithException( $e, [ 'wrap' => 'apierror-stashpathinvalid' ] ); } } - 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' => [ @@ -88,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', @@ -124,6 +149,6 @@ class ApiQueryStashImageInfo extends ApiQueryImageInfo { } public function getHelpUrls() { - return 'https://www.mediawiki.org/wiki/API:Stashimageinfo'; + return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Stashimageinfo'; } }