23 parent::__construct( $query, $moduleName,
'msf' );
29 if ( !$user->isRegistered() ) {
30 $this->
dieWithError(
'apierror-mustbeloggedin-uploadstash',
'stashnotloggedin' );
40 $this->
addFields( [
'us_id',
'us_key',
'us_status' ] );
42 $this->
addWhere( [
'us_user' => $user->getId() ] );
44 if ( $params[
'continue'] !==
null ) {
47 'us_id' => (
int)$cont[0],
51 $this->
addOption(
'LIMIT', $params[
'limit'] + 1 );
54 $prop = array_fill_keys( $params[
'prop'],
true );
63 isset( $prop[
'size'] )
65 $this->
addFieldsIf( [
'us_mime',
'us_media_type' ], isset( $prop[
'type'] ) );
67 $res = $this->
select( __METHOD__ );
71 foreach ( $res as $row ) {
72 if ( ++$count > $params[
'limit'] ) {
80 'filekey' => $row->us_key,
81 'status' => $row->us_status,
84 if ( isset( $prop[
'size'] ) ) {
85 $item[
'size'] = (int)$row->us_size;
86 $item[
'width'] = (int)$row->us_image_width;
87 $item[
'height'] = (int)$row->us_image_height;
88 $item[
'bits'] = (int)$row->us_image_bits;
91 if ( isset( $prop[
'type'] ) ) {
92 $item[
'mimetype'] = $row->us_mime;
93 $item[
'mediatype'] = $row->us_media_type;
96 $fit = $result->addValue( [
'query', $this->
getModuleName() ],
null, $item );
104 $result->addIndexedTagName( [
'query', $this->
getModuleName() ],
'file' );
111 ParamValidator::PARAM_ISMULTI =>
true,
112 ParamValidator::PARAM_DEFAULT =>
'',
113 ParamValidator::PARAM_TYPE => [
'size',
'type' ],
118 ParamValidator::PARAM_TYPE =>
'limit',
119 ParamValidator::PARAM_DEFAULT => 10,
120 IntegerDef::PARAM_MIN => 1,
134 'action=query&list=mystashedfiles&msfprop=size'
135 =>
'apihelp-query+mystashedfiles-example-simple',
141 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:mystashedfiles';
146class_alias( ApiQueryMyStashedFiles::class,
'ApiQueryMyStashedFiles' );