37 parent::__construct( $query, $moduleName,
'msf' );
43 if ( !$user->isRegistered() ) {
44 $this->
dieWithError(
'apierror-mustbeloggedin-uploadstash',
'stashnotloggedin' );
54 $this->
addFields( [
'us_id',
'us_key',
'us_status' ] );
56 $this->
addWhere( [
'us_user' => $user->getId() ] );
58 if (
$params[
'continue'] !==
null ) {
61 'us_id' => (
int)$cont[0],
68 $prop = array_fill_keys(
$params[
'prop'],
true );
77 isset( $prop[
'size'] )
79 $this->
addFieldsIf( [
'us_mime',
'us_media_type' ], isset( $prop[
'type'] ) );
81 $res = $this->
select( __METHOD__ );
85 foreach ( $res as $row ) {
86 if ( ++$count >
$params[
'limit'] ) {
94 'filekey' => $row->us_key,
95 'status' => $row->us_status,
98 if ( isset( $prop[
'size'] ) ) {
99 $item[
'size'] = (int)$row->us_size;
100 $item[
'width'] = (int)$row->us_image_width;
101 $item[
'height'] = (int)$row->us_image_height;
102 $item[
'bits'] = (int)$row->us_image_bits;
105 if ( isset( $prop[
'type'] ) ) {
106 $item[
'mimetype'] = $row->us_mime;
107 $item[
'mediatype'] = $row->us_media_type;
110 $fit = $result->addValue( [
'query', $this->
getModuleName() ],
null, $item );
118 $result->addIndexedTagName( [
'query', $this->
getModuleName() ],
'file' );
124 ParamValidator::PARAM_ISMULTI =>
true,
125 ParamValidator::PARAM_DEFAULT =>
'',
126 ParamValidator::PARAM_TYPE => [
'size',
'type' ],
131 ParamValidator::PARAM_TYPE =>
'limit',
132 ParamValidator::PARAM_DEFAULT => 10,
133 IntegerDef::PARAM_MIN => 1,
146 'action=query&list=mystashedfiles&msfprop=size'
147 =>
'apihelp-query+mystashedfiles-example-simple',
152 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:mystashedfiles';
157class_alias( ApiQueryMyStashedFiles::class,
'ApiQueryMyStashedFiles' );
array $params
The job parameters.