32 parent::__construct(
$query, $moduleName,
'msf' );
38 if ( $user->isAnon() ) {
39 $this->
dieWithError(
'apierror-mustbeloggedin-uploadstash',
'stashnotloggedin' );
49 $this->
addFields( [
'us_id',
'us_key',
'us_status' ] );
51 $this->
addWhere( [
'us_user' => $user->getId() ] );
53 if (
$params[
'continue'] !==
null ) {
54 $cont = explode(
'|',
$params[
'continue'] );
56 $cont_from = (int)$cont[0];
58 $this->
addWhere(
"us_id >= $cont_from" );
64 $prop = array_flip(
$params[
'prop'] );
73 isset( $prop[
'size'] )
75 $this->
addFieldsIf( [
'us_mime',
'us_media_type' ], isset( $prop[
'type'] ) );
81 foreach (
$res as $row ) {
82 if ( ++$count >
$params[
'limit'] ) {
90 'filekey' => $row->us_key,
91 'status' => $row->us_status,
94 if ( isset( $prop[
'size'] ) ) {
95 $item[
'size'] = (int)$row->us_size;
96 $item[
'width'] = (int)$row->us_image_width;
97 $item[
'height'] = (int)$row->us_image_height;
98 $item[
'bits'] = (int)$row->us_image_bits;
101 if ( isset( $prop[
'type'] ) ) {
102 $item[
'mimetype'] = $row->us_mime;
103 $item[
'mediatype'] = $row->us_media_type;
106 $fit = $result->addValue( [
'query', $this->
getModuleName() ],
null, $item );
114 $result->addIndexedTagName( [
'query', $this->
getModuleName() ],
'file' );
142 'action=query&list=mystashedfiles&msfprop=size'
143 =>
'apihelp-query+mystashedfiles-example-simple',
148 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:mystashedfiles';
const PARAM_MAX2
(integer) Max value allowed for the parameter for users with the apihighlimits right,...
const PARAM_MAX
(integer) Max value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
dieContinueUsageIf( $condition)
Die with the 'badcontinue' error.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
extractRequestParams( $parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user,...
const PARAM_HELP_MSG_PER_VALUE
((string|array|Message)[]) When PARAM_TYPE is an array, this is an array mapping those values to $msg...
const PARAM_MIN
(integer) Lowest value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
const LIMIT_BIG1
Fast query, standard limit.
getResult()
Get the result object.
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
const LIMIT_BIG2
Fast query, apihighlimits limit.
getModuleName()
Get the name of the module being executed by this instance.
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
This is a base class for all Query modules.
setContinueEnumParameter( $paramName, $paramValue)
Set a query-continue value.
addFields( $value)
Add a set of fields to select to the internal array.
addOption( $name, $value=null)
Add an option such as LIMIT or USE INDEX.
addTables( $tables, $alias=null)
Add a set of tables to the internal array.
addFieldsIf( $value, $condition)
Same as addFields(), but add the fields only if a condition is met.
addWhere( $value)
Add a set of WHERE clauses to the internal array.
action=query&list=mystashedfiles module, gets all stashed files for the current user.
getExamplesMessages()
Returns usage examples for this module.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
getHelpUrls()
Return links to more detailed help pages about the module.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
__construct(ApiQuery $query, $moduleName)
This is the main query class.
getUser()
Get the User object.
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this but given the dire we prefer to have as many checks as possible We provide a but the wrapper functions like select() and insert() are usually more convenient. They take care of things like table prefixes and escaping for you. If you really need to make your own SQL
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query