API: Remove action=paraminfo 'props' and 'errors' result properties

The format for 'props' was never specified and the list for 'errors' is
impossible to keep updated when considering that many errors come from
MediaWiki backend code and extension hook functions. And since there
doesn't seem to be any real use case for either of these, let's just
kill both of them instead of wasting effort on trying to fix them.

Note that neither getResultProperties nor getPossibleErrors are called
from any extensions in gerrit, and none of the other deprecated methods
are called outside of the implementations of those two methods. Removing
the obsolete methods is left to the maintainers of the extensions, as
keeping them hurts nothing and is needed to maintain compatibility with
earlier versions of MediaWiki.

Change-Id: Ie11a401d60c834059fbf1b5625ca8ea093b3337c
This commit is contained in:
Brad Jorsch 2014-08-07 16:48:59 +01:00
parent af87cb4a3f
commit f0a6435f3b
77 changed files with 55 additions and 2864 deletions

View file

@ -206,6 +206,10 @@ production.
to use for the module. This is intended for extensions that want control over
the instantiation of their API modules, to allow for proper dependency
injection.
* Removed 'props' and 'errors' from action=paraminfo, as they have extremely
limited use and are generally inaccurate, unmaintained, and impossible to
properly maintain. Also removed the corresponding methods from ApiBase and
the 'APIGetPossibleErrors' and 'APIGetResultProperties' hooks.
=== Languages updated in 1.24 ===

View file

@ -393,16 +393,6 @@ descriptions.
&$module: ApiBase Module object
&$desc: Array of parameter descriptions
'APIGetResultProperties': Use this hook to modify the properties in a module's
result.
&$module: ApiBase Module object
&$properties: Array of properties
'APIGetPossibleErrors': Use this hook to modify the module's list of possible
errors.
$module: ApiBase Module object
&$possibleErrors: Array of possible errors
'APIQueryAfterExecute': After calling the execute() method of an
action=query submodule. Use this to extend core API modules.
&$module: Module object

View file

@ -593,51 +593,36 @@ abstract class ApiBase extends ContextSource {
}
/**
* Returns possible properties in the result, grouped by the value of the prop parameter
* that shows them.
* Formerly used to fetch a list of possible properites in the result,
* somehow organized with respect to the prop parameter that causes them to
* be returned. The specific semantics of the return value was never
* specified. Since this was never possible to be accurately updated, it
* has been removed.
*
* Properties that are shown always are in a group with empty string as a key.
* Properties that can be shown by several values of prop are included multiple times.
* If some properties are part of a list and some are on the root object (see ApiQueryQueryPage),
* those on the root object are under the key PROP_ROOT.
* The array can also contain a boolean under the key PROP_LIST,
* indicating whether the result is a list.
*
* Don't call this function directly: use getFinalResultProperties() to
* allow hooks to modify descriptions as needed.
*
* @return array|bool False on no properties
* @deprecated since 1.24
* @return array|bool
*/
protected function getResultProperties() {
wfDeprecated( __METHOD__, '1.24' );
return false;
}
/**
* Get final possible result properties, after hooks have had a chance to tweak it as
* needed.
*
* @return array
* @see self::getResultProperties()
* @deprecated since 1.24
* @return array|bool
*/
public function getFinalResultProperties() {
$properties = $this->getResultProperties();
wfRunHooks( 'APIGetResultProperties', array( $this, &$properties ) );
return $properties;
wfDeprecated( __METHOD__, '1.24' );
return array();
}
/**
* Add token properties to the array used by getResultProperties,
* based on a token functions mapping.
* @param array $props
* @param array $tokenFunctions
* @see self::getResultProperties()
* @deprecated since 1.24
*/
protected static function addTokenProperties( &$props, $tokenFunctions ) {
foreach ( array_keys( $tokenFunctions ) as $token ) {
$props[''][$token . 'token'] = array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
);
}
wfDeprecated( __METHOD__, '1.24' );
}
/**
@ -706,8 +691,6 @@ abstract class ApiBase extends ContextSource {
/**
* Die if none or more than one of a certain set of parameters is set and not false.
*
* Call getRequireOnlyOneParameterErrorMessages() to get a list of possible errors.
*
* @param array $params User provided set of parameters, as from $this->extractRequestParams()
* @param string $required,... Names of parameters of which exactly one must be set
*/
@ -732,32 +715,18 @@ abstract class ApiBase extends ContextSource {
}
/**
* Generates the possible errors requireOnlyOneParameter() can die with
*
* @param array $params
* @see self::getPossibleErrors()
* @deprecated since 1.24
* @return array
*/
public function getRequireOnlyOneParameterErrorMessages( $params ) {
$p = $this->getModulePrefix();
$params = implode( ", {$p}", $params );
return array(
array(
'code' => "{$p}missingparam",
'info' => "One of the parameters {$p}{$params} is required"
),
array(
'code' => "{$p}invalidparammix",
'info' => "The parameters {$p}{$params} can not be used together"
)
);
wfDeprecated( __METHOD__, '1.24' );
return array();
}
/**
* Die if more than one of a certain set of parameters is set and not false.
*
* Call getRequireMaxOneParameterErrorMessages() to get a list of possible errors.
*
* @param array $params User provided set of parameters, as from $this->extractRequestParams()
* @param string $required,... Names of parameters of which at most one must be set
*/
@ -778,28 +747,18 @@ abstract class ApiBase extends ContextSource {
}
/**
* Generates the possible error requireMaxOneParameter() can die with
*
* @param array $params
* @see self::getPossibleErrors()
* @deprecated since 1.24
* @return array
*/
public function getRequireMaxOneParameterErrorMessages( $params ) {
$p = $this->getModulePrefix();
$params = implode( ", {$p}", $params );
return array(
array(
'code' => "{$p}invalidparammix",
'info' => "The parameters {$p}{$params} can not be used together"
)
);
wfDeprecated( __METHOD__, '1.24' );
return array();
}
/**
* Die if none of a certain set of parameters is set and not false.
*
* Call getRequireAtLeastOneParameterErrorMessages() to get a list of possible errors.
*
* @since 1.23
* @param array $params User provided set of parameters, as from $this->extractRequestParams()
* @param string $required,... Names of parameters of which at least one must be set
@ -821,30 +780,19 @@ abstract class ApiBase extends ContextSource {
}
/**
* Generates the possible errors requireAtLeastOneParameter() can die with
*
* @since 1.23
* @param array $params Array of parameter key names
* @see self::getPossibleErrors()
* @deprecated since 1.24
* @return array
*/
public function getRequireAtLeastOneParameterErrorMessages( $params ) {
$p = $this->getModulePrefix();
$params = implode( ", {$p}", $params );
return array(
array(
'code' => "{$p}missingparam",
'info' => "At least one of the parameters {$p}{$params} is required",
),
);
wfDeprecated( __METHOD__, '1.24' );
return array();
}
/**
* Get a WikiPage object from a title or pageid param, if possible.
* Can die, if no param is set or if the title or page id is not valid.
*
* Call getTitleOrPageIdErrorMessage() to get a list of possible errors.
*
* @param array $params
* @param bool|string $load Whether load the object's state from the database:
* - false: don't load (if the pageid is given, it will still be loaded)
@ -882,19 +830,13 @@ abstract class ApiBase extends ContextSource {
}
/**
* Generates the possible error getTitleOrPageId() can die with
*
* @see self::getPossibleErrors()
* @deprecated since 1.24
* @return array
*/
public function getTitleOrPageIdErrorMessage() {
return array_merge(
$this->getRequireOnlyOneParameterErrorMessages( array( 'title', 'pageid' ) ),
array(
array( 'invalidtitle', 'title' ),
array( 'nosuchpageid', 'pageid' ),
array( 'code' => 'pagecannotexist', 'info' => "Namespace doesn't allow actual pages" ),
)
);
wfDeprecated( __METHOD__, '1.24' );
return array();
}
/**
@ -2105,93 +2047,38 @@ abstract class ApiBase extends ContextSource {
}
/**
* Returns a list of all possible errors returned by the module
* This formerly attempted to return a list of all possible errors returned
* by the module. However, this was impossible to maintain in many cases
* since errors could come from other areas of MediaWiki and in some cases
* from arbitrary extension hooks. Since a partial list claiming to be
* comprehensive is unlikely to be useful, it was removed.
*
* Don't call this function directly: use getFinalPossibleErrors() to allow
* hooks to modify parameters as needed.
*
* @return array Array in the format of array( key, param1, param2, ... )
* or array( 'code' => ..., 'info' => ... )
* @deprecated since 1.24
* @return array
*/
public function getPossibleErrors() {
$ret = array();
$params = $this->getFinalParams();
if ( $params ) {
foreach ( $params as $paramName => $paramSettings ) {
if ( isset( $paramSettings[ApiBase::PARAM_REQUIRED] )
&& $paramSettings[ApiBase::PARAM_REQUIRED]
) {
$ret[] = array( 'missingparam', $paramName );
}
}
if ( array_key_exists( 'continue', $params ) ) {
$ret[] = array(
'code' => 'badcontinue',
'info' => 'Invalid continue param. You should pass the ' .
'original value returned by the previous query'
);
}
}
if ( $this->mustBePosted() ) {
$ret[] = array( 'mustbeposted', $this->getModuleName() );
}
if ( $this->isReadMode() ) {
$ret[] = array( 'readrequired' );
}
if ( $this->isWriteMode() ) {
$ret[] = array( 'writerequired' );
$ret[] = array( 'writedisabled' );
}
if ( $this->needsToken() ) {
if ( !isset( $params['token'][ApiBase::PARAM_REQUIRED] )
|| !$params['token'][ApiBase::PARAM_REQUIRED]
) {
// Add token as possible missing parameter, if not already done
$ret[] = array( 'missingparam', 'token' );
}
$ret[] = array( 'sessionfailure' );
}
return $ret;
wfDeprecated( __METHOD__, '1.24' );
return array();
}
/**
* Get final list of possible errors, after hooks have had a chance to
* tweak it as needed.
*
* @return array
* @since 1.22
* @see self::getPossibleErrors()
* @deprecated since 1.24
* @retun array
*/
public function getFinalPossibleErrors() {
$possibleErrors = $this->getPossibleErrors();
wfRunHooks( 'APIGetPossibleErrors', array( $this, &$possibleErrors ) );
return $possibleErrors;
wfDeprecated( __METHOD__, '1.24' );
return array();
}
/**
* Parses a list of errors into a standardised format
* @param array $errors List of errors. Items can be in the for
* array( key, param1, param2, ... ) or array( 'code' => ..., 'info' => ... )
* @return array Parsed list of errors with items in the form array( 'code' => ..., 'info' => ... )
* @see self::getPossibleErrors()
* @deprecated since 1.24
* @return array
*/
public function parseErrors( $errors ) {
$ret = array();
foreach ( $errors as $row ) {
if ( isset( $row['code'] ) && isset( $row['info'] ) ) {
$ret[] = $row;
} else {
$ret[] = $this->parseMsg( $row );
}
}
return $ret;
wfDeprecated( __METHOD__, '1.24' );
return array();
}
/**

View file

@ -187,54 +187,10 @@ class ApiBlock extends ApiBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'user' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'userID' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'expiry' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'id' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'reason' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'anononly' => 'boolean',
'nocreate' => 'boolean',
'autoblock' => 'boolean',
'noemail' => 'boolean',
'hidename' => 'boolean',
'allowusertalk' => 'boolean',
'watchuser' => 'boolean'
)
);
}
public function getDescription() {
return 'Block a user.';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'cantblock' ),
array( 'canthide' ),
array( 'cantblock-email' ),
array( 'ipbblocked' ),
array( 'ipbnounblockself' ),
) );
}
public function needsToken() {
return true;
}

View file

@ -137,24 +137,6 @@ class ApiComparePages extends ApiBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'fromtitle' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'fromrevid' => 'integer',
'totitle' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'torevid' => 'integer',
'*' => 'string'
)
);
}
public function getDescription() {
return array(
'Get the difference between 2 pages.',
@ -162,19 +144,6 @@ class ApiComparePages extends ApiBase {
);
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'code' => 'inputneeded', 'info' => 'A title or a revision is needed' ),
array( 'invalidtitle', 'title' ),
array( 'nosuchpageid', 'pageid' ),
array(
'code' => 'baddiff',
'info' => 'The diff cannot be retrieved. Maybe one or both ' .
'revisions do not exist or you do not have permission to view them.'
),
) );
}
public function getExamples() {
return array(
'api.php?action=compare&fromrev=1&torev=2' => 'Create a diff between revision 1 and 2',

View file

@ -221,84 +221,6 @@ class ApiCreateAccount extends ApiBase {
);
}
public function getResultProperties() {
return array(
'createaccount' => array(
'result' => array(
ApiBase::PROP_TYPE => array(
'Success',
'Warning',
'NeedToken'
)
),
'username' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'userid' => array(
ApiBase::PROP_TYPE => 'int',
ApiBase::PROP_NULLABLE => true
),
'token' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
)
);
}
public function getPossibleErrors() {
// Note the following errors aren't possible and don't need to be listed:
// sessionfailure, nocookiesfornew, badretype
$localErrors = array(
'wrongpassword', // Actually caused by wrong domain field. Riddle me that...
'sorbs_create_account_reason',
'noname',
'userexists',
'password-name-match', // from User::getPasswordValidity
'password-login-forbidden', // from User::getPasswordValidity
'noemailtitle',
'invalidemailaddress',
'externaldberror',
'acct_creation_throttle_hit',
);
$errors = parent::getPossibleErrors();
// All local errors are from LoginForm, which means they're actually message keys.
foreach ( $localErrors as $error ) {
$errors[] = array(
'code' => $error,
'info' => wfMessage( $error )->inLanguage( 'en' )->useDatabase( false )->parse()
);
}
$errors[] = array(
'code' => 'permdenied-createaccount',
'info' => 'You do not have the right to create a new account'
);
$errors[] = array(
'code' => 'blocked',
'info' => 'You cannot create a new account because you are blocked'
);
$errors[] = array(
'code' => 'aborted',
'info' => 'Account creation aborted by hook (info may vary)'
);
$errors[] = array(
'code' => 'langinvalid',
'info' => 'Invalid language parameter'
);
// 'passwordtooshort' has parameters. :(
$errors[] = array(
'code' => 'passwordtooshort',
'info' => wfMessage( 'passwordtooshort', $this->getConfig()->get( 'MinimalPasswordLength' ) )
->inLanguage( 'en' )->useDatabase( false )->parse()
);
return $errors;
}
public function getExamples() {
return array(
'api.php?action=createaccount&name=testuser&password=test123',

View file

@ -229,34 +229,10 @@ class ApiDelete extends ApiBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'title' => 'string',
'reason' => 'string',
'logid' => 'integer'
)
);
}
public function getDescription() {
return 'Delete a page.';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(),
$this->getTitleOrPageIdErrorMessage(),
array(
array( 'notanarticle' ),
array( 'hookaborted', 'error' ),
array( 'delete-toobig', 'limit' ),
array( 'cannotdelete', 'title' ),
array( 'invalidoldimage' ),
array( 'nodeleteablefile' ),
)
);
}
public function needsToken() {
return true;
}

View file

@ -498,65 +498,6 @@ class ApiEditPage extends ApiBase {
return 'Create and edit pages.';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(),
$this->getTitleOrPageIdErrorMessage(),
array(
array( 'missingtext' ),
array( 'createonly-exists' ),
array( 'nocreate-missing' ),
array( 'nosuchrevid', 'undo' ),
array( 'nosuchrevid', 'undoafter' ),
array( 'revwrongpage', 'id', 'text' ),
array( 'undo-failure' ),
array( 'hashcheckfailed' ),
array( 'hookaborted' ),
array( 'code' => 'parseerror', 'info' => 'Failed to parse the given text.' ),
array( 'noimageredirect-anon' ),
array( 'noimageredirect-logged' ),
array( 'spamdetected', 'spam' ),
array( 'summaryrequired' ),
array( 'blockedtext' ),
array( 'contenttoobig', $this->getConfig()->get( 'MaxArticleSize' ) ),
array( 'noedit-anon' ),
array( 'noedit' ),
array( 'actionthrottledtext' ),
array( 'wasdeleted' ),
array( 'nocreate-loggedin' ),
array( 'blankpage' ),
array( 'editconflict' ),
array( 'emptynewsection' ),
array( 'unknownerror', 'retval' ),
array( 'code' => 'nosuchsection', 'info' => 'There is no such section.' ),
array(
'code' => 'invalidsection',
'info' => 'The section parameter must be a valid section id or \'new\''
),
array(
'code' => 'sectionsnotsupported',
'info' => 'Sections are not supported for this type of page.'
),
array(
'code' => 'editnotsupported',
'info' => 'Editing of this type of page is not supported using the text based edit API.'
),
array(
'code' => 'appendnotsupported',
'info' => 'This type of page can not be edited by appending or prepending text.' ),
array(
'code' => 'redirect-appendonly',
'info' => 'You have attempted to edit using the "redirect"-following mode, which must be used in conjuction with section=new, prependtext, or appendtext.',
),
array(
'code' => 'badformat',
'info' => 'The requested serialization format can not be applied to the page\'s content model'
),
array( 'customcssprotected' ),
array( 'customjsprotected' ),
)
);
}
public function getAllowedParams() {
return array(
'title' => array(
@ -672,41 +613,6 @@ class ApiEditPage extends ApiBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'new' => 'boolean',
'result' => array(
ApiBase::PROP_TYPE => array(
'Success',
'Failure'
),
),
'pageid' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'title' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'nochange' => 'boolean',
'oldrevid' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'newrevid' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'newtimestamp' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
)
);
}
public function needsToken() {
return true;
}

View file

@ -112,33 +112,10 @@ class ApiEmailUser extends ApiBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'result' => array(
ApiBase::PROP_TYPE => array(
'Success',
'Failure'
),
),
'message' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
)
);
}
public function getDescription() {
return 'Email a user.';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'usermaildisabled' ),
) );
}
public function needsToken() {
return true;
}

View file

@ -176,45 +176,10 @@ class ApiExpandTemplates extends ApiBase {
);
}
public function getResultProperties() {
return array(
'wikitext' => array(
'wikitext' => 'string',
),
'categories' => array(
'categories' => array(
ApiBase::PROP_TYPE => 'array',
ApiBase::PROP_NULLABLE => true,
),
),
'volatile' => array(
'volatile' => array(
ApiBase::PROP_TYPE => 'boolean',
ApiBase::PROP_NULLABLE => true,
),
),
'ttl' => array(
'ttl' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true,
),
),
'parsetree' => array(
'parsetree' => 'string',
),
);
}
public function getDescription() {
return 'Expands all templates in wikitext.';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'invalidtitle', 'title' ),
) );
}
public function getExamples() {
return array(
'api.php?action=expandtemplates&text={{Project:Sandbox}}'

View file

@ -210,14 +210,6 @@ class ApiFeedContributions extends ApiBase {
return 'Returns a user contributions feed.';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'code' => 'feed-unavailable', 'info' => 'Syndication feeds are not available' ),
array( 'code' => 'feed-invalid', 'info' => 'Invalid subscription feed type' ),
array( 'code' => 'sizediffdisabled', 'info' => 'Size difference is disabled in Miser Mode' ),
) );
}
public function getExamples() {
return array(
'api.php?action=feedcontributions&user=Reedy',

View file

@ -198,13 +198,6 @@ class ApiFeedRecentChanges extends ApiBase {
return 'Returns a recent changes feed';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'code' => 'feed-unavailable', 'info' => 'Syndication feeds are not available' ),
array( 'code' => 'feed-invalid', 'info' => 'Invalid subscription feed type' ),
) );
}
public function getExamples() {
return array(
'api.php?action=feedrecentchanges',

View file

@ -259,13 +259,6 @@ class ApiFeedWatchlist extends ApiBase {
return 'Returns a watchlist feed.';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'code' => 'feed-unavailable', 'info' => 'Syndication feeds are not available' ),
array( 'code' => 'feed-invalid', 'info' => 'Invalid subscription feed type' ),
) );
}
public function getExamples() {
return array(
'api.php?action=feedwatchlist',

View file

@ -148,41 +148,12 @@ class ApiFileRevert extends ApiBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'result' => array(
ApiBase::PROP_TYPE => array(
'Success',
'Failure'
)
),
'errors' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
)
);
}
public function getDescription() {
return array(
'Revert a file to an old version.'
);
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(),
array(
array( 'mustbeloggedin', 'upload' ),
array( 'badaccess-groups' ),
array( 'invalidtitle', 'title' ),
array( 'notanarticle' ),
array( 'filerevert-badversion' ),
)
);
}
public function needsToken() {
return true;
}

View file

@ -219,15 +219,6 @@ class ApiImageRotate extends ApiBase {
return '';
}
public function getPossibleErrors() {
$pageSet = $this->getPageSet();
return array_merge(
parent::getPossibleErrors(),
$pageSet->getFinalPossibleErrors()
);
}
public function getExamples() {
return array(
'api.php?action=imagerotate&titles=Example.jpg&rotation=90&token=123ABC',

View file

@ -134,17 +134,6 @@ class ApiImport extends ApiBase {
);
}
public function getResultProperties() {
return array(
ApiBase::PROP_LIST => true,
'' => array(
'ns' => 'namespace',
'title' => 'string',
'revisions' => 'integer'
)
);
}
public function getDescription() {
return array(
'Import a page from another wiki, or an XML file.',
@ -153,18 +142,6 @@ class ApiImport extends ApiBase {
);
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'cantimport' ),
array( 'missingparam', 'interwikipage' ),
array( 'cantimport-upload' ),
array( 'import-unknownerror', 'source' ),
array( 'import-unknownerror', 'result' ),
array( 'import-rootpage-nosubpage', 'namespace' ),
array( 'import-rootpage-invalid' ),
) );
}
public function needsToken() {
return true;
}

View file

@ -193,66 +193,6 @@ class ApiLogin extends ApiBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'result' => array(
ApiBase::PROP_TYPE => array(
'Success',
'NeedToken',
'WrongToken',
'NoName',
'Illegal',
'WrongPluginPass',
'NotExists',
'WrongPass',
'EmptyPass',
'CreateBlocked',
'Throttled',
'Blocked',
'Aborted'
)
),
'lguserid' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'lgusername' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'lgtoken' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'cookieprefix' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'sessionid' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'token' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'details' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'wait' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'reason' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
)
);
}
public function getDescription() {
return array(
'Log in and get the authentication tokens.',
@ -263,37 +203,6 @@ class ApiLogin extends ApiBase {
);
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array(
'code' => 'NeedToken', 'info' => 'You need to resubmit your ' .
'login with the specified token. See ' .
'https://bugzilla.wikimedia.org/show_bug.cgi?id=23076'
),
array( 'code' => 'WrongToken', 'info' => 'You specified an invalid token' ),
array( 'code' => 'NoName', 'info' => 'You didn\'t set the lgname parameter' ),
array( 'code' => 'Illegal', 'info' => 'You provided an illegal username' ),
array( 'code' => 'NotExists', 'info' => 'The username you provided doesn\'t exist' ),
array(
'code' => 'EmptyPass',
'info' => 'You didn\'t set the lgpassword parameter or you left it empty'
),
array( 'code' => 'WrongPass', 'info' => 'The password you provided is incorrect' ),
array(
'code' => 'WrongPluginPass',
'info' => 'Same as "WrongPass", returned when an authentication ' .
'plugin rather than MediaWiki itself rejected the password'
),
array(
'code' => 'CreateBlocked',
'info' => 'The wiki tried to automatically create a new account ' .
'for you, but your IP address has been blocked from account creation'
),
array( 'code' => 'Throttled', 'info' => 'You\'ve logged in too many times in a short time' ),
array( 'code' => 'Blocked', 'info' => 'User is blocked' ),
) );
}
public function getExamples() {
return array(
'api.php?action=login&lgname=user&lgpassword=password'

View file

@ -50,10 +50,6 @@ class ApiLogout extends ApiBase {
return array();
}
public function getResultProperties() {
return array();
}
public function getParamDescription() {
return array();
}

View file

@ -1198,24 +1198,6 @@ class ApiMain extends ApiBase {
);
}
/**
* @return array
*/
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'readonlytext' ),
array( 'code' => 'unknown_format', 'info' => 'Unrecognized format: format' ),
array( 'code' => 'unknown_action', 'info' => 'The API requires a valid action parameter' ),
array( 'code' => 'maxlag', 'info' => 'Waiting for host: x seconds lagged' ),
array( 'code' => 'maxlag', 'info' => 'Waiting for a database server: x seconds lagged' ),
array( 'code' => 'assertuserfailed', 'info' => 'Assertion that the user is logged in failed' ),
array(
'code' => 'assertbotfailed',
'info' => 'Assertion that the user has the bot right failed'
),
) );
}
/**
* Returns an array of strings with credits for the API
* @return array

View file

@ -242,52 +242,10 @@ class ApiMove extends ApiBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'from' => 'string',
'to' => 'string',
'reason' => 'string',
'redirectcreated' => 'boolean',
'moveoverredirect' => 'boolean',
'talkfrom' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'talkto' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'talkmoveoverredirect' => 'boolean',
'talkmove-error-code' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'talkmove-error-info' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
)
);
}
public function getDescription() {
return 'Move a page.';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(),
$this->getRequireOnlyOneParameterErrorMessages( array( 'from', 'fromid' ) ),
array(
array( 'invalidtitle', 'from' ),
array( 'nosuchpageid', 'fromid' ),
array( 'notanarticle' ),
array( 'invalidtitle', 'to' ),
array( 'sharedfile-exists' ),
)
);
}
public function needsToken() {
return true;
}

View file

@ -157,18 +157,6 @@ class ApiOptions extends ApiBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'*' => array(
ApiBase::PROP_TYPE => array(
'success'
)
)
)
);
}
public function getParamDescription() {
return array(
'token' => 'An options token previously obtained through the action=tokens',
@ -194,13 +182,6 @@ class ApiOptions extends ApiBase {
);
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'code' => 'notloggedin', 'info' => 'Anonymous users cannot change preferences' ),
array( 'code' => 'nochanges', 'info' => 'No changes were requested' ),
) );
}
public function needsToken() {
return true;
}

View file

@ -1168,21 +1168,4 @@ class ApiPageSet extends ApiBase {
),
);
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array(
'code' => 'multisource',
'info' => "Cannot use 'pageids' at the same time as 'dataSource'"
),
array(
'code' => 'multisource',
'info' => "Cannot use 'revids' at the same time as 'dataSource'"
),
array(
'code' => 'badgenerator',
'info' => 'Module $generatorName cannot be used as a generator'
),
) );
}
}

View file

@ -244,66 +244,6 @@ class ApiParamInfo extends ApiBase {
}
$result->setIndexedTagName( $retval['parameters'], 'param' );
$props = $obj->getFinalResultProperties();
$listResult = null;
if ( $props !== false ) {
$retval['props'] = array();
foreach ( $props as $prop => $properties ) {
$propResult = array();
if ( $prop == ApiBase::PROP_LIST ) {
$listResult = $properties;
continue;
}
if ( $prop != ApiBase::PROP_ROOT ) {
$propResult['name'] = $prop;
}
$propResult['properties'] = array();
foreach ( $properties as $name => $p ) {
$propertyResult = array();
$propertyResult['name'] = $name;
if ( !is_array( $p ) ) {
$p = array( ApiBase::PROP_TYPE => $p );
}
$propertyResult['type'] = $p[ApiBase::PROP_TYPE];
if ( is_array( $propertyResult['type'] ) ) {
$propertyResult['type'] = array_values( $propertyResult['type'] );
$result->setIndexedTagName( $propertyResult['type'], 't' );
}
$nullable = null;
if ( isset( $p[ApiBase::PROP_NULLABLE] ) ) {
$nullable = $p[ApiBase::PROP_NULLABLE];
}
if ( $nullable === true ) {
$propertyResult['nullable'] = '';
}
$propResult['properties'][] = $propertyResult;
}
$result->setIndexedTagName( $propResult['properties'], 'property' );
$retval['props'][] = $propResult;
}
// default is true for query modules, false for other modules, overridden by ApiBase::PROP_LIST
if ( $listResult === true || ( $listResult !== false && $obj instanceof ApiQueryBase ) ) {
$retval['listresult'] = '';
}
$result->setIndexedTagName( $retval['props'], 'prop' );
}
// Errors
$retval['errors'] = $this->parseErrors( $obj->getFinalPossibleErrors() );
$result->setIndexedTagName( $retval['errors'], 'error' );
return $retval;
}

View file

@ -804,29 +804,6 @@ class ApiParse extends ApiBase {
);
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array(
'code' => 'params',
'info' => 'The page parameter cannot be used together with the text and title parameters'
),
array( 'code' => 'missingrev', 'info' => 'There is no revision ID oldid' ),
array(
'code' => 'permissiondenied',
'info' => 'You don\'t have permission to view deleted revisions'
),
array( 'code' => 'missingtitle', 'info' => 'The page you specified doesn\'t exist' ),
array( 'code' => 'nosuchsection', 'info' => 'There is no section sectionnumber in page' ),
array( 'nosuchpageid' ),
array( 'invalidtitle', 'title' ),
array( 'code' => 'parseerror', 'info' => 'Failed to parse the given text.' ),
array(
'code' => 'notwikitext',
'info' => 'The requested operation is only supported on wikitext content.'
),
) );
}
public function getExamples() {
return array(
'api.php?action=parse&page=Project:Sandbox' => 'Parse a page',

View file

@ -98,35 +98,10 @@ class ApiPatrol extends ApiBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'rcid' => 'integer',
'ns' => 'namespace',
'title' => 'string'
)
);
}
public function getDescription() {
return 'Patrol a page or revision.';
}
public function getPossibleErrors() {
return array_merge(
parent::getPossibleErrors(),
parent::getRequireOnlyOneParameterErrorMessages( array( 'rcid', 'revid' ) ),
array(
array( 'nosuchrcid', 'rcid' ),
array( 'nosuchrevid', 'revid' ),
array(
'code' => 'notpatrollable',
'info' => "The revision can't be patrolled as it's too old"
)
)
);
}
public function needsToken() {
return true;
}

View file

@ -200,35 +200,10 @@ class ApiProtect extends ApiBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'title' => 'string',
'reason' => 'string',
'cascade' => 'boolean'
)
);
}
public function getDescription() {
return 'Change the protection level of a page.';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(),
$this->getTitleOrPageIdErrorMessage(),
array(
array( 'toofewexpiries', 'noofexpiries', 'noofprotections' ),
array( 'create-titleexists' ),
array( 'missingtitle-createonly' ),
array( 'protect-invalidaction', 'action' ),
array( 'protect-invalidlevel', 'level' ),
array( 'invalidexpiry', 'expiry' ),
array( 'pastexpiry', 'expiry' ),
)
);
}
public function needsToken() {
return true;
}

View file

@ -152,52 +152,12 @@ class ApiPurge extends ApiBase {
);
}
public function getResultProperties() {
return array(
ApiBase::PROP_LIST => true,
'' => array(
'ns' => array(
ApiBase::PROP_TYPE => 'namespace',
ApiBase::PROP_NULLABLE => true
),
'title' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'pageid' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'revid' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'invalid' => 'boolean',
'special' => 'boolean',
'missing' => 'boolean',
'purged' => 'boolean',
'linkupdate' => 'boolean',
'iw' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
)
);
}
public function getDescription() {
return array( 'Purge the cache for the given titles.',
'Requires a POST request if the user is not logged in.'
);
}
public function getPossibleErrors() {
return array_merge(
parent::getPossibleErrors(),
$this->getPageSet()->getFinalPossibleErrors()
);
}
public function getExamples() {
return array(
'api.php?action=purge&titles=Main_Page|API' => 'Purge the "Main Page" and the "API" page',

View file

@ -620,13 +620,6 @@ class ApiQuery extends ApiBase {
);
}
public function getPossibleErrors() {
return array_merge(
parent::getPossibleErrors(),
$this->getPageSet()->getFinalPossibleErrors()
);
}
public function getExamples() {
return array(
'api.php?action=query&prop=revisions&meta=siteinfo&' .

View file

@ -207,23 +207,6 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'*' => 'string'
),
'size' => array(
'size' => 'integer',
'pages' => 'integer',
'files' => 'integer',
'subcats' => 'integer'
),
'hidden' => array(
'hidden' => 'boolean'
)
);
}
public function getDescription() {
return 'Enumerate all categories.';
}

View file

@ -393,76 +393,10 @@ class ApiQueryAllImages extends ApiQueryGeneratorBase {
private $propertyFilter = array( 'archivename', 'thumbmime', 'uploadwarning' );
public function getResultProperties() {
return array_merge(
array(
'' => array(
'name' => 'string',
'ns' => 'namespace',
'title' => 'string'
)
),
ApiQueryImageInfo::getResultPropertiesFiltered( $this->propertyFilter )
);
}
public function getDescription() {
return 'Enumerate all images sequentially.';
}
public function getPossibleErrors() {
$p = $this->getModulePrefix();
return array_merge( parent::getPossibleErrors(), array(
array(
'code' => 'params',
'info' => 'Use "gaifilterredir=nonredirects" option instead ' .
'of "redirects" when using allimages as a generator'
),
array(
'code' => 'badparams',
'info' => "Parameter'{$p}start' can only be used with {$p}sort=timestamp"
),
array(
'code' => 'badparams',
'info' => "Parameter'{$p}end' can only be used with {$p}sort=timestamp"
),
array(
'code' => 'badparams',
'info' => "Parameter'{$p}user' can only be used with {$p}sort=timestamp"
),
array(
'code' => 'badparams',
'info' => "Parameter'{$p}filterbots' can only be used with {$p}sort=timestamp"
),
array(
'code' => 'badparams',
'info' => "Parameter'{$p}from' can only be used with {$p}sort=name"
),
array(
'code' => 'badparams',
'info' => "Parameter'{$p}to' can only be used with {$p}sort=name"
),
array(
'code' => 'badparams',
'info' => "Parameter'{$p}prefix' can only be used with {$p}sort=name"
),
array(
'code' => 'badparams',
'info' => "Parameters '{$p}user' and '{$p}filterbots' cannot be used together"
),
array(
'code' => 'unsupportedrepo',
'info' => 'Local file repository does not support querying all images' ),
array( 'code' => 'mimesearchdisabled', 'info' => 'MIME search disabled in Miser Mode' ),
array( 'code' => 'invalidsha1hash', 'info' => 'The SHA1 hash provided is not valid' ),
array(
'code' => 'invalidsha1base36hash',
'info' => 'The SHA1Base36 hash provided is not valid'
),
) );
}
public function getExamples() {
return array(
'api.php?action=query&list=allimages&aifrom=B' => array(

View file

@ -334,34 +334,10 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
return $paramDescription;
}
public function getResultProperties() {
return array(
'ids' => array(
'fromid' => 'integer'
),
'title' => array(
'ns' => 'namespace',
'title' => 'string'
)
);
}
public function getDescription() {
return $this->description;
}
public function getPossibleErrors() {
$m = $this->getModuleName();
$what = $this->descriptionWhat;
return array_merge( parent::getPossibleErrors(), array(
array(
'code' => 'params',
'info' => "{$m} cannot return corresponding page ids in unique {$what}s mode"
),
) );
}
public function getExamples() {
$p = $this->getModulePrefix();
$name = $this->getModuleName();

View file

@ -256,33 +256,6 @@ class ApiQueryAllMessages extends ApiQueryBase {
);
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'code' => 'invalidlang', 'info' => 'Invalid language code for parameter lang' ),
) );
}
public function getResultProperties() {
return array(
'' => array(
'name' => 'string',
'customised' => 'boolean',
'missing' => 'boolean',
'*' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'default' => array(
'defaultmissing' => 'boolean',
'default' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
)
);
}
public function getDescription() {
return 'Return messages from this site.';
}

View file

@ -328,31 +328,10 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'pageid' => 'integer',
'ns' => 'namespace',
'title' => 'string'
)
);
}
public function getDescription() {
return 'Enumerate all pages sequentially in a given namespace.';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array(
'code' => 'params',
'info' => 'Use "gapfilterredir=nonredirects" option instead of ' .
'"redirects" when using allpages as a generator'
),
array( 'code' => 'params', 'info' => 'prlevel may not be used without prtype' ),
) );
}
public function getExamples() {
return array(
'api.php?action=query&list=allpages&apfrom=B' => array(

View file

@ -421,61 +421,10 @@ class ApiQueryAllUsers extends ApiQueryBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'userid' => 'integer',
'name' => 'string',
'recentactions' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
)
),
'blockinfo' => array(
'blockid' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'blockedby' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'blockedbyid' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'blockedreason' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'blockedexpiry' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'hidden' => 'boolean'
),
'editcount' => array(
'editcount' => 'integer'
),
'registration' => array(
'registration' => 'string'
)
);
}
public function getDescription() {
return 'Enumerate all registered users.';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array(
'code' => 'group-excludegroup',
'info' => 'group and excludegroup cannot be used together'
),
) );
}
public function getExamples() {
return array(
'api.php?action=query&list=allusers&aufrom=Y',

View file

@ -520,17 +520,6 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
) );
}
public function getResultProperties() {
return array(
'' => array(
'pageid' => 'integer',
'ns' => 'namespace',
'title' => 'string',
'redirect' => 'boolean'
)
);
}
public function getDescription() {
switch ( $this->getModuleName() ) {
case 'backlinks':
@ -544,18 +533,6 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
}
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(),
$this->getTitleOrPageIdErrorMessage(),
array(
array(
'code' => 'bad_image_title',
'info' => "The title for {$this->getModuleName()} query must be an image"
),
)
);
}
public function getExamples() {
static $examples = array(
'backlinks' => array(

View file

@ -591,19 +591,6 @@ abstract class ApiQueryBase extends ApiBase {
return preg_match( '/^[a-z0-9]{31}$/', $hash );
}
/**
* @return array
*/
public function getPossibleErrors() {
$errors = parent::getPossibleErrors();
$errors = array_merge( $errors, array(
array( 'invalidtitle', 'title' ),
array( 'invalidtitle', 'key' ),
) );
return $errors;
}
/**
* Check whether the current user has permission to view revision-deleted
* fields.

View file

@ -368,86 +368,10 @@ class ApiQueryBlocks extends ApiQueryBase {
);
}
public function getResultProperties() {
return array(
'id' => array(
'id' => 'integer'
),
'user' => array(
'user' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'userid' => array(
'userid' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
)
),
'by' => array(
'by' => 'string'
),
'byid' => array(
'byid' => 'integer'
),
'timestamp' => array(
'timestamp' => 'timestamp'
),
'expiry' => array(
'expiry' => 'timestamp'
),
'reason' => array(
'reason' => 'string'
),
'range' => array(
'rangestart' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'rangeend' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'flags' => array(
'automatic' => 'boolean',
'anononly' => 'boolean',
'nocreate' => 'boolean',
'autoblock' => 'boolean',
'noemail' => 'boolean',
'hidden' => 'boolean',
'allowusertalk' => 'boolean'
)
);
}
public function getDescription() {
return 'List all blocked users and IP addresses.';
}
public function getPossibleErrors() {
$blockCIDRLimit = $this->getConfig()->get( 'BlockCIDRLimit' );
return array_merge( parent::getPossibleErrors(),
$this->getRequireMaxOneParameterErrorMessages( array( 'users', 'ip' ) ),
array(
array(
'code' => 'cidrtoobroad',
'info' => "IPv4 CIDR ranges broader than /{$blockCIDRLimit['IPv4']} are not accepted"
),
array(
'code' => 'cidrtoobroad',
'info' => "IPv6 CIDR ranges broader than /{$blockCIDRLimit['IPv6']} are not accepted"
),
array( 'code' => 'param_ip', 'info' => 'IP parameter is not valid' ),
array( 'code' => 'param_user', 'info' => 'User parameter may not be empty' ),
array( 'code' => 'param_user', 'info' => 'User name user is not valid' ),
array( 'show' ),
)
);
}
public function getExamples() {
return array(
'api.php?action=query&list=blocks',

View file

@ -234,35 +234,10 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'ns' => 'namespace',
'title' => 'string'
),
'sortkey' => array(
'sortkey' => 'string',
'sortkeyprefix' => 'string'
),
'timestamp' => array(
'timestamp' => 'timestamp'
),
'hidden' => array(
'hidden' => 'boolean'
)
);
}
public function getDescription() {
return 'List all categories the page(s) belong to.';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'show' ),
) );
}
public function getExamples() {
return array(
'api.php?action=query&prop=categories&titles=Albert%20Einstein'

View file

@ -114,34 +114,6 @@ class ApiQueryCategoryInfo extends ApiQueryBase {
);
}
public function getResultProperties() {
return array(
ApiBase::PROP_LIST => false,
'' => array(
'size' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => false
),
'pages' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => false
),
'files' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => false
),
'subcats' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => false
),
'hidden' => array(
ApiBase::PROP_TYPE => 'boolean',
ApiBase::PROP_NULLABLE => false
)
)
);
}
public function getDescription() {
return 'Returns information about the given categories.';
}

View file

@ -384,49 +384,10 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
return $desc;
}
public function getResultProperties() {
return array(
'ids' => array(
'pageid' => 'integer'
),
'title' => array(
'ns' => 'namespace',
'title' => 'string'
),
'sortkey' => array(
'sortkey' => 'string'
),
'sortkeyprefix' => array(
'sortkeyprefix' => 'string'
),
'type' => array(
'type' => array(
ApiBase::PROP_TYPE => array(
'page',
'subcat',
'file'
)
)
),
'timestamp' => array(
'timestamp' => 'timestamp'
)
);
}
public function getDescription() {
return 'List all pages in a given category.';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(),
$this->getTitleOrPageIdErrorMessage(),
array(
array( 'code' => 'invalidcategory', 'info' => 'The category name you entered is not valid' ),
)
);
}
public function getExamples() {
return array(
'api.php?action=query&list=categorymembers&cmtitle=Category:Physics'

View file

@ -265,14 +265,6 @@ class ApiQueryContributors extends ApiQueryBase {
);
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(),
$this->getRequireMaxOneParameterErrorMessages(
array( 'group', 'excludegroup', 'rights', 'excluderights' )
)
);
}
public function getDescription() {
return 'Get the list of logged-in contributors and ' .
'the count of anonymous contributors to a page.';

View file

@ -505,18 +505,6 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'ns' => 'namespace',
'title' => 'string'
),
'token' => array(
'token' => 'string'
)
);
}
public function getDescription() {
$p = $this->getModulePrefix();
@ -532,29 +520,6 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
);
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array(
'code' => 'permissiondenied',
'info' => 'You don\'t have permission to view deleted revision information'
),
array( 'code' => 'badparams', 'info' => 'user and excludeuser cannot be used together'
),
array(
'code' => 'permissiondenied',
'info' => 'You don\'t have permission to view deleted revision content'
),
array( 'code' => 'badparams', 'info' => "The 'from' parameter cannot be used in modes 1 or 2" ),
array( 'code' => 'badparams', 'info' => "The 'to' parameter cannot be used in modes 1 or 2" ),
array(
'code' => 'badparams',
'info' => "The 'prefix' parameter cannot be used in modes 1 or 2"
),
array( 'code' => 'badparams', 'info' => "The 'start' parameter cannot be used in mode 3" ),
array( 'code' => 'badparams', 'info' => "The 'end' parameter cannot be used in mode 3" ),
) );
}
public function getExamples() {
return array(
'api.php?action=query&list=deletedrevs&titles=Main%20Page|Talk:Main%20Page&' .

View file

@ -188,17 +188,6 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'name' => 'string',
'user' => 'string',
'timestamp' => 'timestamp',
'shared' => 'boolean',
)
);
}
public function getDescription() {
return 'List all files that are duplicates of the given file(s) based on hash values.';
}

View file

@ -239,31 +239,10 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase {
return $desc;
}
public function getResultProperties() {
return array(
'ids' => array(
'pageid' => 'integer'
),
'title' => array(
'ns' => 'namespace',
'title' => 'string'
),
'url' => array(
'url' => 'string'
)
);
}
public function getDescription() {
return 'Enumerate pages that contain a given URL.';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'code' => 'bad_query', 'info' => 'Invalid query' ),
) );
}
public function getExamples() {
return array(
'api.php?action=query&list=exturlusage&euquery=www.mediawiki.org'

View file

@ -141,24 +141,10 @@ class ApiQueryExternalLinks extends ApiQueryBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'*' => 'string'
)
);
}
public function getDescription() {
return 'Returns all external URLs (not interwikis) from the given page(s).';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'code' => 'bad_query', 'info' => 'Invalid query' ),
) );
}
public function getExamples() {
return array(
'api.php?action=query&prop=extlinks&titles=Main%20Page'

View file

@ -315,89 +315,10 @@ class ApiQueryFilearchive extends ApiQueryBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'name' => 'string',
'ns' => 'namespace',
'title' => 'string',
'filehidden' => 'boolean',
'commenthidden' => 'boolean',
'userhidden' => 'boolean',
'suppressed' => 'boolean'
),
'sha1' => array(
'sha1' => 'string'
),
'timestamp' => array(
'timestamp' => 'timestamp'
),
'user' => array(
'userid' => 'integer',
'user' => 'string'
),
'size' => array(
'size' => 'integer',
'pagecount' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'height' => 'integer',
'width' => 'integer'
),
'dimensions' => array(
'size' => 'integer',
'pagecount' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'height' => 'integer',
'width' => 'integer'
),
'description' => array(
'description' => 'string'
),
'parseddescription' => array(
'description' => 'string',
'parseddescription' => 'string'
),
'metadata' => array(
'metadata' => 'string'
),
'bitdepth' => array(
'bitdepth' => 'integer'
),
'mime' => array(
'mime' => 'string'
),
'mediatype' => array(
'mediatype' => 'string'
),
'archivename' => array(
'archivename' => 'string'
),
);
}
public function getDescription() {
return 'Enumerate all deleted files sequentially.';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array(
'code' => 'permissiondenied',
'info' => 'You don\'t have permission to view deleted file information'
),
array( 'code' => 'hashsearchdisabled', 'info' => 'Search by hash disabled in Miser Mode' ),
array( 'code' => 'invalidsha1hash', 'info' => 'The SHA-1 hash provided is not valid' ),
array(
'code' => 'invalidsha1base36hash',
'info' => 'The SHA1Base36 hash provided is not valid'
),
) );
}
public function getExamples() {
return array(
'api.php?action=query&list=filearchive' => array(

View file

@ -210,23 +210,6 @@ class ApiQueryIWBacklinks extends ApiQueryGeneratorBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'pageid' => 'integer',
'ns' => 'namespace',
'title' => 'string',
'redirect' => 'boolean'
),
'iwprefix' => array(
'iwprefix' => 'string'
),
'iwtitle' => array(
'iwtitle' => 'string'
)
);
}
public function getDescription() {
return array( 'Find all pages that link to the given interwiki link.',
'Can be used to find all links with a prefix, or',
@ -235,12 +218,6 @@ class ApiQueryIWBacklinks extends ApiQueryGeneratorBase {
);
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'missingparam', 'prefix' ),
) );
}
public function getExamples() {
return array(
'api.php?action=query&list=iwbacklinks&iwbltitle=Test&iwblprefix=wikibooks',

View file

@ -171,29 +171,10 @@ class ApiQueryIWLinks extends ApiQueryBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'prefix' => 'string',
'url' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'*' => 'string'
)
);
}
public function getDescription() {
return 'Returns all interwiki links from the given page(s).';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'missingparam', 'prefix' ),
) );
}
public function getExamples() {
return array(
'api.php?action=query&prop=iwlinks&titles=Main%20Page'

View file

@ -739,151 +739,10 @@ class ApiQueryImageInfo extends ApiQueryBase {
);
}
public static function getResultPropertiesFiltered( $filter = array() ) {
$props = array(
'timestamp' => array(
'timestamp' => 'timestamp'
),
'user' => array(
'userhidden' => 'boolean',
'user' => 'string',
'anon' => 'boolean'
),
'userid' => array(
'userhidden' => 'boolean',
'userid' => 'integer',
'anon' => 'boolean'
),
'size' => array(
'size' => 'integer',
'width' => 'integer',
'height' => 'integer',
'pagecount' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
)
),
'dimensions' => array(
'size' => 'integer',
'width' => 'integer',
'height' => 'integer',
'pagecount' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
)
),
'comment' => array(
'commenthidden' => 'boolean',
'comment' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'parsedcomment' => array(
'commenthidden' => 'boolean',
'parsedcomment' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'canonicaltitle' => array(
'canonicaltitle' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'url' => array(
'filehidden' => 'boolean',
'thumburl' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'thumbwidth' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'thumbheight' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'thumberror' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'url' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'descriptionurl' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'sha1' => array(
'filehidden' => 'boolean',
'sha1' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'mime' => array(
'filehidden' => 'boolean',
'mime' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'thumbmime' => array(
'filehidden' => 'boolean',
'thumbmime' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'mediatype' => array(
'filehidden' => 'boolean',
'mediatype' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'archivename' => array(
'filehidden' => 'boolean',
'archivename' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'bitdepth' => array(
'filehidden' => 'boolean',
'bitdepth' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
)
),
);
return array_diff_key( $props, array_flip( $filter ) );
}
public function getResultProperties() {
return self::getResultPropertiesFiltered();
}
public function getDescription() {
return 'Returns image information and upload history.';
}
public function getPossibleErrors() {
$p = $this->getModulePrefix();
return array_merge( parent::getPossibleErrors(), array(
array( 'code' => "{$p}urlwidth", 'info' => "{$p}urlheight cannot be used without {$p}urlwidth" ),
array( 'code' => 'urlparam', 'info' => "Invalid value for {$p}urlparam" ),
array( 'code' => 'urlparam_no_width', 'info' => "{$p}urlparam requires {$p}urlwidth" ),
) );
}
public function getExamples() {
return array(
'api.php?action=query&titles=File:Albert%20Einstein%20Head.jpg&prop=imageinfo',

View file

@ -170,15 +170,6 @@ class ApiQueryImages extends ApiQueryGeneratorBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'ns' => 'namespace',
'title' => 'string'
)
);
}
public function getDescription() {
return 'Returns all images contained on the given page(s).';
}

View file

@ -812,72 +812,6 @@ class ApiQueryInfo extends ApiQueryBase {
);
}
public function getResultProperties() {
$props = array(
ApiBase::PROP_LIST => false,
'' => array(
'touched' => 'timestamp',
'lastrevid' => 'integer',
'counter' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'length' => 'integer',
'redirect' => 'boolean',
'new' => 'boolean',
'starttimestamp' => array(
ApiBase::PROP_TYPE => 'timestamp',
ApiBase::PROP_NULLABLE => true
),
'contentmodel' => 'string',
),
'watched' => array(
'watched' => 'boolean'
),
'watchers' => array(
'watchers' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
)
),
'notificationtimestamp' => array(
'notificationtimestamp' => array(
ApiBase::PROP_TYPE => 'timestamp',
ApiBase::PROP_NULLABLE => true
)
),
'talkid' => array(
'talkid' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
)
),
'subjectid' => array(
'subjectid' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
)
),
'url' => array(
'fullurl' => 'string',
'editurl' => 'string'
),
'readable' => array(
'readable' => 'boolean'
),
'preload' => array(
'preload' => 'string'
),
'displaytitle' => array(
'displaytitle' => 'string'
)
);
self::addTokenProperties( $props, $this->getTokenFunctions() );
return $props;
}
public function getDescription() {
return 'Get basic page information such as namespace, title, last touched date, ...';
}

View file

@ -209,23 +209,6 @@ class ApiQueryLangBacklinks extends ApiQueryGeneratorBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'pageid' => 'integer',
'ns' => 'namespace',
'title' => 'string',
'redirect' => 'boolean'
),
'lllang' => array(
'lllang' => 'string'
),
'lltitle' => array(
'lltitle' => 'string'
)
);
}
public function getDescription() {
return array( 'Find all pages that link to the given language link.',
'Can be used to find all links with a language code, or',
@ -235,12 +218,6 @@ class ApiQueryLangBacklinks extends ApiQueryGeneratorBase {
);
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'missingparam', 'lang' ),
) );
}
public function getExamples() {
return array(
'api.php?action=query&list=langbacklinks&lbltitle=Test&lbllang=fr',

View file

@ -191,42 +191,10 @@ class ApiQueryLangLinks extends ApiQueryBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'lang' => 'string',
'url' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'langname' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'autonym' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'*' => 'string'
)
);
}
public function getDescription() {
return 'Returns all interlanguage links from the given page(s).';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(),
$this->getRequireMaxOneParameterErrorMessages(
array( 'url', 'prop' )
),
array(
array( 'missingparam', 'lang' ),
)
);
}
public function getExamples() {
return array(
'api.php?action=query&prop=langlinks&titles=Main%20Page&redirects='

View file

@ -223,15 +223,6 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'ns' => 'namespace',
'title' => 'string'
)
);
}
public function getDescription() {
return "Returns all {$this->description}s from the given page(s).";
}

View file

@ -566,80 +566,10 @@ class ApiQueryLogEvents extends ApiQueryBase {
);
}
public function getResultProperties() {
return array(
'ids' => array(
'logid' => 'integer',
'pageid' => 'integer'
),
'title' => array(
'ns' => 'namespace',
'title' => 'string'
),
'type' => array(
'type' => array(
ApiBase::PROP_TYPE => $this->getConfig()->get( 'LogTypes' )
),
'action' => 'string'
),
'details' => array(
'actionhidden' => 'boolean'
),
'user' => array(
'userhidden' => 'boolean',
'user' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'anon' => 'boolean'
),
'userid' => array(
'userhidden' => 'boolean',
'userid' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'anon' => 'boolean'
),
'timestamp' => array(
'timestamp' => 'timestamp'
),
'comment' => array(
'commenthidden' => 'boolean',
'comment' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'parsedcomment' => array(
'commenthidden' => 'boolean',
'parsedcomment' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
)
);
}
public function getDescription() {
return 'Get events from logs.';
}
public function getPossibleErrors() {
return array_merge(
parent::getPossibleErrors(),
$this->getRequireMaxOneParameterErrorMessages(
array( 'title', 'prefix', 'namespace' ) ),
array(
array( 'code' => 'param_user', 'info' => 'User name $user not found' ),
array( 'code' => 'param_title', 'info' => 'Bad title value \'title\'' ),
array( 'code' => 'param_prefix', 'info' => 'Bad title value \'prefix\'' ),
array( 'code' => 'prefixsearchdisabled',
'info' => 'Prefix search disabled in Miser Mode' ),
)
);
}
public function getExamples() {
return array(
'api.php?action=query&list=logevents'

View file

@ -243,42 +243,6 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'ns' => 'namespace',
'title' => 'string'
),
'timestamp' => array(
'timestamp' => 'timestamp'
),
'user' => array(
'user' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'userid' => 'integer'
),
'userid' => array(
'userid' => 'integer'
),
'comment' => array(
'comment' => 'string'
),
'parsedcomment' => array(
'parsedcomment' => 'string'
),
'expiry' => array(
'expiry' => 'timestamp'
),
'level' => array(
'level' => array(
ApiBase::PROP_TYPE => array_diff( $this->getConfig()->get( 'RestrictionLevels' ), array( '' ) )
)
)
);
}
public function getDescription() {
return 'List all titles protected from creation.';
}

View file

@ -163,48 +163,10 @@ class ApiQueryQueryPage extends ApiQueryGeneratorBase {
);
}
public function getResultProperties() {
return array(
ApiBase::PROP_ROOT => array(
'name' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => false
),
'disabled' => array(
ApiBase::PROP_TYPE => 'boolean',
ApiBase::PROP_NULLABLE => false
),
'cached' => array(
ApiBase::PROP_TYPE => 'boolean',
ApiBase::PROP_NULLABLE => false
),
'cachedtimestamp' => array(
ApiBase::PROP_TYPE => 'timestamp',
ApiBase::PROP_NULLABLE => true
)
),
'' => array(
'value' => 'string',
'timestamp' => array(
ApiBase::PROP_TYPE => 'timestamp',
ApiBase::PROP_NULLABLE => true
),
'ns' => 'namespace',
'title' => 'string'
)
);
}
public function getDescription() {
return 'Get a list provided by a QueryPage-based special page.';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'specialpage-cantexecute' )
) );
}
public function getExamples() {
return array(
'api.php?action=query&list=querypage&qppage=Ancientpages'

View file

@ -173,16 +173,6 @@ class ApiQueryRandom extends ApiQueryGeneratorBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'id' => 'integer',
'ns' => 'namespace',
'title' => 'string'
)
);
}
public function getDescription() {
return array(
'Get a set of random pages.',

View file

@ -737,122 +737,10 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
);
}
public function getResultProperties() {
$props = array(
'' => array(
'type' => array(
ApiBase::PROP_TYPE => array(
'edit',
'new',
'move',
'log',
'move over redirect'
)
)
),
'title' => array(
'ns' => 'namespace',
'title' => 'string',
'new_ns' => array(
ApiBase::PROP_TYPE => 'namespace',
ApiBase::PROP_NULLABLE => true
),
'new_title' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'ids' => array(
'rcid' => 'integer',
'pageid' => 'integer',
'revid' => 'integer',
'old_revid' => 'integer'
),
'user' => array(
'user' => 'string',
'anon' => 'boolean'
),
'userid' => array(
'userid' => 'integer',
'anon' => 'boolean'
),
'flags' => array(
'bot' => 'boolean',
'new' => 'boolean',
'minor' => 'boolean'
),
'sizes' => array(
'oldlen' => 'integer',
'newlen' => 'integer'
),
'timestamp' => array(
'timestamp' => 'timestamp'
),
'comment' => array(
'comment' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'parsedcomment' => array(
'parsedcomment' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'redirect' => array(
'redirect' => 'boolean'
),
'patrolled' => array(
'patrolled' => 'boolean',
'unpatrolled' => 'boolean'
),
'loginfo' => array(
'logid' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'logtype' => array(
ApiBase::PROP_TYPE => $this->getConfig()->get( 'LogTypes' ),
ApiBase::PROP_NULLABLE => true
),
'logaction' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'sha1' => array(
'sha1' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'sha1hidden' => array(
ApiBase::PROP_TYPE => 'boolean',
ApiBase::PROP_NULLABLE => true
),
),
);
self::addTokenProperties( $props, $this->getTokenFunctions() );
return $props;
}
public function getDescription() {
return 'Enumerate recent changes.';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'show' ),
array(
'code' => 'permissiondenied',
'info' => 'You need the patrol right to request the patrolled flag'
),
array( 'code' => 'user-excludeuser', 'info' => 'user and excludeuser cannot be used together' ),
) );
}
public function getExamples() {
return array(
'api.php?action=query&list=recentchanges'

View file

@ -807,70 +807,6 @@ class ApiQueryRevisions extends ApiQueryBase {
);
}
public function getResultProperties() {
$props = array(
'' => array(),
'ids' => array(
'revid' => 'integer',
'parentid' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
)
),
'flags' => array(
'minor' => 'boolean'
),
'user' => array(
'userhidden' => 'boolean',
'user' => 'string',
'anon' => 'boolean'
),
'userid' => array(
'userhidden' => 'boolean',
'userid' => 'integer',
'anon' => 'boolean'
),
'timestamp' => array(
'timestamp' => 'timestamp'
),
'size' => array(
'size' => 'integer'
),
'sha1' => array(
'sha1' => 'string'
),
'comment' => array(
'commenthidden' => 'boolean',
'comment' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'parsedcomment' => array(
'commenthidden' => 'boolean',
'parsedcomment' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'content' => array(
'*' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'texthidden' => 'boolean',
'textmissing' => 'boolean',
),
'contentmodel' => array(
'contentmodel' => 'string'
),
);
self::addTokenProperties( $props, $this->getTokenFunctions() );
return $props;
}
public function getDescription() {
return array(
'Get revision information.',
@ -882,33 +818,6 @@ class ApiQueryRevisions extends ApiQueryBase {
);
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'nosuchrevid', 'diffto' ),
array(
'code' => 'revids',
'info' => 'The revids= parameter may not be used with the list options '
. '(limit, startid, endid, dirNewer, start, end).'
),
array(
'code' => 'multpages',
'info' => 'titles, pageids or a generator was used to supply multiple pages, '
. ' but the limit, startid, endid, dirNewer, user, excludeuser, '
. 'start and end parameters may only be used on a single page.'
),
array(
'code' => 'diffto',
'info' => 'rvdiffto must be set to a non-negative number, "prev", "next" or "cur"'
),
array( 'code' => 'badparams', 'info' => 'start and startid cannot be used together' ),
array( 'code' => 'badparams', 'info' => 'end and endid cannot be used together' ),
array( 'code' => 'badparams', 'info' => 'user and excludeuser cannot be used together' ),
array( 'code' => 'nosuchsection', 'info' => 'There is no section section in rID' ),
array( 'code' => 'badformat', 'info' => 'The requested serialization format can not be applied '
. ' to the page\'s content model' ),
) );
}
public function getExamples() {
return array(
'Get data with content for the last revision of titles "API" and "Main Page"',

View file

@ -354,75 +354,10 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
return $descriptions;
}
public function getResultProperties() {
return array(
'' => array(
'ns' => 'namespace',
'title' => 'string'
),
'snippet' => array(
'snippet' => 'string'
),
'size' => array(
'size' => 'integer'
),
'wordcount' => array(
'wordcount' => 'integer'
),
'timestamp' => array(
'timestamp' => 'timestamp'
),
'score' => array(
'score' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'titlesnippet' => array(
'titlesnippet' => 'string'
),
'redirecttitle' => array(
'redirecttitle' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'redirectsnippet' => array(
'redirectsnippet' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'sectiontitle' => array(
'sectiontitle' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'sectionsnippet' => array(
'sectionsnippet' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'hasrelated' => array(
'hasrelated' => 'boolean'
)
);
}
public function getDescription() {
return 'Perform a full text search.';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'code' => 'search-text-disabled', 'info' => 'text search is disabled' ),
array( 'code' => 'search-title-disabled', 'info' => 'title search is disabled' ),
array( 'code' => 'search-error', 'info' => 'search error has occurred' ),
) );
}
public function getExamples() {
return array(
'api.php?action=query&list=search&srsearch=meaning',

View file

@ -862,13 +862,6 @@ class ApiQuerySiteinfo extends ApiQueryBase {
return 'Return general information about the site.';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array( array(
'code' => 'includeAllDenied',
'info' => 'Cannot view all servers info unless $wgShowHostnames is true'
), ) );
}
public function getExamples() {
return array(
'api.php?action=query&meta=siteinfo&siprop=general|namespaces|namespacealiases|statistics',

View file

@ -124,10 +124,6 @@ class ApiQueryStashImageInfo extends ApiQueryImageInfo {
);
}
public function getResultProperties() {
return ApiQueryImageInfo::getResultPropertiesFiltered( $this->propertyFilter );
}
public function getDescription() {
return 'Returns image information for stashed images.';
}

View file

@ -170,23 +170,6 @@ class ApiQueryTags extends ApiQueryBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'name' => 'string'
),
'displayname' => array(
'displayname' => 'string'
),
'description' => array(
'description' => 'string'
),
'hitcount' => array(
'hitcount' => 'integer'
)
);
}
public function getDescription() {
return 'List change tags.';
}

View file

@ -555,81 +555,10 @@ class ApiQueryContributions extends ApiQueryBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'userid' => 'integer',
'user' => 'string',
'userhidden' => 'boolean'
),
'ids' => array(
'pageid' => 'integer',
'revid' => 'integer',
'parentid' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
)
),
'title' => array(
'ns' => 'namespace',
'title' => 'string'
),
'timestamp' => array(
'timestamp' => 'timestamp'
),
'flags' => array(
'new' => 'boolean',
'minor' => 'boolean',
'top' => 'boolean'
),
'comment' => array(
'commenthidden' => 'boolean',
'comment' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'parsedcomment' => array(
'commenthidden' => 'boolean',
'parsedcomment' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'patrolled' => array(
'patrolled' => 'boolean'
),
'size' => array(
'size' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
)
),
'sizediff' => array(
'sizediff' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
)
)
);
}
public function getDescription() {
return 'Get all edits by a user.';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'code' => 'param_user', 'info' => 'User parameter may not be empty.' ),
array( 'code' => 'param_user', 'info' => 'User name user is not valid' ),
array( 'show' ),
array(
'code' => 'permissiondenied',
'info' => 'You need the patrol right to request the patrolled flag'
),
) );
}
public function getExamples() {
return array(
'api.php?action=query&list=usercontribs&ucuser=YurikBot',

View file

@ -267,63 +267,6 @@ class ApiQueryUserInfo extends ApiQueryBase {
);
}
public function getResultProperties() {
return array(
ApiBase::PROP_LIST => false,
'' => array(
'id' => 'integer',
'name' => 'string',
'anon' => 'boolean'
),
'blockinfo' => array(
'blockid' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'blockedby' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'blockedbyid' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'blockedreason' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'hasmsg' => array(
'messages' => 'boolean'
),
'preferencestoken' => array(
'preferencestoken' => 'string'
),
'editcount' => array(
'editcount' => 'integer'
),
'realname' => array(
'realname' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'email' => array(
'email' => 'string',
'emailauthenticated' => array(
ApiBase::PROP_TYPE => 'timestamp',
ApiBase::PROP_NULLABLE => true
)
),
'registrationdate' => array(
'registrationdate' => array(
ApiBase::PROP_TYPE => 'timestamp',
ApiBase::PROP_NULLABLE => true
)
)
);
}
public function getDescription() {
return 'Get information about the current user.';
}

View file

@ -342,73 +342,6 @@ class ApiQueryUsers extends ApiQueryBase {
);
}
public function getResultProperties() {
$props = array(
'' => array(
'userid' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'name' => 'string',
'invalid' => 'boolean',
'hidden' => 'boolean',
'interwiki' => 'boolean',
'missing' => 'boolean'
),
'editcount' => array(
'editcount' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
)
),
'registration' => array(
'registration' => array(
ApiBase::PROP_TYPE => 'timestamp',
ApiBase::PROP_NULLABLE => true
)
),
'blockinfo' => array(
'blockid' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'blockedby' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'blockedbyid' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'blockedreason' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'blockedexpiry' => array(
ApiBase::PROP_TYPE => 'timestamp',
ApiBase::PROP_NULLABLE => true
)
),
'emailable' => array(
'emailable' => 'boolean'
),
'gender' => array(
'gender' => array(
ApiBase::PROP_TYPE => array(
'male',
'female',
'unknown'
),
ApiBase::PROP_NULLABLE => true
)
)
);
self::addTokenProperties( $props, $this->getTokenFunctions() );
return $props;
}
public function getDescription() {
return 'Get information about a list of users.';
}

View file

@ -561,109 +561,10 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'type' => array(
ApiBase::PROP_TYPE => array(
'edit',
'new',
'move',
'log',
'move over redirect'
)
)
),
'ids' => array(
'pageid' => 'integer',
'revid' => 'integer',
'old_revid' => 'integer'
),
'title' => array(
'ns' => 'namespace',
'title' => 'string'
),
'user' => array(
'user' => 'string',
'anon' => 'boolean'
),
'userid' => array(
'userid' => 'integer',
'anon' => 'boolean'
),
'flags' => array(
'new' => 'boolean',
'minor' => 'boolean',
'bot' => 'boolean'
),
'patrol' => array(
'patrolled' => 'boolean'
),
'timestamp' => array(
'timestamp' => 'timestamp'
),
'sizes' => array(
'oldlen' => 'integer',
'newlen' => 'integer'
),
'notificationtimestamp' => array(
'notificationtimestamp' => array(
ApiBase::PROP_TYPE => 'timestamp',
ApiBase::PROP_NULLABLE => true
)
),
'comment' => array(
'comment' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'parsedcomment' => array(
'parsedcomment' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
),
'loginfo' => array(
'logid' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'logtype' => array(
ApiBase::PROP_TYPE => $this->getConfig()->get( 'LogTypes' ),
ApiBase::PROP_NULLABLE => true
),
'logaction' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
)
);
}
public function getDescription() {
return "Get all recent changes to pages in the logged in user's watchlist.";
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'code' => 'bad_wlowner', 'info' => 'Specified user does not exist' ),
array(
'code' => 'bad_wltoken',
'info' => 'Incorrect watchlist token provided -- ' .
'please set a correct token in Special:Preferences'
),
array( 'code' => 'notloggedin', 'info' => 'You must be logged-in to have a watchlist' ),
array( 'code' => 'patrol', 'info' => 'patrol property is not available' ),
array( 'show' ),
array(
'code' => 'permissiondenied',
'info' => 'You need the patrol right to request the patrolled flag'
),
array( 'code' => 'user-excludeuser', 'info' => 'user and excludeuser cannot be used together' ),
) );
}
public function getExamples() {
return array(
'api.php?action=query&list=watchlist',

View file

@ -189,38 +189,10 @@ class ApiQueryWatchlistRaw extends ApiQueryGeneratorBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'ns' => 'namespace',
'title' => 'string'
),
'changed' => array(
'changed' => array(
ApiBase::PROP_TYPE => 'timestamp',
ApiBase::PROP_NULLABLE => true
)
)
);
}
public function getDescription() {
return "Get all pages on the logged in user's watchlist.";
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'code' => 'notloggedin', 'info' => 'You must be logged-in to have a watchlist' ),
array( 'show' ),
array( 'code' => 'bad_wlowner', 'info' => 'Specified user does not exist' ),
array(
'code' => 'bad_wltoken',
'info' => 'Incorrect watchlist token provided -- ' .
'please set a correct token in Special:Preferences'
),
) );
}
public function getExamples() {
return array(
'api.php?action=query&list=watchlistraw',

View file

@ -220,16 +220,6 @@ class ApiRevisionDelete extends ApiBase {
return 'Delete/undelete revisions.';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(),
array(
array( 'code' => 'needtarget',
'info' => 'A target title is required for this RevDel type' ),
array( 'code' => 'badparams', 'info' => 'Bad value for some parameter' ),
)
);
}
public function needsToken() {
return true;
}

View file

@ -134,19 +134,6 @@ class ApiRollback extends ApiBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'title' => 'string',
'pageid' => 'integer',
'summary' => 'string',
'revid' => 'integer',
'old_revid' => 'integer',
'last_revid' => 'integer'
)
);
}
public function getDescription() {
return array(
'Undo the last edit to the page. If the last user who edited the page made',
@ -154,19 +141,6 @@ class ApiRollback extends ApiBase {
);
}
public function getPossibleErrors() {
return array_merge(
parent::getPossibleErrors(),
$this->getRequireOnlyOneParameterErrorMessages( array( 'title', 'pageid' ) ),
array(
array( 'invalidtitle', 'title' ),
array( 'notanarticle' ),
array( 'nosuchpageid', 'pageid' ),
array( 'invaliduser', 'user' ),
)
);
}
public function needsToken() {
return true;
}

View file

@ -244,43 +244,6 @@ class ApiSetNotificationTimestamp extends ApiBase {
);
}
public function getResultProperties() {
return array(
ApiBase::PROP_LIST => true,
ApiBase::PROP_ROOT => array(
'notificationtimestamp' => array(
ApiBase::PROP_TYPE => 'timestamp',
ApiBase::PROP_NULLABLE => true
)
),
'' => array(
'ns' => array(
ApiBase::PROP_TYPE => 'namespace',
ApiBase::PROP_NULLABLE => true
),
'title' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'pageid' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'revid' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'invalid' => 'boolean',
'missing' => 'boolean',
'notwatched' => 'boolean',
'notificationtimestamp' => array(
ApiBase::PROP_TYPE => 'timestamp',
ApiBase::PROP_NULLABLE => true
)
)
);
}
public function getDescription() {
return array( 'Update the notification timestamp for watched pages.',
'This affects the highlighting of changed pages in the watchlist and history,',
@ -289,25 +252,6 @@ class ApiSetNotificationTimestamp extends ApiBase {
);
}
public function getPossibleErrors() {
$ps = $this->getPageSet();
return array_merge(
parent::getPossibleErrors(),
$ps->getFinalPossibleErrors(),
$this->getRequireMaxOneParameterErrorMessages(
array( 'timestamp', 'torevid', 'newerthanrevid' ) ),
$this->getRequireOnlyOneParameterErrorMessages(
array_merge( array( 'entirewatchlist' ), array_keys( $ps->getFinalParams() ) ) ),
array(
array( 'code' => 'notloggedin', 'info'
=> 'Anonymous users cannot use watchlist change notifications' ),
array( 'code' => 'multpages', 'info' => 'torevid may only be used with a single page' ),
array( 'code' => 'multpages', 'info' => 'newerthanrevid may only be used with a single page' ),
)
);
}
public function getExamples() {
return array(
'api.php?action=setnotificationtimestamp&entirewatchlist=&token=123ABC'

View file

@ -81,16 +81,6 @@ class ApiTokens extends ApiBase {
);
}
public function getResultProperties() {
$props = array(
'' => array(),
);
self::addTokenProperties( $props, $this->getTokenTypes() );
return $props;
}
public function getParamDescription() {
return array(
'type' => 'Type of token(s) to request'

View file

@ -107,43 +107,10 @@ class ApiUnblock extends ApiBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'id' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'user' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'userid' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'reason' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
)
);
}
public function getDescription() {
return 'Unblock a user.';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'unblock-notarget' ),
array( 'unblock-idanduser' ),
array( 'cantunblock' ),
array( 'ipbblocked' ),
array( 'ipbnounblockself' ),
) );
}
public function needsToken() {
return true;
}

View file

@ -142,17 +142,6 @@ class ApiUndelete extends ApiBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'title' => 'string',
'revisions' => 'integer',
'filerevisions' => 'integer',
'reason' => 'string'
)
);
}
public function getDescription() {
return array(
'Restore certain revisions of a deleted page. A list of deleted revisions ',
@ -161,15 +150,6 @@ class ApiUndelete extends ApiBase {
);
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'permdenied-undelete' ),
array( 'blockedtext' ),
array( 'invalidtitle', 'title' ),
array( 'cannotundelete' ),
) );
}
public function needsToken() {
return true;
}

View file

@ -760,41 +760,6 @@ class ApiUpload extends ApiBase {
return $params;
}
public function getResultProperties() {
return array(
'' => array(
'result' => array(
ApiBase::PROP_TYPE => array(
'Success',
'Warning',
'Continue',
'Queued'
),
),
'filekey' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'sessionkey' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'offset' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
),
'statuskey' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
'filename' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
)
)
);
}
public function getDescription() {
return array(
'Upload a file, or get the status of pending uploads. Several methods are available:',
@ -806,32 +771,6 @@ class ApiUpload extends ApiBase {
);
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(),
$this->getRequireOnlyOneParameterErrorMessages( array( 'filekey', 'file', 'url', 'statuskey' ) ),
array(
array( 'uploaddisabled' ),
array( 'invalid-file-key' ),
array( 'uploaddisabled' ),
array( 'mustbeloggedin', 'upload' ),
array( 'badaccess-groups' ),
array( 'code' => 'fetchfileerror', 'info' => '' ),
array( 'code' => 'nomodule', 'info' => 'No upload module set' ),
array( 'code' => 'empty-file', 'info' => 'The file you submitted was empty' ),
array( 'code' => 'filetype-missing', 'info' => 'The file is missing an extension' ),
array( 'code' => 'filename-tooshort', 'info' => 'The filename is too short' ),
array( 'code' => 'overwrite', 'info' => 'Overwriting an existing file is not allowed' ),
array( 'code' => 'stashfailed', 'info' => 'Stashing temporary file failed' ),
array( 'code' => 'publishfailed', 'info' => 'Publishing of stashed file failed' ),
array( 'code' => 'internal-error', 'info' => 'An internal error occurred' ),
array( 'code' => 'asynccopyuploaddisabled', 'info' => 'Asynchronous copy uploads disabled' ),
array( 'code' => 'stasherror', 'info' => 'An upload stash error occurred' ),
array( 'fileexists-forbidden' ),
array( 'fileexists-shared-forbidden' ),
)
);
}
public function needsToken() {
return true;
}

View file

@ -205,29 +205,10 @@ class ApiWatch extends ApiBase {
);
}
public function getResultProperties() {
return array(
'' => array(
'title' => 'string',
'unwatched' => 'boolean',
'watched' => 'boolean',
'message' => 'string'
)
);
}
public function getDescription() {
return 'Add or remove pages from/to the current user\'s watchlist.';
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'code' => 'notloggedin', 'info' => 'You must be logged-in to have a watchlist' ),
array( 'invalidtitle', 'title' ),
array( 'hookaborted' ),
) );
}
public function getExamples() {
return array(
'api.php?action=watch&titles=Main_Page' => 'Watch the page "Main Page"',