Index: trunk/phase3/includes/api/ApiQueryStashImageInfo.php |
— | — | @@ -41,11 +41,15 @@ |
42 | 42 | |
43 | 43 | $result = $this->getResult(); |
44 | 44 | |
| 45 | + if ( !$params['filekey'] && !$params['sessionkey'] ) { |
| 46 | + $this->dieUsage( "One of filekey or sessionkey must be supplied", 'nofilekey'); |
| 47 | + } |
| 48 | + |
45 | 49 | try { |
46 | 50 | $stash = RepoGroup::singleton()->getLocalRepo()->getUploadStash(); |
47 | 51 | |
48 | | - foreach ( $params['sessionkey'] as $sessionkey ) { |
49 | | - $file = $stash->getFile( $sessionkey ); |
| 52 | + foreach ( $params['filekey'] as $filekey ) { |
| 53 | + $file = $stash->getFile( $filekey ); |
50 | 54 | $finalThumbParam = $this->mergeThumbParams( $file, $scale, $params['urlparam'] ); |
51 | 55 | $imageInfo = ApiQueryImageInfo::getInfo( $file, $prop, $result, $finalThumbParam ); |
52 | 56 | $result->addValue( array( 'query', $this->getModuleName() ), null, $imageInfo ); |
— | — | @@ -68,9 +72,13 @@ |
69 | 73 | |
70 | 74 | public function getAllowedParams() { |
71 | 75 | return array( |
| 76 | + 'filekey' => array( |
| 77 | + ApiBase::PARAM_ISMULTI => true, |
| 78 | + ApiBase::PARAM_DFLT => null |
| 79 | + ), |
72 | 80 | 'sessionkey' => array( |
73 | 81 | ApiBase::PARAM_ISMULTI => true, |
74 | | - ApiBase::PARAM_REQUIRED => true, |
| 82 | + ApiBase::PARAM_DEPRECATED => true, |
75 | 83 | ApiBase::PARAM_DFLT => null |
76 | 84 | ), |
77 | 85 | 'prop' => array( |
— | — | @@ -101,7 +109,8 @@ |
102 | 110 | $p = $this->getModulePrefix(); |
103 | 111 | return array( |
104 | 112 | 'prop' => self::getPropertyDescriptions( $this->propertyFilter ), |
105 | | - 'sessionkey' => 'Session key that identifies a previous upload that was stashed temporarily.', |
| 113 | + 'filekey' => 'Key that identifies a previous upload that was stashed temporarily.', |
| 114 | + 'sessionkey' => 'Alias for filekey, for backward compatibility.', |
106 | 115 | 'urlwidth' => "If {$p}prop=url is set, a URL to an image scaled to this width will be returned.", |
107 | 116 | 'urlheight' => "Similar to {$p}urlwidth. Cannot be used without {$p}urlwidth", |
108 | 117 | 'urlparam' => array( "A handler specific parameter string. For example, pdf's ", |
— | — | @@ -115,8 +124,8 @@ |
116 | 125 | |
117 | 126 | protected function getExamples() { |
118 | 127 | return array( |
119 | | - 'api.php?action=query&prop=stashimageinfo&siisessionkey=124sd34rsdf567', |
120 | | - 'api.php?action=query&prop=stashimageinfo&siisessionkey=b34edoe3|bceffd4&siiurlwidth=120&siiprop=url', |
| 128 | + 'api.php?action=query&prop=stashimageinfo&siifilekey=124sd34rsdf567', |
| 129 | + 'api.php?action=query&prop=stashimageinfo&siifilekey=b34edoe3|bceffd4&siiurlwidth=120&siiprop=url', |
121 | 130 | ); |
122 | 131 | } |
123 | 132 | |