summaryrefslogtreecommitdiff
path: root/includes/api/ApiQueryStashImageInfo.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/api/ApiQueryStashImageInfo.php')
-rw-r--r--includes/api/ApiQueryStashImageInfo.php52
1 files changed, 19 insertions, 33 deletions
diff --git a/includes/api/ApiQueryStashImageInfo.php b/includes/api/ApiQueryStashImageInfo.php
index db928560..11268426 100644
--- a/includes/api/ApiQueryStashImageInfo.php
+++ b/includes/api/ApiQueryStashImageInfo.php
@@ -52,18 +52,16 @@ class ApiQueryStashImageInfo extends ApiQueryImageInfo {
}
try {
- $stash = RepoGroup::singleton()->getLocalRepo()->getUploadStash();
+ $stash = RepoGroup::singleton()->getLocalRepo()->getUploadStash( $this->getUser() );
foreach ( $params['filekey'] as $filekey ) {
$file = $stash->getFile( $filekey );
$finalThumbParam = $this->mergeThumbParams( $file, $scale, $params['urlparam'] );
$imageInfo = ApiQueryImageInfo::getInfo( $file, $prop, $result, $finalThumbParam );
$result->addValue( array( 'query', $this->getModuleName() ), null, $imageInfo );
- $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), $modulePrefix );
+ $result->addIndexedTagName( array( 'query', $this->getModuleName() ), $modulePrefix );
}
// @todo Update exception handling here to understand current getFile exceptions
- } catch ( UploadStashNotAvailableException $e ) {
- $this->dieUsage( "Session not available: " . $e->getMessage(), "nosession" );
} catch ( UploadStashFileNotFoundException $e ) {
$this->dieUsage( "File not found: " . $e->getMessage(), "invalidsessiondata" );
} catch ( UploadStashBadPathException $e ) {
@@ -90,50 +88,38 @@ class ApiQueryStashImageInfo extends ApiQueryImageInfo {
'prop' => array(
ApiBase::PARAM_ISMULTI => true,
ApiBase::PARAM_DFLT => 'timestamp|url',
- ApiBase::PARAM_TYPE => self::getPropertyNames( $this->propertyFilter )
+ ApiBase::PARAM_TYPE => self::getPropertyNames( $this->propertyFilter ),
+ ApiBase::PARAM_HELP_MSG => 'apihelp-query+imageinfo-param-prop',
+ ApiBase::PARAM_HELP_MSG_PER_VALUE => self::getPropertyMessages( $this->propertyFilter )
),
'urlwidth' => array(
ApiBase::PARAM_TYPE => 'integer',
- ApiBase::PARAM_DFLT => -1
+ ApiBase::PARAM_DFLT => -1,
+ ApiBase::PARAM_HELP_MSG => array(
+ 'apihelp-query+imageinfo-param-urlwidth',
+ ApiQueryImageInfo::TRANSFORM_LIMIT,
+ ),
),
'urlheight' => array(
ApiBase::PARAM_TYPE => 'integer',
- ApiBase::PARAM_DFLT => -1
+ ApiBase::PARAM_DFLT => -1,
+ ApiBase::PARAM_HELP_MSG => 'apihelp-query+imageinfo-param-urlheight',
),
'urlparam' => array(
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_DFLT => '',
+ ApiBase::PARAM_HELP_MSG => 'apihelp-query+imageinfo-param-urlparam',
),
);
}
- /**
- * Return the API documentation for the parameters.
- * @return array Parameter documentation.
- */
- public function getParamDescription() {
- $p = $this->getModulePrefix();
-
- return array(
- 'prop' => self::getPropertyDescriptions( $this->propertyFilter, $p ),
- 'filekey' => 'Key that identifies a previous upload that was stashed temporarily.',
- 'sessionkey' => 'Alias for filekey, for backward compatibility.',
- 'urlwidth' => "If {$p}prop=url is set, a URL to an image scaled to this width will be returned.",
- 'urlheight' => "Similar to {$p}urlwidth. Cannot be used without {$p}urlwidth",
- 'urlparam' => array( "A handler specific parameter string. For example, pdf's ",
- "might use 'page15-100px'. {$p}urlwidth must be used and be consistent with {$p}urlparam" ),
- );
- }
-
- public function getDescription() {
- return 'Returns image information for stashed images.';
- }
-
- public function getExamples() {
+ protected function getExamplesMessages() {
return array(
- 'api.php?action=query&prop=stashimageinfo&siifilekey=124sd34rsdf567',
- 'api.php?action=query&prop=stashimageinfo&siifilekey=b34edoe3|bceffd4&' .
- 'siiurlwidth=120&siiprop=url',
+ 'action=query&prop=stashimageinfo&siifilekey=124sd34rsdf567'
+ => 'apihelp-query+stashimageinfo-example-simple',
+ 'action=query&prop=stashimageinfo&siifilekey=b34edoe3|bceffd4&' .
+ 'siiurlwidth=120&siiprop=url'
+ => 'apihelp-query+stashimageinfo-example-params',
);
}
}