2008-01-28 19:05:26 +00:00
|
|
|
<?php
|
2010-02-23 18:05:46 +00:00
|
|
|
/**
|
2010-12-22 20:52:06 +00:00
|
|
|
*
|
2008-01-28 19:05:26 +00:00
|
|
|
*
|
2010-08-07 19:59:42 +00:00
|
|
|
* Created on Dec 01, 2007
|
|
|
|
|
*
|
2012-07-15 20:13:02 +00:00
|
|
|
* Copyright © 2008 Roan Kattouw "<Firstname>.<Lastname>@gmail.com"
|
2008-01-28 19:05:26 +00:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
2010-06-21 13:13:32 +00:00
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2008-01-28 19:05:26 +00:00
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
2010-08-07 19:59:42 +00:00
|
|
|
*
|
|
|
|
|
* @file
|
2008-01-28 19:05:26 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
* @ingroup API
|
2008-01-28 19:05:26 +00:00
|
|
|
*/
|
|
|
|
|
class ApiParamInfo extends ApiBase {
|
|
|
|
|
|
2011-09-16 18:11:47 +00:00
|
|
|
/**
|
|
|
|
|
* @var ApiQuery
|
|
|
|
|
*/
|
|
|
|
|
protected $queryObj;
|
|
|
|
|
|
2010-01-11 15:55:52 +00:00
|
|
|
public function __construct( $main, $action ) {
|
2010-02-23 18:05:46 +00:00
|
|
|
parent::__construct( $main, $action );
|
2011-09-16 18:11:47 +00:00
|
|
|
$this->queryObj = new ApiQuery( $this->getMain(), 'query' );
|
2008-01-28 19:05:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function execute() {
|
|
|
|
|
// Get parameters
|
|
|
|
|
$params = $this->extractRequestParams();
|
|
|
|
|
$result = $this->getResult();
|
2011-09-16 18:11:47 +00:00
|
|
|
|
2011-09-16 18:28:24 +00:00
|
|
|
$res = array();
|
2010-02-23 18:05:46 +00:00
|
|
|
if ( is_array( $params['modules'] ) ) {
|
2011-09-16 18:28:24 +00:00
|
|
|
$modules = $this->getMain()->getModules();
|
|
|
|
|
$res['modules'] = array();
|
|
|
|
|
foreach ( $params['modules'] as $mod ) {
|
|
|
|
|
if ( !isset( $modules[$mod] ) ) {
|
|
|
|
|
$res['modules'][] = array( 'name' => $mod, 'missing' => '' );
|
2008-01-28 19:05:26 +00:00
|
|
|
continue;
|
|
|
|
|
}
|
2011-09-16 18:28:24 +00:00
|
|
|
$obj = new $modules[$mod]( $this->getMain(), $mod );
|
|
|
|
|
|
|
|
|
|
$item = $this->getClassInfo( $obj );
|
|
|
|
|
$item['name'] = $mod;
|
|
|
|
|
$res['modules'][] = $item;
|
2008-01-28 19:05:26 +00:00
|
|
|
}
|
2011-09-16 18:28:24 +00:00
|
|
|
$result->setIndexedTagName( $res['modules'], 'module' );
|
2008-01-28 19:05:26 +00:00
|
|
|
}
|
2011-09-16 18:28:24 +00:00
|
|
|
|
2010-02-23 18:05:46 +00:00
|
|
|
if ( is_array( $params['querymodules'] ) ) {
|
2011-09-16 18:28:24 +00:00
|
|
|
$queryModules = $this->queryObj->getModules();
|
|
|
|
|
$res['querymodules'] = array();
|
2010-02-23 18:05:46 +00:00
|
|
|
foreach ( $params['querymodules'] as $qm ) {
|
2011-09-16 18:28:24 +00:00
|
|
|
if ( !isset( $queryModules[$qm] ) ) {
|
|
|
|
|
$res['querymodules'][] = array( 'name' => $qm, 'missing' => '' );
|
2008-01-28 19:05:26 +00:00
|
|
|
continue;
|
|
|
|
|
}
|
2011-09-16 18:28:24 +00:00
|
|
|
$obj = new $queryModules[$qm]( $this, $qm );
|
|
|
|
|
$item = $this->getClassInfo( $obj );
|
|
|
|
|
$item['name'] = $qm;
|
|
|
|
|
$item['querytype'] = $this->queryObj->getModuleType( $qm );
|
|
|
|
|
$res['querymodules'][] = $item;
|
2008-01-28 19:05:26 +00:00
|
|
|
}
|
2011-09-16 18:28:24 +00:00
|
|
|
$result->setIndexedTagName( $res['querymodules'], 'module' );
|
2008-01-28 19:05:26 +00:00
|
|
|
}
|
2011-09-16 18:28:24 +00:00
|
|
|
|
2010-02-23 18:05:46 +00:00
|
|
|
if ( $params['mainmodule'] ) {
|
2011-09-16 18:28:24 +00:00
|
|
|
$res['mainmodule'] = $this->getClassInfo( $this->getMain() );
|
2010-02-23 18:05:46 +00:00
|
|
|
}
|
2011-09-16 18:28:24 +00:00
|
|
|
|
2010-02-23 18:05:46 +00:00
|
|
|
if ( $params['pagesetmodule'] ) {
|
2011-09-16 18:11:47 +00:00
|
|
|
$pageSet = new ApiPageSet( $this->queryObj );
|
2011-09-16 18:28:24 +00:00
|
|
|
$res['pagesetmodule'] = $this->getClassInfo( $pageSet );
|
2009-02-14 14:56:20 +00:00
|
|
|
}
|
2011-09-16 18:28:24 +00:00
|
|
|
|
2011-09-16 18:25:02 +00:00
|
|
|
if ( is_array( $params['formatmodules'] ) ) {
|
|
|
|
|
$formats = $this->getMain()->getFormats();
|
2011-09-16 18:28:24 +00:00
|
|
|
$res['formatmodules'] = array();
|
2011-09-16 18:25:02 +00:00
|
|
|
foreach ( $params['formatmodules'] as $f ) {
|
|
|
|
|
if ( !isset( $formats[$f] ) ) {
|
2011-09-16 18:28:24 +00:00
|
|
|
$res['formatmodules'][] = array( 'name' => $f, 'missing' => '' );
|
2011-09-16 18:25:02 +00:00
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
$obj = new $formats[$f]( $this, $f );
|
2011-09-16 18:28:24 +00:00
|
|
|
$item = $this->getClassInfo( $obj );
|
|
|
|
|
$item['name'] = $f;
|
|
|
|
|
$res['formatmodules'][] = $item;
|
2011-09-16 18:25:02 +00:00
|
|
|
}
|
2011-09-16 18:28:24 +00:00
|
|
|
$result->setIndexedTagName( $res['formatmodules'], 'module' );
|
2011-09-16 18:25:02 +00:00
|
|
|
}
|
2011-09-16 18:28:24 +00:00
|
|
|
$result->addValue( null, $this->getModuleName(), $res );
|
2008-01-28 19:05:26 +00:00
|
|
|
}
|
|
|
|
|
|
2010-12-23 20:00:02 +00:00
|
|
|
/**
|
2011-05-08 21:47:01 +00:00
|
|
|
* @param $obj ApiBase
|
2010-12-23 20:00:02 +00:00
|
|
|
* @return ApiResult
|
|
|
|
|
*/
|
2010-02-23 18:05:46 +00:00
|
|
|
function getClassInfo( $obj ) {
|
2008-01-28 19:05:26 +00:00
|
|
|
$result = $this->getResult();
|
2010-01-11 15:55:52 +00:00
|
|
|
$retval['classname'] = get_class( $obj );
|
2011-11-28 15:33:28 +00:00
|
|
|
$retval['description'] = implode( "\n", (array)$obj->getFinalDescription() );
|
2011-12-27 16:22:35 +00:00
|
|
|
|
|
|
|
|
$retval['examples'] = '';
|
|
|
|
|
|
2010-01-11 15:55:52 +00:00
|
|
|
$retval['version'] = implode( "\n", (array)$obj->getVersion() );
|
2008-01-28 19:05:26 +00:00
|
|
|
$retval['prefix'] = $obj->getModulePrefix();
|
2010-02-11 01:13:45 +00:00
|
|
|
|
2010-02-23 18:05:46 +00:00
|
|
|
if ( $obj->isReadMode() ) {
|
2009-03-06 13:49:44 +00:00
|
|
|
$retval['readrights'] = '';
|
2010-02-23 18:05:46 +00:00
|
|
|
}
|
|
|
|
|
if ( $obj->isWriteMode() ) {
|
2009-03-06 13:49:44 +00:00
|
|
|
$retval['writerights'] = '';
|
2010-02-23 18:05:46 +00:00
|
|
|
}
|
|
|
|
|
if ( $obj->mustBePosted() ) {
|
2009-03-06 13:49:44 +00:00
|
|
|
$retval['mustbeposted'] = '';
|
2010-02-23 18:05:46 +00:00
|
|
|
}
|
|
|
|
|
if ( $obj instanceof ApiQueryGeneratorBase ) {
|
2009-05-10 09:52:31 +00:00
|
|
|
$retval['generator'] = '';
|
2010-02-23 18:05:46 +00:00
|
|
|
}
|
2010-02-11 01:13:45 +00:00
|
|
|
|
2008-09-07 19:04:51 +00:00
|
|
|
$allowedParams = $obj->getFinalParams();
|
2010-02-23 18:05:46 +00:00
|
|
|
if ( !is_array( $allowedParams ) ) {
|
2008-01-28 19:05:26 +00:00
|
|
|
return $retval;
|
2010-02-23 18:05:46 +00:00
|
|
|
}
|
|
|
|
|
|
2011-07-17 17:09:51 +00:00
|
|
|
$retval['helpurls'] = (array)$obj->getHelpUrls();
|
2011-08-14 09:37:23 +00:00
|
|
|
if ( isset( $retval['helpurls'][0] ) && $retval['helpurls'][0] === false ) {
|
|
|
|
|
$retval['helpurls'] = array();
|
|
|
|
|
}
|
2011-07-17 17:09:51 +00:00
|
|
|
$result->setIndexedTagName( $retval['helpurls'], 'helpurl' );
|
|
|
|
|
|
2011-12-27 16:22:35 +00:00
|
|
|
$examples = $obj->getExamples();
|
|
|
|
|
$retval['allexamples'] = array();
|
|
|
|
|
if ( $examples !== false ) {
|
2012-02-24 02:06:39 +00:00
|
|
|
if ( is_string( $examples ) ) {
|
|
|
|
|
$examples = array( $examples );
|
|
|
|
|
}
|
2011-12-27 16:22:35 +00:00
|
|
|
foreach( $examples as $k => $v ) {
|
|
|
|
|
if ( strlen( $retval['examples'] ) ) {
|
|
|
|
|
$retval['examples'] .= ' ';
|
|
|
|
|
}
|
|
|
|
|
$item = array();
|
|
|
|
|
if ( is_numeric( $k ) ) {
|
|
|
|
|
$retval['examples'] .= $v;
|
|
|
|
|
$result->setContent( $item, $v );
|
|
|
|
|
} else {
|
|
|
|
|
if ( !is_array( $v ) ) {
|
|
|
|
|
$item['description'] = $v;
|
|
|
|
|
} else {
|
|
|
|
|
$item['description'] = implode( $v, "\n" );
|
|
|
|
|
}
|
|
|
|
|
$retval['examples'] .= $item['description'] . ' ' . $k;
|
|
|
|
|
$result->setContent( $item, $k );
|
|
|
|
|
}
|
|
|
|
|
$retval['allexamples'][] = $item;
|
|
|
|
|
}
|
2011-08-15 18:56:37 +00:00
|
|
|
}
|
2011-07-18 13:19:46 +00:00
|
|
|
$result->setIndexedTagName( $retval['allexamples'], 'example' );
|
|
|
|
|
|
2008-01-28 19:05:26 +00:00
|
|
|
$retval['parameters'] = array();
|
2008-09-07 19:04:51 +00:00
|
|
|
$paramDesc = $obj->getFinalParamDescription();
|
2010-02-23 18:05:46 +00:00
|
|
|
foreach ( $allowedParams as $n => $p ) {
|
2010-01-11 15:55:52 +00:00
|
|
|
$a = array( 'name' => $n );
|
2010-02-23 18:05:46 +00:00
|
|
|
if ( isset( $paramDesc[$n] ) ) {
|
2010-01-11 15:55:52 +00:00
|
|
|
$a['description'] = implode( "\n", (array)$paramDesc[$n] );
|
2010-02-23 18:05:46 +00:00
|
|
|
}
|
2011-04-10 13:01:47 +00:00
|
|
|
|
|
|
|
|
//handle shorthand
|
|
|
|
|
if( !is_array( $p ) ) {
|
|
|
|
|
$p = array(
|
|
|
|
|
ApiBase::PARAM_DFLT => $p,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//handle missing type
|
|
|
|
|
if ( !isset( $p[ApiBase::PARAM_TYPE] ) ) {
|
2011-04-25 22:56:08 +00:00
|
|
|
$dflt = isset( $p[ApiBase::PARAM_DFLT] ) ? $p[ApiBase::PARAM_DFLT] : null;
|
2011-04-10 13:01:47 +00:00
|
|
|
if ( is_bool( $dflt ) ) {
|
2011-06-05 21:56:27 +00:00
|
|
|
$p[ApiBase::PARAM_TYPE] = 'boolean';
|
2011-04-10 13:01:47 +00:00
|
|
|
} elseif ( is_string( $dflt ) || is_null( $dflt ) ) {
|
|
|
|
|
$p[ApiBase::PARAM_TYPE] = 'string';
|
|
|
|
|
} elseif ( is_int( $dflt ) ) {
|
|
|
|
|
$p[ApiBase::PARAM_TYPE] = 'integer';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-02-23 18:05:46 +00:00
|
|
|
if ( isset( $p[ApiBase::PARAM_DEPRECATED] ) && $p[ApiBase::PARAM_DEPRECATED] ) {
|
2010-01-05 10:50:07 +00:00
|
|
|
$a['deprecated'] = '';
|
2010-02-23 18:05:46 +00:00
|
|
|
}
|
2010-08-06 11:18:39 +00:00
|
|
|
if ( isset( $p[ApiBase::PARAM_REQUIRED] ) && $p[ApiBase::PARAM_REQUIRED] ) {
|
|
|
|
|
$a['required'] = '';
|
|
|
|
|
}
|
2010-10-01 19:37:38 +00:00
|
|
|
|
2010-02-23 18:05:46 +00:00
|
|
|
if ( isset( $p[ApiBase::PARAM_DFLT] ) ) {
|
2011-04-10 13:01:47 +00:00
|
|
|
$type = $p[ApiBase::PARAM_TYPE];
|
2011-06-05 21:56:27 +00:00
|
|
|
if( $type === 'boolean' ) {
|
2011-04-10 13:01:47 +00:00
|
|
|
$a['default'] = ( $p[ApiBase::PARAM_DFLT] ? 'true' : 'false' );
|
|
|
|
|
} elseif( $type === 'string' ) {
|
|
|
|
|
$a['default'] = strval( $p[ApiBase::PARAM_DFLT] );
|
|
|
|
|
} elseif( $type === 'integer' ) {
|
|
|
|
|
$a['default'] = intval( $p[ApiBase::PARAM_DFLT] );
|
|
|
|
|
} else {
|
|
|
|
|
$a['default'] = $p[ApiBase::PARAM_DFLT];
|
|
|
|
|
}
|
2010-02-23 18:05:46 +00:00
|
|
|
}
|
2010-08-06 11:20:39 +00:00
|
|
|
if ( isset( $p[ApiBase::PARAM_ISMULTI] ) && $p[ApiBase::PARAM_ISMULTI] ) {
|
|
|
|
|
$a['multi'] = '';
|
2011-04-29 21:46:17 +00:00
|
|
|
$a['limit'] = $this->getMain()->canApiHighLimits() ?
|
|
|
|
|
ApiBase::LIMIT_SML2 :
|
|
|
|
|
ApiBase::LIMIT_SML1;
|
|
|
|
|
$a['lowlimit'] = ApiBase::LIMIT_SML1;
|
2011-04-29 20:52:57 +00:00
|
|
|
$a['highlimit'] = ApiBase::LIMIT_SML2;
|
2010-02-23 18:05:46 +00:00
|
|
|
}
|
2010-01-23 22:47:49 +00:00
|
|
|
|
2010-08-06 11:20:39 +00:00
|
|
|
if ( isset( $p[ApiBase::PARAM_ALLOW_DUPLICATES] ) && $p[ApiBase::PARAM_ALLOW_DUPLICATES] ) {
|
|
|
|
|
$a['allowsduplicates'] = '';
|
2010-02-23 18:05:46 +00:00
|
|
|
}
|
2010-01-23 22:47:49 +00:00
|
|
|
|
2010-02-23 18:05:46 +00:00
|
|
|
if ( isset( $p[ApiBase::PARAM_TYPE] ) ) {
|
2008-01-28 19:05:26 +00:00
|
|
|
$a['type'] = $p[ApiBase::PARAM_TYPE];
|
2010-02-23 18:05:46 +00:00
|
|
|
if ( is_array( $a['type'] ) ) {
|
2011-04-26 19:20:19 +00:00
|
|
|
$a['type'] = array_values( $a['type'] ); // to prevent sparse arrays from being serialized to JSON as objects
|
2010-01-11 15:55:52 +00:00
|
|
|
$result->setIndexedTagName( $a['type'], 't' );
|
2010-02-23 18:05:46 +00:00
|
|
|
}
|
2008-01-28 19:05:26 +00:00
|
|
|
}
|
2010-02-23 18:05:46 +00:00
|
|
|
if ( isset( $p[ApiBase::PARAM_MAX] ) ) {
|
2008-01-28 19:05:26 +00:00
|
|
|
$a['max'] = $p[ApiBase::PARAM_MAX];
|
2010-02-23 18:05:46 +00:00
|
|
|
}
|
|
|
|
|
if ( isset( $p[ApiBase::PARAM_MAX2] ) ) {
|
2008-01-28 19:05:26 +00:00
|
|
|
$a['highmax'] = $p[ApiBase::PARAM_MAX2];
|
2010-02-23 18:05:46 +00:00
|
|
|
}
|
|
|
|
|
if ( isset( $p[ApiBase::PARAM_MIN] ) ) {
|
2008-01-28 19:05:26 +00:00
|
|
|
$a['min'] = $p[ApiBase::PARAM_MIN];
|
2010-02-23 18:05:46 +00:00
|
|
|
}
|
2008-01-28 19:05:26 +00:00
|
|
|
$retval['parameters'][] = $a;
|
|
|
|
|
}
|
2010-01-11 15:55:52 +00:00
|
|
|
$result->setIndexedTagName( $retval['parameters'], 'param' );
|
2010-02-23 18:05:46 +00:00
|
|
|
|
Added result properties to action=paraminfo
Added information about the properties of the results of API calls
to action=paraminfo, including information about "property groups":
what should the prop parameter be set to to get that property.
Uses the same format for types as parameters already do.
The output format of some modules doesn't fit this, so the result
properties for them weren't added, or only partially.
Partially implemented modules:
* expandtemplates:
parsetree is in its own tag
* protect, allusers, backlinks, deletedrevs, info, imageinfo,
logevents, querypage, recentchanges, revisions, searchinfo,
usercontribs, userinfo, users, watchlist, upload:
response with partially complex structure
Not implemented modules:
* feedcontributions, feedwatchlist, opensearch, rds:
non-standard reponse
* help:
error is normal response; not very useful for automated tools anyway
* paraminfo, parse, pageprops, siteinfo, userrights:
response with complex structure
Change-Id: Iff2a9bef79f994e73eef3062b4dd5461bff968ab
2012-05-02 15:00:30 +00:00
|
|
|
$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, overriden by ApiBase::PROP_LIST
|
|
|
|
|
if ( $listResult === true || ( $listResult !== false && $obj instanceof ApiQueryBase ) ) {
|
|
|
|
|
$retval['listresult'] = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$result->setIndexedTagName( $retval['props'], 'prop' );
|
|
|
|
|
}
|
|
|
|
|
|
2010-02-11 21:34:35 +00:00
|
|
|
// Errors
|
2010-02-11 22:22:20 +00:00
|
|
|
$retval['errors'] = $this->parseErrors( $obj->getPossibleErrors() );
|
2010-02-11 01:13:45 +00:00
|
|
|
$result->setIndexedTagName( $retval['errors'], 'error' );
|
2010-02-23 18:05:46 +00:00
|
|
|
|
2008-01-28 19:05:26 +00:00
|
|
|
return $retval;
|
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2009-03-06 13:49:44 +00:00
|
|
|
public function isReadMode() {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2008-01-28 19:05:26 +00:00
|
|
|
public function getAllowedParams() {
|
2011-12-20 07:50:45 +00:00
|
|
|
$modules = array_keys( $this->getMain()->getModules() );
|
|
|
|
|
sort( $modules );
|
|
|
|
|
$querymodules = array_keys( $this->queryObj->getModules() );
|
|
|
|
|
sort( $querymodules );
|
|
|
|
|
$formatmodules = array_keys( $this->getMain()->getFormats() );
|
|
|
|
|
sort( $formatmodules );
|
2010-02-23 18:05:46 +00:00
|
|
|
return array(
|
2008-01-28 19:05:26 +00:00
|
|
|
'modules' => array(
|
2011-09-16 18:11:47 +00:00
|
|
|
ApiBase::PARAM_ISMULTI => true,
|
2011-12-20 07:50:45 +00:00
|
|
|
ApiBase::PARAM_TYPE => $modules,
|
2008-01-28 19:05:26 +00:00
|
|
|
),
|
|
|
|
|
'querymodules' => array(
|
2011-09-16 18:11:47 +00:00
|
|
|
ApiBase::PARAM_ISMULTI => true,
|
2011-12-20 07:50:45 +00:00
|
|
|
ApiBase::PARAM_TYPE => $querymodules,
|
2009-02-14 14:56:20 +00:00
|
|
|
),
|
|
|
|
|
'mainmodule' => false,
|
|
|
|
|
'pagesetmodule' => false,
|
2011-09-16 18:25:02 +00:00
|
|
|
'formatmodules' => array(
|
|
|
|
|
ApiBase::PARAM_ISMULTI => true,
|
2011-12-20 07:50:45 +00:00
|
|
|
ApiBase::PARAM_TYPE => $formatmodules,
|
2011-09-16 18:25:02 +00:00
|
|
|
)
|
2008-01-28 19:05:26 +00:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getParamDescription() {
|
2010-02-23 18:05:46 +00:00
|
|
|
return array(
|
2008-01-28 19:05:26 +00:00
|
|
|
'modules' => 'List of module names (value of the action= parameter)',
|
|
|
|
|
'querymodules' => 'List of query module names (value of prop=, meta= or list= parameter)',
|
2009-02-14 14:56:20 +00:00
|
|
|
'mainmodule' => 'Get information about the main (top-level) module as well',
|
|
|
|
|
'pagesetmodule' => 'Get information about the pageset module (providing titles= and friends) as well',
|
2011-09-16 18:25:02 +00:00
|
|
|
'formatmodules' => 'List of format module names (value of format= parameter)',
|
2008-01-28 19:05:26 +00:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getDescription() {
|
2010-04-24 11:58:52 +00:00
|
|
|
return 'Obtain information about certain API parameters and errors';
|
2008-01-28 19:05:26 +00:00
|
|
|
}
|
|
|
|
|
|
2011-08-17 22:24:21 +00:00
|
|
|
public function getExamples() {
|
2010-02-23 18:05:46 +00:00
|
|
|
return array(
|
2008-01-28 19:05:26 +00:00
|
|
|
'api.php?action=paraminfo&modules=parse&querymodules=allpages|siteinfo'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-17 16:23:29 +00:00
|
|
|
public function getHelpUrls() {
|
2011-11-28 15:43:11 +00:00
|
|
|
return 'https://www.mediawiki.org/wiki/API:Parameter_information';
|
2011-07-17 16:18:09 +00:00
|
|
|
}
|
|
|
|
|
|
2008-01-28 19:05:26 +00:00
|
|
|
public function getVersion() {
|
2008-03-03 19:34:11 +00:00
|
|
|
return __CLASS__ . ': $Id$';
|
2008-01-28 19:05:26 +00:00
|
|
|
}
|
|
|
|
|
}
|