Index: branches/uploadwizard/phase3/includes/api/ApiQueryImageInfo.php |
— | — | @@ -366,11 +366,13 @@ |
367 | 367 | ); |
368 | 368 | } |
369 | 369 | |
| 370 | + |
370 | 371 | /** |
371 | | - * This is broken out from getParamDescription, since some subclasses of this module use identical property parameters. |
372 | | - * @return {Array} parameter description |
| 372 | + * Return the API documentation for the parameters. |
| 373 | + * @return {Array} parameter documentation. |
373 | 374 | */ |
374 | | - public function getPropParamDescription() { |
| 375 | + public function getParamDescription() { |
| 376 | + $p = $this->getModulePrefix(); |
375 | 377 | return array( |
376 | 378 | 'prop' => array( |
377 | 379 | 'What image information to get:', |
— | — | @@ -387,25 +389,15 @@ |
388 | 390 | ' metadata - Lists EXIF metadata for the version of the image', |
389 | 391 | ' archivename - Adds the file name of the archive version for non-latest versions', |
390 | 392 | ' bitdepth - Adds the bit depth of the version', |
391 | | - ) |
392 | | - ); |
393 | | - } |
394 | | - |
395 | | - /** |
396 | | - * Return the API documentation for the parameters. |
397 | | - * @return {Array} parameter documentation. |
398 | | - */ |
399 | | - public function getParamDescription() { |
400 | | - $p = $this->getModulePrefix(); |
401 | | - $description = array( |
| 393 | + ), |
402 | 394 | 'urlwidth' => array( "If {$p}prop=url is set, a URL to an image scaled to this width will be returned.", |
403 | 395 | 'Only the current version of the image can be scaled' ), |
404 | 396 | 'urlheight' => "Similar to {$p}urlwidth. Cannot be used without {$p}urlwidth", |
405 | 397 | 'limit' => 'How many image revisions to return', |
406 | 398 | 'start' => 'Timestamp to start listing from', |
407 | | - 'end' => 'Timestamp to stop listing at' |
| 399 | + 'end' => 'Timestamp to stop listing at', |
| 400 | + 'continue' => 'If the query response includes a continue value, use it here to get another page of results' |
408 | 401 | ); |
409 | | - return array_merge( $description, $this->getPropParamDescription() ); |
410 | 402 | } |
411 | 403 | |
412 | 404 | public function getDescription() { |
Index: branches/uploadwizard/extensions/UploadWizard/ApiQueryStashImageInfo.php |
— | — | @@ -33,10 +33,7 @@ |
34 | 34 | |
35 | 35 | public function execute() { |
36 | 36 | $params = $this->extractRequestParams(); |
37 | | - $modulePrefix = $this->getModulePrefix; |
38 | | - if ( is_null( $params['sessionkey'] ) ) { |
39 | | - $this->dieUsageMsg( array( 'missingparam', 'sessionkey' ) ); |
40 | | - } |
| 37 | + $modulePrefix = $this->getModulePrefix(); |
41 | 38 | |
42 | 39 | $prop = array_flip( $params['prop'] ); |
43 | 40 | |
— | — | @@ -50,13 +47,8 @@ |
51 | 48 | foreach ( $params['sessionkey'] as $sessionkey ) { |
52 | 49 | $file = $stash->getFile( $sessionkey ); |
53 | 50 | $imageInfo = self::getInfo( $file, $prop, $result, $scale ); |
54 | | - $result->setIndexedTagName( $imageInfo, $modulePrefix ); |
55 | | - $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $imageInfo ); |
56 | | - /* TODO overflow of continue */ |
57 | | - if ( !$fit ) { |
58 | | - $this->setContinueEnumParameter( 'from', $this->keyToTitle( $row->fa_name ) ); |
59 | | - break; |
60 | | - } |
| 51 | + $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), $modulePrefix ); |
| 52 | + $result->addValue( array( 'query', $this->getModuleName() ), null, $imageInfo ); |
61 | 53 | } |
62 | 54 | |
63 | 55 | } catch ( SessionStashNotAvailableException $e ) { |
— | — | @@ -69,7 +61,24 @@ |
70 | 62 | |
71 | 63 | } |
72 | 64 | |
| 65 | + /** |
| 66 | + * Returns all valid parameters to siiprop |
| 67 | + */ |
| 68 | + public static function getPropertyNames() { |
| 69 | + return array( |
| 70 | + 'timestamp', |
| 71 | + 'url', |
| 72 | + 'size', |
| 73 | + 'dimensions', // For backwards compatibility with Allimages |
| 74 | + 'sha1', |
| 75 | + 'mime', |
| 76 | + 'thumbmime', |
| 77 | + 'metadata', |
| 78 | + 'bitdepth', |
| 79 | + ); |
| 80 | + } |
73 | 81 | |
| 82 | + |
74 | 83 | public function getAllowedParams() { |
75 | 84 | return array( |
76 | 85 | 'sessionkey' => array( |
— | — | @@ -79,7 +88,7 @@ |
80 | 89 | ), |
81 | 90 | 'prop' => array( |
82 | 91 | ApiBase::PARAM_ISMULTI => true, |
83 | | - ApiBase::PARAM_DFLT => 'timestamp|user', |
| 92 | + ApiBase::PARAM_DFLT => 'timestamp|url', |
84 | 93 | ApiBase::PARAM_TYPE => self::getPropertyNames() |
85 | 94 | ), |
86 | 95 | 'urlwidth' => array( |
— | — | @@ -89,8 +98,7 @@ |
90 | 99 | 'urlheight' => array( |
91 | 100 | ApiBase::PARAM_TYPE => 'integer', |
92 | 101 | ApiBase::PARAM_DFLT => -1 |
93 | | - ), |
94 | | - 'continue' => null, |
| 102 | + ) |
95 | 103 | ); |
96 | 104 | } |
97 | 105 | |
— | — | @@ -100,11 +108,23 @@ |
101 | 109 | */ |
102 | 110 | public function getParamDescription() { |
103 | 111 | $p = $this->getModulePrefix(); |
104 | | - $description = array( |
| 112 | + return array( |
| 113 | + 'prop' => array( |
| 114 | + 'What image information to get:', |
| 115 | + ' timestamp - Adds timestamp for the uploaded version', |
| 116 | + ' url - Gives URL to the image and the description page', |
| 117 | + ' size - Adds the size of the image in bytes and the height and width', |
| 118 | + ' dimensions - Alias for size', |
| 119 | + ' sha1 - Adds sha1 hash for the image', |
| 120 | + ' mime - Adds MIME of the image', |
| 121 | + ' thumbmime - Adss MIME of the image thumbnail (requires url)', |
| 122 | + ' metadata - Lists EXIF metadata for the version of the image', |
| 123 | + ' bitdepth - Adds the bit depth of the version', |
| 124 | + ), |
| 125 | + 'sessionkey' => 'Session key that identifies a previous upload that was stashed temporarily.', |
105 | 126 | 'urlwidth' => "If {$p}prop=url is set, a URL to an image scaled to this width will be returned.", |
106 | | - 'urlheight' => "Similar to {$p}urlwidth. Cannot be used without {$p}urlwidth", |
| 127 | + 'urlheight' => "Similar to {$p}urlwidth. Cannot be used without {$p}urlwidth" |
107 | 128 | ); |
108 | | - return array_merge( $description, $this->getPropParamDescription() ); |
109 | 129 | } |
110 | 130 | |
111 | 131 | public function getDescription() { |