From 19358606a17e4361594b65e6b93577e79e9c66a6 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Mon, 28 Jan 2008 19:05:26 +0000 Subject: [PATCH] API: Changing all modules' getParamDescription(), getAllowedParams() and getDescription() methods to public. ApiParamInfo needs them, and some versions of PHP threw fatal errors because they were protected. Oddly, other versions didn't (maybe because the caller and the callee have a common ancestor?) --- includes/api/ApiBlock.php | 6 +- includes/api/ApiChangeRights.php | 6 +- includes/api/ApiDelete.php | 6 +- includes/api/ApiExpandTemplates.php | 6 +- includes/api/ApiFeedWatchlist.php | 6 +- includes/api/ApiFormatBase.php | 2 +- includes/api/ApiFormatDbg.php | 118 ++++---- includes/api/ApiFormatJson.php | 6 +- includes/api/ApiFormatPhp.php | 2 +- includes/api/ApiFormatTxt.php | 118 ++++---- includes/api/ApiFormatWddx.php | 2 +- includes/api/ApiFormatXml.php | 2 +- includes/api/ApiFormatYaml.php | 2 +- includes/api/ApiHelp.php | 2 +- includes/api/ApiLogin.php | 6 +- includes/api/ApiLogout.php | 6 +- includes/api/ApiMain.php | 6 +- includes/api/ApiMove.php | 6 +- includes/api/ApiOpenSearch.php | 6 +- includes/api/ApiParamInfo.php | 334 ++++++++++----------- includes/api/ApiParse.php | 6 +- includes/api/ApiProtect.php | 6 +- includes/api/ApiQuery.php | 6 +- includes/api/ApiQueryAllCategories.php | 6 +- includes/api/ApiQueryAllLinks.php | 6 +- includes/api/ApiQueryAllUsers.php | 6 +- includes/api/ApiQueryAllmessages.php | 6 +- includes/api/ApiQueryAllpages.php | 6 +- includes/api/ApiQueryBacklinks.php | 6 +- includes/api/ApiQueryBlocks.php | 6 +- includes/api/ApiQueryCategories.php | 6 +- includes/api/ApiQueryCategoryMembers.php | 6 +- includes/api/ApiQueryDeletedrevs.php | 6 +- includes/api/ApiQueryExtLinksUsage.php | 6 +- includes/api/ApiQueryExternalLinks.php | 2 +- includes/api/ApiQueryImageInfo.php | 6 +- includes/api/ApiQueryImages.php | 2 +- includes/api/ApiQueryInfo.php | 6 +- includes/api/ApiQueryLangLinks.php | 2 +- includes/api/ApiQueryLinks.php | 6 +- includes/api/ApiQueryLogEvents.php | 6 +- includes/api/ApiQueryRandom.php | 258 ++++++++-------- includes/api/ApiQueryRecentChanges.php | 6 +- includes/api/ApiQueryRevisions.php | 6 +- includes/api/ApiQuerySearch.php | 6 +- includes/api/ApiQuerySiteinfo.php | 6 +- includes/api/ApiQueryUserContributions.php | 6 +- includes/api/ApiQueryUserInfo.php | 6 +- includes/api/ApiQueryUsers.php | 324 ++++++++++---------- includes/api/ApiQueryWatchlist.php | 6 +- includes/api/ApiRollback.php | 6 +- includes/api/ApiUnblock.php | 6 +- includes/api/ApiUndelete.php | 6 +- 53 files changed, 702 insertions(+), 702 deletions(-) diff --git a/includes/api/ApiBlock.php b/includes/api/ApiBlock.php index 43103d047b..5d6b161244 100644 --- a/includes/api/ApiBlock.php +++ b/includes/api/ApiBlock.php @@ -115,7 +115,7 @@ class ApiBlock extends ApiBase { public function mustBePosted() { return true; } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'user' => null, 'token' => null, @@ -130,7 +130,7 @@ class ApiBlock extends ApiBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'user' => 'Username, IP address or IP range you want to block', 'token' => 'A block token previously obtained through the gettoken parameter', @@ -145,7 +145,7 @@ class ApiBlock extends ApiBase { ); } - protected function getDescription() { + public function getDescription() { return array( 'Block a user.' ); diff --git a/includes/api/ApiChangeRights.php b/includes/api/ApiChangeRights.php index f51bc04b38..647a51943b 100644 --- a/includes/api/ApiChangeRights.php +++ b/includes/api/ApiChangeRights.php @@ -108,7 +108,7 @@ class ApiChangeRights extends ApiBase { $this->getResult()->addValue(null, $this->getModuleName(), $res); } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'user' => null, 'token' => null, @@ -124,7 +124,7 @@ class ApiChangeRights extends ApiBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'user' => 'The user you want to add to or remove from groups.', 'token' => 'A changerights token previously obtained through the gettoken parameter.', @@ -136,7 +136,7 @@ class ApiChangeRights extends ApiBase { ); } - protected function getDescription() { + public function getDescription() { return array( 'Add or remove a user from certain groups.' ); diff --git a/includes/api/ApiDelete.php b/includes/api/ApiDelete.php index 1ae5876d70..a80a43a2c3 100644 --- a/includes/api/ApiDelete.php +++ b/includes/api/ApiDelete.php @@ -120,7 +120,7 @@ class ApiDelete extends ApiBase { public function mustBePosted() { return true; } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'title' => null, 'token' => null, @@ -128,7 +128,7 @@ class ApiDelete extends ApiBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'title' => 'Title of the page you want to delete.', 'token' => 'A delete token previously retrieved through prop=info', @@ -136,7 +136,7 @@ class ApiDelete extends ApiBase { ); } - protected function getDescription() { + public function getDescription() { return array( 'Deletes a page. You need to be logged in as a sysop to use this function, see also action=login.' ); diff --git a/includes/api/ApiExpandTemplates.php b/includes/api/ApiExpandTemplates.php index 9d8a7af40e..6d8381018d 100644 --- a/includes/api/ApiExpandTemplates.php +++ b/includes/api/ApiExpandTemplates.php @@ -64,7 +64,7 @@ class ApiExpandTemplates extends ApiBase { $result->addValue( null, $this->getModuleName(), $retval_array ); } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'title' => array( ApiBase :: PARAM_DFLT => 'API', @@ -73,14 +73,14 @@ class ApiExpandTemplates extends ApiBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'text' => 'Wikitext to convert', 'title' => 'Title of page', ); } - protected function getDescription() { + public function getDescription() { return 'This module expand all templates in wikitext'; } diff --git a/includes/api/ApiFeedWatchlist.php b/includes/api/ApiFeedWatchlist.php index 8c7bf81bc5..96a5a8a62f 100644 --- a/includes/api/ApiFeedWatchlist.php +++ b/includes/api/ApiFeedWatchlist.php @@ -138,7 +138,7 @@ class ApiFeedWatchlist extends ApiBase { return new FeedItem($titleStr, $completeText, $titleUrl, $timestamp, $user); } - protected function getAllowedParams() { + public function getAllowedParams() { global $wgFeedClasses; $feedFormatNames = array_keys($wgFeedClasses); return array ( @@ -156,7 +156,7 @@ class ApiFeedWatchlist extends ApiBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'feedformat' => 'The format of the feed', 'hours' => 'List pages modified within this many hours from now', @@ -164,7 +164,7 @@ class ApiFeedWatchlist extends ApiBase { ); } - protected function getDescription() { + public function getDescription() { return 'This module returns a watchlist feed'; } diff --git a/includes/api/ApiFormatBase.php b/includes/api/ApiFormatBase.php index 78b319832d..4bc06e2dea 100644 --- a/includes/api/ApiFormatBase.php +++ b/includes/api/ApiFormatBase.php @@ -215,7 +215,7 @@ See complete documentation, or return 'api.php?action=query&meta=siteinfo&siprop=namespaces&format=' . $this->getModuleName(); } - protected function getDescription() { + public function getDescription() { return $this->getIsHtml() ? ' (pretty-print in HTML)' : ''; } diff --git a/includes/api/ApiFormatDbg.php b/includes/api/ApiFormatDbg.php index e4bfbdb384..f0fc5e9193 100644 --- a/includes/api/ApiFormatDbg.php +++ b/includes/api/ApiFormatDbg.php @@ -1,59 +1,59 @@ -.@home.nl - * - * 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., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * http://www.gnu.org/copyleft/gpl.html - */ - -if (!defined('MEDIAWIKI')) { - // Eclipse helper - will be ignored in production - require_once ('ApiFormatBase.php'); -} - -/** - * @addtogroup API - */ -class ApiFormatDbg extends ApiFormatBase { - - public function __construct($main, $format) { - parent :: __construct($main, $format); - } - - public function getMimeType() { - # This looks like it should be text/plain, but IE7 is so - # brain-damaged it tries to parse text/plain as HTML if it - # contains HTML tags. Using MIME text/text works around this bug - return 'text/text'; - } - - public function execute() { - $this->printText(var_export($this->getResultData(), true)); - } - - protected function getDescription() { - return 'Output data in PHP\'s var_export() format' . parent :: getDescription(); - } - - public function getVersion() { - return __CLASS__ . ': $Id: ApiFormatPhp.php 23531 2007-06-29 01:19:14Z simetrical $'; - } -} - +.@home.nl + * + * 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., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * http://www.gnu.org/copyleft/gpl.html + */ + +if (!defined('MEDIAWIKI')) { + // Eclipse helper - will be ignored in production + require_once ('ApiFormatBase.php'); +} + +/** + * @addtogroup API + */ +class ApiFormatDbg extends ApiFormatBase { + + public function __construct($main, $format) { + parent :: __construct($main, $format); + } + + public function getMimeType() { + # This looks like it should be text/plain, but IE7 is so + # brain-damaged it tries to parse text/plain as HTML if it + # contains HTML tags. Using MIME text/text works around this bug + return 'text/text'; + } + + public function execute() { + $this->printText(var_export($this->getResultData(), true)); + } + + public function getDescription() { + return 'Output data in PHP\'s var_export() format' . parent :: getDescription(); + } + + public function getVersion() { + return __CLASS__ . ': $Id: ApiFormatPhp.php 23531 2007-06-29 01:19:14Z simetrical $'; + } +} + diff --git a/includes/api/ApiFormatJson.php b/includes/api/ApiFormatJson.php index 23fbb1e122..eae68fb389 100644 --- a/includes/api/ApiFormatJson.php +++ b/includes/api/ApiFormatJson.php @@ -66,19 +66,19 @@ class ApiFormatJson extends ApiFormatBase { } } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'callback' => null ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'callback' => 'If specified, wraps the output into a given function call', ); } - protected function getDescription() { + public function getDescription() { if ($this->mIsRaw) return 'Output data with the debuging elements in JSON format' . parent :: getDescription(); else diff --git a/includes/api/ApiFormatPhp.php b/includes/api/ApiFormatPhp.php index 043cab5a49..c4f36e12da 100644 --- a/includes/api/ApiFormatPhp.php +++ b/includes/api/ApiFormatPhp.php @@ -45,7 +45,7 @@ class ApiFormatPhp extends ApiFormatBase { $this->printText(serialize($this->getResultData())); } - protected function getDescription() { + public function getDescription() { return 'Output data in serialized PHP format' . parent :: getDescription(); } diff --git a/includes/api/ApiFormatTxt.php b/includes/api/ApiFormatTxt.php index 38d136452a..c4c45f68c3 100644 --- a/includes/api/ApiFormatTxt.php +++ b/includes/api/ApiFormatTxt.php @@ -1,59 +1,59 @@ -.@home.nl - * - * 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., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * http://www.gnu.org/copyleft/gpl.html - */ - -if (!defined('MEDIAWIKI')) { - // Eclipse helper - will be ignored in production - require_once ('ApiFormatBase.php'); -} - -/** - * @addtogroup API - */ -class ApiFormatTxt extends ApiFormatBase { - - public function __construct($main, $format) { - parent :: __construct($main, $format); - } - - public function getMimeType() { - # This looks like it should be text/plain, but IE7 is so - # brain-damaged it tries to parse text/plain as HTML if it - # contains HTML tags. Using MIME text/text works around this bug - return 'text/text'; - } - - public function execute() { - $this->printText(print_r($this->getResultData(), true)); - } - - protected function getDescription() { - return 'Output data in PHP\'s print_r() format' . parent :: getDescription(); - } - - public function getVersion() { - return __CLASS__ . ': $Id: ApiFormatPhp.php 23531 2007-06-29 01:19:14Z simetrical $'; - } -} - +.@home.nl + * + * 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., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * http://www.gnu.org/copyleft/gpl.html + */ + +if (!defined('MEDIAWIKI')) { + // Eclipse helper - will be ignored in production + require_once ('ApiFormatBase.php'); +} + +/** + * @addtogroup API + */ +class ApiFormatTxt extends ApiFormatBase { + + public function __construct($main, $format) { + parent :: __construct($main, $format); + } + + public function getMimeType() { + # This looks like it should be text/plain, but IE7 is so + # brain-damaged it tries to parse text/plain as HTML if it + # contains HTML tags. Using MIME text/text works around this bug + return 'text/text'; + } + + public function execute() { + $this->printText(print_r($this->getResultData(), true)); + } + + public function getDescription() { + return 'Output data in PHP\'s print_r() format' . parent :: getDescription(); + } + + public function getVersion() { + return __CLASS__ . ': $Id: ApiFormatPhp.php 23531 2007-06-29 01:19:14Z simetrical $'; + } +} + diff --git a/includes/api/ApiFormatWddx.php b/includes/api/ApiFormatWddx.php index 344fd4a551..5c5cff43d4 100644 --- a/includes/api/ApiFormatWddx.php +++ b/includes/api/ApiFormatWddx.php @@ -80,7 +80,7 @@ class ApiFormatWddx extends ApiFormatBase { } } - protected function getDescription() { + public function getDescription() { return 'Output data in WDDX format' . parent :: getDescription(); } diff --git a/includes/api/ApiFormatXml.php b/includes/api/ApiFormatXml.php index c811444f0f..165e2c371f 100644 --- a/includes/api/ApiFormatXml.php +++ b/includes/api/ApiFormatXml.php @@ -136,7 +136,7 @@ class ApiFormatXml extends ApiFormatBase { break; } } - protected function getDescription() { + public function getDescription() { return 'Output data in XML format' . parent :: getDescription(); } diff --git a/includes/api/ApiFormatYaml.php b/includes/api/ApiFormatYaml.php index d8c110b25f..66486fe335 100644 --- a/includes/api/ApiFormatYaml.php +++ b/includes/api/ApiFormatYaml.php @@ -45,7 +45,7 @@ class ApiFormatYaml extends ApiFormatBase { $this->printText(Spyc :: YAMLDump($this->getResultData())); } - protected function getDescription() { + public function getDescription() { return 'Output data in YAML format' . parent :: getDescription(); } diff --git a/includes/api/ApiHelp.php b/includes/api/ApiHelp.php index 21150a6d11..1ee58d3f28 100644 --- a/includes/api/ApiHelp.php +++ b/includes/api/ApiHelp.php @@ -50,7 +50,7 @@ class ApiHelp extends ApiBase { return false; } - protected function getDescription() { + public function getDescription() { return array ( 'Display this help screen.' ); diff --git a/includes/api/ApiLogin.php b/includes/api/ApiLogin.php index 54a8a5d731..d124556f94 100644 --- a/includes/api/ApiLogin.php +++ b/includes/api/ApiLogin.php @@ -220,7 +220,7 @@ class ApiLogin extends ApiBase { public function mustBePosted() { return true; } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'name' => null, 'password' => null, @@ -228,7 +228,7 @@ class ApiLogin extends ApiBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'name' => 'User Name', 'password' => 'Password', @@ -236,7 +236,7 @@ class ApiLogin extends ApiBase { ); } - protected function getDescription() { + public function getDescription() { return array ( 'This module is used to login and get the authentication tokens. ', 'In the event of a successful log-in, a cookie will be attached', diff --git a/includes/api/ApiLogout.php b/includes/api/ApiLogout.php index 6b09e8f7c1..d578acf33e 100644 --- a/includes/api/ApiLogout.php +++ b/includes/api/ApiLogout.php @@ -45,15 +45,15 @@ class ApiLogout extends ApiBase { $wgUser->logout(); } - protected function getAllowedParams() { + public function getAllowedParams() { return array (); } - protected function getParamDescription() { + public function getParamDescription() { return array (); } - protected function getDescription() { + public function getDescription() { return array ( 'This module is used to logout and clear session data' ); diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index fed2f3662c..2d630b80aa 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -377,7 +377,7 @@ class ApiMain extends ApiBase { /** * See ApiBase for description. */ - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'format' => array ( ApiBase :: PARAM_DFLT => ApiMain :: API_DEFAULT_FORMAT, @@ -397,7 +397,7 @@ class ApiMain extends ApiBase { /** * See ApiBase for description. */ - protected function getParamDescription() { + public function getParamDescription() { return array ( 'format' => 'The format of the output', 'action' => 'What action you would like to perform', @@ -409,7 +409,7 @@ class ApiMain extends ApiBase { /** * See ApiBase for description. */ - protected function getDescription() { + public function getDescription() { return array ( '', '', diff --git a/includes/api/ApiMove.php b/includes/api/ApiMove.php index 0c219d34e4..2c63efed04 100644 --- a/includes/api/ApiMove.php +++ b/includes/api/ApiMove.php @@ -112,7 +112,7 @@ class ApiMove extends ApiBase { public function mustBePosted() { return true; } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'from' => null, 'to' => null, @@ -123,7 +123,7 @@ class ApiMove extends ApiBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'from' => 'Title of the page you want to move.', 'to' => 'Title you want to rename the page to.', @@ -134,7 +134,7 @@ class ApiMove extends ApiBase { ); } - protected function getDescription() { + public function getDescription() { return array( 'Moves a page.' ); diff --git a/includes/api/ApiOpenSearch.php b/includes/api/ApiOpenSearch.php index 7ecf922ec2..bfeb2a5b32 100644 --- a/includes/api/ApiOpenSearch.php +++ b/includes/api/ApiOpenSearch.php @@ -82,7 +82,7 @@ class ApiOpenSearch extends ApiBase { $result->addValue(null, 1, $srchres); } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'search' => null, 'limit' => array ( @@ -95,14 +95,14 @@ class ApiOpenSearch extends ApiBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'search' => 'Search string', 'limit' => 'Maximum amount of results to return' ); } - protected function getDescription() { + public function getDescription() { return 'This module implements OpenSearch protocol'; } diff --git a/includes/api/ApiParamInfo.php b/includes/api/ApiParamInfo.php index 563c20f514..7de2225200 100644 --- a/includes/api/ApiParamInfo.php +++ b/includes/api/ApiParamInfo.php @@ -1,167 +1,167 @@ -.@home.nl - * - * 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., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * http://www.gnu.org/copyleft/gpl.html - */ - -if (!defined('MEDIAWIKI')) { - // Eclipse helper - will be ignored in production - require_once ("ApiBase.php"); -} - -/** - * @addtogroup API - */ -class ApiParamInfo extends ApiBase { - - public function __construct($main, $action) { - parent :: __construct($main, $action); - } - - public function execute() { - // Get parameters - $params = $this->extractRequestParams(); - $result = $this->getResult(); - $r = array(); - if(is_array($params['modules'])) - { - $modArr = $this->getMain()->getModules(); - foreach($params['modules'] as $m) - { - if(!isset($modArr[$m])) - { - $r['modules'][] = array('name' => $m, 'missing' => ''); - continue; - } - $obj = new $modArr[$m]($this->getMain(), $m); - $a = $this->getClassInfo($obj); - $a['name'] = $m; - $r['modules'][] = $a; - } - $result->setIndexedTagName($r['modules'], 'module'); - } - if(is_array($params['querymodules'])) - { - $queryObj = new ApiQuery($this->getMain(), 'query'); - $qmodArr = $queryObj->getModules(); - foreach($params['querymodules'] as $qm) - { - if(!isset($qmodArr[$qm])) - { - $r['querymodules'][] = array('name' => $qm, 'missing' => ''); - continue; - } - $obj = new $qmodArr[$qm]($this, $qm); - $a = $this->getClassInfo($obj); - $a['name'] = $qm; - $r['querymodules'][] = $a; - } - $result->setIndexedTagName($r['querymodules'], 'module'); - } - $result->addValue(null, $this->getModuleName(), $r); - } - - function getClassInfo($obj) - { - $result = $this->getResult(); - $retval['classname'] = get_class($obj); - $retval['description'] = (is_array($obj->getDescription()) ? implode("\n", $obj->getDescription()) : $obj->getDescription()); - $retval['prefix'] = $obj->getModulePrefix(); - $allowedParams = $obj->getAllowedParams(); - if(!is_array($allowedParams)) - return $retval; - $retval['parameters'] = array(); - $paramDesc = $obj->getParamDescription(); - foreach($obj->getAllowedParams() as $n => $p) - { - $a = array('name' => $n); - if(!is_array($p)) - { - if(is_bool($p)) - { - $a['type'] = 'bool'; - $a['default'] = ($p ? 'true' : 'false'); - } - if(is_string($p)) - $a['default'] = $p; - $retval['parameters'][] = $a; - continue; - } - - if(isset($p[ApiBase::PARAM_DFLT])) - $a['default'] = $p[ApiBase::PARAM_DFLT]; - if(isset($p[ApiBase::PARAM_ISMULTI])) - if($p[ApiBase::PARAM_ISMULTI]) - $a['multi'] = ''; - if(isset($p[ApiBase::PARAM_TYPE])) - { - $a['type'] = $p[ApiBase::PARAM_TYPE]; - if(is_array($a['type'])) - $result->setIndexedTagName($a['type'], 't'); - } - if(isset($p[ApiBase::PARAM_MAX])) - $a['max'] = $p[ApiBase::PARAM_MAX]; - if(isset($p[ApiBase::PARAM_MAX2])) - $a['highmax'] = $p[ApiBase::PARAM_MAX2]; - if(isset($p[ApiBase::PARAM_MIN])) - $a['min'] = $p[ApiBase::PARAM_MIN]; - if(isset($paramDesc[$n])) - $a['description'] = (is_array($paramDesc[$n]) ? implode("\n", $paramDesc[$n]) : $paramDesc[$n]); - $retval['parameters'][] = $a; - } - $result->setIndexedTagName($retval['parameters'], 'param'); - return $retval; - } - - protected function getAllowedParams() { - return array ( - 'modules' => array( - ApiBase :: PARAM_ISMULTI => true - ), - 'querymodules' => array( - ApiBase :: PARAM_ISMULTI => true - ) - ); - } - - protected function getParamDescription() { - return array ( - 'modules' => 'List of module names (value of the action= parameter)', - 'querymodules' => 'List of query module names (value of prop=, meta= or list= parameter)', - ); - } - - protected function getDescription() { - return 'Obtain information about certain API parameters'; - } - - protected function getExamples() { - return array ( - 'api.php?action=paraminfo&modules=parse&querymodules=allpages|siteinfo' - ); - } - - public function getVersion() { - return __CLASS__ . ': $Id: ApiParse.php 29810 2008-01-15 21:33:08Z catrope $'; - } -} - +.@home.nl + * + * 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., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * http://www.gnu.org/copyleft/gpl.html + */ + +if (!defined('MEDIAWIKI')) { + // Eclipse helper - will be ignored in production + require_once ("ApiBase.php"); +} + +/** + * @addtogroup API + */ +class ApiParamInfo extends ApiBase { + + public function __construct($main, $action) { + parent :: __construct($main, $action); + } + + public function execute() { + // Get parameters + $params = $this->extractRequestParams(); + $result = $this->getResult(); + $r = array(); + if(is_array($params['modules'])) + { + $modArr = $this->getMain()->getModules(); + foreach($params['modules'] as $m) + { + if(!isset($modArr[$m])) + { + $r['modules'][] = array('name' => $m, 'missing' => ''); + continue; + } + $obj = new $modArr[$m]($this->getMain(), $m); + $a = $this->getClassInfo($obj); + $a['name'] = $m; + $r['modules'][] = $a; + } + $result->setIndexedTagName($r['modules'], 'module'); + } + if(is_array($params['querymodules'])) + { + $queryObj = new ApiQuery($this->getMain(), 'query'); + $qmodArr = $queryObj->getModules(); + foreach($params['querymodules'] as $qm) + { + if(!isset($qmodArr[$qm])) + { + $r['querymodules'][] = array('name' => $qm, 'missing' => ''); + continue; + } + $obj = new $qmodArr[$qm]($this, $qm); + $a = $this->getClassInfo($obj); + $a['name'] = $qm; + $r['querymodules'][] = $a; + } + $result->setIndexedTagName($r['querymodules'], 'module'); + } + $result->addValue(null, $this->getModuleName(), $r); + } + + function getClassInfo($obj) + { + $result = $this->getResult(); + $retval['classname'] = get_class($obj); + $retval['description'] = (is_array($obj->getDescription()) ? implode("\n", $obj->getDescription()) : $obj->getDescription()); + $retval['prefix'] = $obj->getModulePrefix(); + $allowedParams = $obj->getAllowedParams(); + if(!is_array($allowedParams)) + return $retval; + $retval['parameters'] = array(); + $paramDesc = $obj->getParamDescription(); + foreach($obj->getAllowedParams() as $n => $p) + { + $a = array('name' => $n); + if(!is_array($p)) + { + if(is_bool($p)) + { + $a['type'] = 'bool'; + $a['default'] = ($p ? 'true' : 'false'); + } + if(is_string($p)) + $a['default'] = $p; + $retval['parameters'][] = $a; + continue; + } + + if(isset($p[ApiBase::PARAM_DFLT])) + $a['default'] = $p[ApiBase::PARAM_DFLT]; + if(isset($p[ApiBase::PARAM_ISMULTI])) + if($p[ApiBase::PARAM_ISMULTI]) + $a['multi'] = ''; + if(isset($p[ApiBase::PARAM_TYPE])) + { + $a['type'] = $p[ApiBase::PARAM_TYPE]; + if(is_array($a['type'])) + $result->setIndexedTagName($a['type'], 't'); + } + if(isset($p[ApiBase::PARAM_MAX])) + $a['max'] = $p[ApiBase::PARAM_MAX]; + if(isset($p[ApiBase::PARAM_MAX2])) + $a['highmax'] = $p[ApiBase::PARAM_MAX2]; + if(isset($p[ApiBase::PARAM_MIN])) + $a['min'] = $p[ApiBase::PARAM_MIN]; + if(isset($paramDesc[$n])) + $a['description'] = (is_array($paramDesc[$n]) ? implode("\n", $paramDesc[$n]) : $paramDesc[$n]); + $retval['parameters'][] = $a; + } + $result->setIndexedTagName($retval['parameters'], 'param'); + return $retval; + } + + public function getAllowedParams() { + return array ( + 'modules' => array( + ApiBase :: PARAM_ISMULTI => true + ), + 'querymodules' => array( + ApiBase :: PARAM_ISMULTI => true + ) + ); + } + + public function getParamDescription() { + return array ( + 'modules' => 'List of module names (value of the action= parameter)', + 'querymodules' => 'List of query module names (value of prop=, meta= or list= parameter)', + ); + } + + public function getDescription() { + return 'Obtain information about certain API parameters'; + } + + protected function getExamples() { + return array ( + 'api.php?action=paraminfo&modules=parse&querymodules=allpages|siteinfo' + ); + } + + public function getVersion() { + return __CLASS__ . ': $Id: ApiParse.php 29810 2008-01-15 21:33:08Z catrope $'; + } +} + diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index 04915e5045..205fa0b930 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -133,7 +133,7 @@ class ApiParse extends ApiBase { } } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'title' => array( ApiBase :: PARAM_DFLT => 'API', @@ -156,7 +156,7 @@ class ApiParse extends ApiBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'text' => 'Wikitext to parse', 'title' => 'Title of page', @@ -164,7 +164,7 @@ class ApiParse extends ApiBase { ); } - protected function getDescription() { + public function getDescription() { return 'This module parses wikitext and returns parser output'; } diff --git a/includes/api/ApiProtect.php b/includes/api/ApiProtect.php index 6a32434090..bd7fa906eb 100644 --- a/includes/api/ApiProtect.php +++ b/includes/api/ApiProtect.php @@ -111,7 +111,7 @@ class ApiProtect extends ApiBase { public function mustBePosted() { return true; } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'title' => null, 'token' => null, @@ -124,7 +124,7 @@ class ApiProtect extends ApiBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'title' => 'Title of the page you want to restore.', 'token' => 'A protect token previously retrieved through prop=info', @@ -135,7 +135,7 @@ class ApiProtect extends ApiBase { ); } - protected function getDescription() { + public function getDescription() { return array( 'Change the protection level of a page.' ); diff --git a/includes/api/ApiQuery.php b/includes/api/ApiQuery.php index 57d29bf768..d3110a59c2 100644 --- a/includes/api/ApiQuery.php +++ b/includes/api/ApiQuery.php @@ -388,7 +388,7 @@ class ApiQuery extends ApiBase { * Returns the list of allowed parameters for this module. * Qurey module also lists all ApiPageSet parameters as its own. */ - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'prop' => array ( ApiBase :: PARAM_ISMULTI => true, @@ -475,7 +475,7 @@ class ApiQuery extends ApiBase { return true; } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'prop' => 'Which properties to get for the titles/revisions/pageids', 'list' => 'Which lists to get', @@ -486,7 +486,7 @@ class ApiQuery extends ApiBase { ); } - protected function getDescription() { + public function getDescription() { return array ( 'Query API module allows applications to get needed pieces of data from the MediaWiki databases,', 'and is loosely based on the Query API interface currently available on all MediaWiki servers.', diff --git a/includes/api/ApiQueryAllCategories.php b/includes/api/ApiQueryAllCategories.php index e65ffe0e7b..8449487605 100644 --- a/includes/api/ApiQueryAllCategories.php +++ b/includes/api/ApiQueryAllCategories.php @@ -96,7 +96,7 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase { } } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'from' => null, 'prefix' => null, @@ -117,7 +117,7 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'from' => 'The category to start enumerating from.', 'prefix' => 'Search for all category titles that begin with this value.', @@ -126,7 +126,7 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase { ); } - protected function getDescription() { + public function getDescription() { return 'Enumerate all categories'; } diff --git a/includes/api/ApiQueryAllLinks.php b/includes/api/ApiQueryAllLinks.php index a0c8766e9a..e40cc15d64 100644 --- a/includes/api/ApiQueryAllLinks.php +++ b/includes/api/ApiQueryAllLinks.php @@ -125,7 +125,7 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase { } } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'from' => null, 'prefix' => null, @@ -152,7 +152,7 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'from' => 'The page title to start enumerating from.', 'prefix' => 'Search for all page titles that begin with this value.', @@ -163,7 +163,7 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase { ); } - protected function getDescription() { + public function getDescription() { return 'Enumerate all links that point to a given namespace'; } diff --git a/includes/api/ApiQueryAllUsers.php b/includes/api/ApiQueryAllUsers.php index 7d554919d0..c715141ac2 100644 --- a/includes/api/ApiQueryAllUsers.php +++ b/includes/api/ApiQueryAllUsers.php @@ -158,7 +158,7 @@ class ApiQueryAllUsers extends ApiQueryBase { $result->addValue('query', $this->getModuleName(), $data); } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'from' => null, 'prefix' => null, @@ -183,7 +183,7 @@ class ApiQueryAllUsers extends ApiQueryBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'from' => 'The user name to start enumerating from.', 'prefix' => 'Search for all page titles that begin with this value.', @@ -195,7 +195,7 @@ class ApiQueryAllUsers extends ApiQueryBase { ); } - protected function getDescription() { + public function getDescription() { return 'Enumerate all registered users'; } diff --git a/includes/api/ApiQueryAllmessages.php b/includes/api/ApiQueryAllmessages.php index 00957873af..ce4f6c5cdc 100644 --- a/includes/api/ApiQueryAllmessages.php +++ b/includes/api/ApiQueryAllmessages.php @@ -94,7 +94,7 @@ class ApiQueryAllmessages extends ApiQueryBase { $result->addValue( 'query', $this->getModuleName(), $messages_out ); } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'messages' => array ( ApiBase :: PARAM_DFLT => '*', @@ -104,7 +104,7 @@ class ApiQueryAllmessages extends ApiQueryBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'messages' => 'Which messages to output. "*" means all messages', 'filter' => 'Return only messages that contains specified string', @@ -112,7 +112,7 @@ class ApiQueryAllmessages extends ApiQueryBase { ); } - protected function getDescription() { + public function getDescription() { return 'Return messages from this site.'; } diff --git a/includes/api/ApiQueryAllpages.php b/includes/api/ApiQueryAllpages.php index d21657f55f..0100ef38d7 100644 --- a/includes/api/ApiQueryAllpages.php +++ b/includes/api/ApiQueryAllpages.php @@ -158,7 +158,7 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase { } } - protected function getAllowedParams() { + public function getAllowedParams() { global $wgRestrictionTypes, $wgRestrictionLevels; return array ( @@ -215,7 +215,7 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'from' => 'The page title to start enumerating from.', 'prefix' => 'Search for all page titles that begin with this value.', @@ -231,7 +231,7 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase { ); } - protected function getDescription() { + public function getDescription() { return 'Enumerate all pages sequentially in a given namespace'; } diff --git a/includes/api/ApiQueryBacklinks.php b/includes/api/ApiQueryBacklinks.php index bdd72acb6b..924725cd19 100644 --- a/includes/api/ApiQueryBacklinks.php +++ b/includes/api/ApiQueryBacklinks.php @@ -315,7 +315,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { '|' . $lastPageID; } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'title' => null, @@ -343,7 +343,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'title' => 'Title to search. If null, titles= parameter will be used instead, but will be obsolete soon.', 'continue' => 'When more results are available, use this to continue.', @@ -354,7 +354,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { ); } - protected function getDescription() { + public function getDescription() { switch ($this->getModuleName()) { case 'backlinks' : return 'Find all pages that link to the given page'; diff --git a/includes/api/ApiQueryBlocks.php b/includes/api/ApiQueryBlocks.php index 05959575a9..8924289678 100644 --- a/includes/api/ApiQueryBlocks.php +++ b/includes/api/ApiQueryBlocks.php @@ -166,7 +166,7 @@ class ApiQueryBlocks extends ApiQueryBase { return implode('.', $parts); } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'start' => array( ApiBase :: PARAM_TYPE => 'timestamp' @@ -212,7 +212,7 @@ class ApiQueryBlocks extends ApiQueryBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'start' => 'The timestamp to start enumerating from', 'end' => 'The timestamp to stop enumerating at', @@ -224,7 +224,7 @@ class ApiQueryBlocks extends ApiQueryBase { ); } - protected function getDescription() { + public function getDescription() { return 'List all blocked users and IP addresses.'; } diff --git a/includes/api/ApiQueryCategories.php b/includes/api/ApiQueryCategories.php index 2283a8b978..eec03bb523 100644 --- a/includes/api/ApiQueryCategories.php +++ b/includes/api/ApiQueryCategories.php @@ -120,7 +120,7 @@ class ApiQueryCategories extends ApiQueryGeneratorBase { $db->freeResult($res); } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'prop' => array ( ApiBase :: PARAM_ISMULTI => true, @@ -131,13 +131,13 @@ class ApiQueryCategories extends ApiQueryGeneratorBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'prop' => 'Which additional properties to get for each category.', ); } - protected function getDescription() { + public function getDescription() { return 'List all categories the page(s) belong to'; } diff --git a/includes/api/ApiQueryCategoryMembers.php b/includes/api/ApiQueryCategoryMembers.php index 487fea8b16..93c91c1275 100644 --- a/includes/api/ApiQueryCategoryMembers.php +++ b/includes/api/ApiQueryCategoryMembers.php @@ -172,7 +172,7 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { } } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'category' => null, 'prop' => array ( @@ -214,7 +214,7 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'category' => 'Which category to enumerate (required)', 'prop' => 'What pieces of information to include', @@ -226,7 +226,7 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { ); } - protected function getDescription() { + public function getDescription() { return 'List all pages in a given category'; } diff --git a/includes/api/ApiQueryDeletedrevs.php b/includes/api/ApiQueryDeletedrevs.php index 14dd26b718..a8c8f65946 100644 --- a/includes/api/ApiQueryDeletedrevs.php +++ b/includes/api/ApiQueryDeletedrevs.php @@ -163,7 +163,7 @@ class ApiQueryDeletedrevs extends ApiQueryBase { $result->addValue('query', $this->getModuleName(), $data); } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'start' => array( ApiBase :: PARAM_TYPE => 'timestamp' @@ -205,7 +205,7 @@ class ApiQueryDeletedrevs extends ApiQueryBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'start' => 'The timestamp to start enumerating from', 'end' => 'The timestamp to stop enumerating at', @@ -216,7 +216,7 @@ class ApiQueryDeletedrevs extends ApiQueryBase { ); } - protected function getDescription() { + public function getDescription() { return 'List deleted revisions.'; } diff --git a/includes/api/ApiQueryExtLinksUsage.php b/includes/api/ApiQueryExtLinksUsage.php index 2e47a5750c..2c9b3bee49 100644 --- a/includes/api/ApiQueryExtLinksUsage.php +++ b/includes/api/ApiQueryExtLinksUsage.php @@ -134,7 +134,7 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase { } } - protected function getAllowedParams() { + public function getAllowedParams() { global $wgUrlProtocols; $protocols = array(); foreach ($wgUrlProtocols as $p) { @@ -173,7 +173,7 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'prop' => 'What pieces of information to include', 'offset' => 'Used for paging. Use the value returned for "continue"', @@ -184,7 +184,7 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase { ); } - protected function getDescription() { + public function getDescription() { return 'Enumerate pages that contain a given URL'; } diff --git a/includes/api/ApiQueryExternalLinks.php b/includes/api/ApiQueryExternalLinks.php index ad4634e14b..1b88937dd4 100644 --- a/includes/api/ApiQueryExternalLinks.php +++ b/includes/api/ApiQueryExternalLinks.php @@ -75,7 +75,7 @@ class ApiQueryExternalLinks extends ApiQueryBase { $db->freeResult($res); } - protected function getDescription() { + public function getDescription() { return 'Returns all external urls (not interwikies) from the given page(s)'; } diff --git a/includes/api/ApiQueryImageInfo.php b/includes/api/ApiQueryImageInfo.php index c8dfc52afa..f1a335e9db 100644 --- a/includes/api/ApiQueryImageInfo.php +++ b/includes/api/ApiQueryImageInfo.php @@ -140,7 +140,7 @@ class ApiQueryImageInfo extends ApiQueryBase { return $vals; } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'prop' => array ( ApiBase :: PARAM_ISMULTI => true, @@ -179,7 +179,7 @@ class ApiQueryImageInfo extends ApiQueryBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'prop' => 'What image information to get.', 'limit' => 'How many image revisions to return', @@ -190,7 +190,7 @@ class ApiQueryImageInfo extends ApiQueryBase { ); } - protected function getDescription() { + public function getDescription() { return array ( 'Returns image information and upload history' ); diff --git a/includes/api/ApiQueryImages.php b/includes/api/ApiQueryImages.php index 10a5885834..da32e89b8c 100644 --- a/includes/api/ApiQueryImages.php +++ b/includes/api/ApiQueryImages.php @@ -98,7 +98,7 @@ class ApiQueryImages extends ApiQueryGeneratorBase { $db->freeResult($res); } - protected function getDescription() { + public function getDescription() { return 'Returns all images contained on the given page(s)'; } diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php index f6a5019646..b7e4d6133a 100644 --- a/includes/api/ApiQueryInfo.php +++ b/includes/api/ApiQueryInfo.php @@ -217,7 +217,7 @@ class ApiQueryInfo extends ApiQueryBase { } } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'prop' => array ( ApiBase :: PARAM_DFLT => NULL, @@ -237,7 +237,7 @@ class ApiQueryInfo extends ApiQueryBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'prop' => array ( 'Which additional properties to get:', @@ -248,7 +248,7 @@ class ApiQueryInfo extends ApiQueryBase { } - protected function getDescription() { + public function getDescription() { return 'Get basic page information such as namespace, title, last touched date, ...'; } diff --git a/includes/api/ApiQueryLangLinks.php b/includes/api/ApiQueryLangLinks.php index 99457aee9c..777cbe00f0 100644 --- a/includes/api/ApiQueryLangLinks.php +++ b/includes/api/ApiQueryLangLinks.php @@ -76,7 +76,7 @@ class ApiQueryLangLinks extends ApiQueryBase { $db->freeResult($res); } - protected function getDescription() { + public function getDescription() { return 'Returns all interlanguage links from the given page(s)'; } diff --git a/includes/api/ApiQueryLinks.php b/includes/api/ApiQueryLinks.php index e3a402769b..1d3173763d 100644 --- a/includes/api/ApiQueryLinks.php +++ b/includes/api/ApiQueryLinks.php @@ -123,7 +123,7 @@ class ApiQueryLinks extends ApiQueryGeneratorBase { $db->freeResult($res); } - protected function getAllowedParams() + public function getAllowedParams() { return array( 'namespace' => array( @@ -133,14 +133,14 @@ class ApiQueryLinks extends ApiQueryGeneratorBase { ); } - protected function getParamDescription() + public function getParamDescription() { return array( 'namespace' => "Show {$this->description}s in this namespace(s) only" ); } - protected function getDescription() { + public function getDescription() { return "Returns all {$this->description}s from the given page(s)"; } diff --git a/includes/api/ApiQueryLogEvents.php b/includes/api/ApiQueryLogEvents.php index b23b6a5b7a..1290c6cb4f 100644 --- a/includes/api/ApiQueryLogEvents.php +++ b/includes/api/ApiQueryLogEvents.php @@ -198,7 +198,7 @@ class ApiQueryLogEvents extends ApiQueryBase { } - protected function getAllowedParams() { + public function getAllowedParams() { global $wgLogTypes; return array ( 'prop' => array ( @@ -243,7 +243,7 @@ class ApiQueryLogEvents extends ApiQueryBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'prop' => 'Which properties to get', 'type' => 'Filter log entries to only this type(s)', @@ -256,7 +256,7 @@ class ApiQueryLogEvents extends ApiQueryBase { ); } - protected function getDescription() { + public function getDescription() { return 'Get events from logs.'; } diff --git a/includes/api/ApiQueryRandom.php b/includes/api/ApiQueryRandom.php index 5741ed53a4..813cd166d5 100644 --- a/includes/api/ApiQueryRandom.php +++ b/includes/api/ApiQueryRandom.php @@ -1,129 +1,129 @@ -run(); - } - - public function executeGenerator($resultPageSet) { - $this->run($resultPageSet); - } - - public function run($resultPageSet = null) { - $params = $this->extractRequestParams(); - $result = $this->getResult(); - $randstr = wfRandom(); - $data = array(); - - $this->addTables('page'); - $this->addOption('LIMIT', $params['limit']); - $this->addWhereFld('page_namespace', $params['namespace']); - $this->addWhereRange('page_random', 'newer', $randstr, null); - $this->addWhere(array('page_is_redirect' => 0)); - $this->addOption('USE INDEX', 'page_random'); - if(is_null($resultPageSet)) - $this->addFields(array('page_id', 'page_title', 'page_namespace')); - else - $this->addFields($resultPageSet->getPageTableFields()); - - $db = $this->getDB(); - $res = $this->select(__METHOD__); - while($row = $db->fetchObject($res)) { - if(is_null($resultPageSet)) - $data[] = $this->extractRowInfo($row); - else - $resultPageSet->processDbRow($row); - } - $db->freeResult($res); - - if(is_null($resultPageSet)) { - $result->setIndexedTagName($data, 'page'); - $result->addValue('query', $this->getModuleName(), $data); - } - } - - private function extractRowInfo($row) { - $title = Title::makeTitle($row->page_namespace, $row->page_title); - $vals = array(); - $vals['title'] = $title->getPrefixedText(); - $vals['ns'] = $row->page_namespace; - $vals['id'] = $row->page_id; - return $vals; - } - - protected function getAllowedParams() { - return array ( - 'namespace' => array( - ApiBase :: PARAM_TYPE => 'namespace', - ApiBase :: PARAM_ISMULTI => true - ), - 'limit' => array ( - ApiBase :: PARAM_TYPE => 'limit', - ApiBase :: PARAM_DFLT => 1, - ApiBase :: PARAM_MIN => 1, - ApiBase :: PARAM_MAX => 10, - ApiBase :: PARAM_MAX2 => 20 - ), - ); - } - - protected function getParamDescription() { - return array ( - 'namespace' => 'Return pages in these namespaces only', - 'limit' => 'Limit how many random pages will be returned' - ); - } - - protected function getDescription() { - return array( 'Get a set of random pages', - 'NOTE: When using a namespace filter, this module may return an empty result. In that case, retry the request' - ); - } - - protected function getExamples() { - return 'api.php?action=query&list=random&rnnamespace=0&rnlimit=2'; - } - - public function getVersion() { - return __CLASS__ . ': $Id: ApiQueryRandom.php overlordq$'; - } -} +run(); + } + + public function executeGenerator($resultPageSet) { + $this->run($resultPageSet); + } + + public function run($resultPageSet = null) { + $params = $this->extractRequestParams(); + $result = $this->getResult(); + $randstr = wfRandom(); + $data = array(); + + $this->addTables('page'); + $this->addOption('LIMIT', $params['limit']); + $this->addWhereFld('page_namespace', $params['namespace']); + $this->addWhereRange('page_random', 'newer', $randstr, null); + $this->addWhere(array('page_is_redirect' => 0)); + $this->addOption('USE INDEX', 'page_random'); + if(is_null($resultPageSet)) + $this->addFields(array('page_id', 'page_title', 'page_namespace')); + else + $this->addFields($resultPageSet->getPageTableFields()); + + $db = $this->getDB(); + $res = $this->select(__METHOD__); + while($row = $db->fetchObject($res)) { + if(is_null($resultPageSet)) + $data[] = $this->extractRowInfo($row); + else + $resultPageSet->processDbRow($row); + } + $db->freeResult($res); + + if(is_null($resultPageSet)) { + $result->setIndexedTagName($data, 'page'); + $result->addValue('query', $this->getModuleName(), $data); + } + } + + private function extractRowInfo($row) { + $title = Title::makeTitle($row->page_namespace, $row->page_title); + $vals = array(); + $vals['title'] = $title->getPrefixedText(); + $vals['ns'] = $row->page_namespace; + $vals['id'] = $row->page_id; + return $vals; + } + + public function getAllowedParams() { + return array ( + 'namespace' => array( + ApiBase :: PARAM_TYPE => 'namespace', + ApiBase :: PARAM_ISMULTI => true + ), + 'limit' => array ( + ApiBase :: PARAM_TYPE => 'limit', + ApiBase :: PARAM_DFLT => 1, + ApiBase :: PARAM_MIN => 1, + ApiBase :: PARAM_MAX => 10, + ApiBase :: PARAM_MAX2 => 20 + ), + ); + } + + public function getParamDescription() { + return array ( + 'namespace' => 'Return pages in these namespaces only', + 'limit' => 'Limit how many random pages will be returned' + ); + } + + public function getDescription() { + return array( 'Get a set of random pages', + 'NOTE: When using a namespace filter, this module may return an empty result. In that case, retry the request' + ); + } + + protected function getExamples() { + return 'api.php?action=query&list=random&rnnamespace=0&rnlimit=2'; + } + + public function getVersion() { + return __CLASS__ . ': $Id: ApiQueryRandom.php overlordq$'; + } +} diff --git a/includes/api/ApiQueryRecentChanges.php b/includes/api/ApiQueryRecentChanges.php index a80b6c7718..d01b7a55f9 100644 --- a/includes/api/ApiQueryRecentChanges.php +++ b/includes/api/ApiQueryRecentChanges.php @@ -260,7 +260,7 @@ class ApiQueryRecentChanges extends ApiQueryBase { } } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'start' => array ( ApiBase :: PARAM_TYPE => 'timestamp' @@ -321,7 +321,7 @@ class ApiQueryRecentChanges extends ApiQueryBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'start' => 'The timestamp to start enumerating from.', 'end' => 'The timestamp to end enumerating.', @@ -337,7 +337,7 @@ class ApiQueryRecentChanges extends ApiQueryBase { ); } - protected function getDescription() { + public function getDescription() { return 'Enumerate recent changes'; } diff --git a/includes/api/ApiQueryRevisions.php b/includes/api/ApiQueryRevisions.php index 14da7f917e..3dff0bc093 100644 --- a/includes/api/ApiQueryRevisions.php +++ b/includes/api/ApiQueryRevisions.php @@ -280,7 +280,7 @@ class ApiQueryRevisions extends ApiQueryBase { return $vals; } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'prop' => array ( ApiBase :: PARAM_ISMULTI => true, @@ -337,7 +337,7 @@ class ApiQueryRevisions extends ApiQueryBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'prop' => 'Which properties to get for each revision.', 'limit' => 'limit how many revisions will be returned (enum)', @@ -353,7 +353,7 @@ class ApiQueryRevisions extends ApiQueryBase { ); } - protected function getDescription() { + public function getDescription() { return array ( 'Get revision information.', 'This module may be used in several ways:', diff --git a/includes/api/ApiQuerySearch.php b/includes/api/ApiQuerySearch.php index 0352a55d18..b2a10b5adc 100644 --- a/includes/api/ApiQuerySearch.php +++ b/includes/api/ApiQuerySearch.php @@ -94,7 +94,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { } } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'search' => null, 'namespace' => array ( @@ -121,7 +121,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'search' => 'Search for all page titles (or content) that has this value.', 'namespace' => 'The namespace(s) to enumerate.', @@ -132,7 +132,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { ); } - protected function getDescription() { + public function getDescription() { return 'Perform a full text search'; } diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index 1bd34cd453..e8ca0d2d9f 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -181,7 +181,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { $this->getResult()->addValue('query', $property, $data); } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'prop' => array ( @@ -205,7 +205,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'prop' => array ( 'Which sysinfo properties to get:', @@ -220,7 +220,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { ); } - protected function getDescription() { + public function getDescription() { return 'Return general information about the site.'; } diff --git a/includes/api/ApiQueryUserContributions.php b/includes/api/ApiQueryUserContributions.php index 6c3d356c8c..91e8451207 100644 --- a/includes/api/ApiQueryUserContributions.php +++ b/includes/api/ApiQueryUserContributions.php @@ -196,7 +196,7 @@ class ApiQueryContributions extends ApiQueryBase { return $vals; } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'limit' => array ( ApiBase :: PARAM_DFLT => 10, @@ -246,7 +246,7 @@ class ApiQueryContributions extends ApiQueryBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'limit' => 'The maximum number of contributions to return.', 'start' => 'The start timestamp to return from.', @@ -259,7 +259,7 @@ class ApiQueryContributions extends ApiQueryBase { ); } - protected function getDescription() { + public function getDescription() { return 'Get all edits by a user'; } diff --git a/includes/api/ApiQueryUserInfo.php b/includes/api/ApiQueryUserInfo.php index 1cc8cbac41..e5f38fe064 100644 --- a/includes/api/ApiQueryUserInfo.php +++ b/includes/api/ApiQueryUserInfo.php @@ -87,7 +87,7 @@ class ApiQueryUserInfo extends ApiQueryBase { return $vals; } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'prop' => array ( ApiBase :: PARAM_DFLT => NULL, @@ -107,7 +107,7 @@ class ApiQueryUserInfo extends ApiQueryBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'prop' => array( 'What pieces of information to include', @@ -122,7 +122,7 @@ class ApiQueryUserInfo extends ApiQueryBase { ); } - protected function getDescription() { + public function getDescription() { return 'Get information about the current user'; } diff --git a/includes/api/ApiQueryUsers.php b/includes/api/ApiQueryUsers.php index 20bad51e4c..144bfba212 100644 --- a/includes/api/ApiQueryUsers.php +++ b/includes/api/ApiQueryUsers.php @@ -1,162 +1,162 @@ -.@home.nl - * - * 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., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * http://www.gnu.org/copyleft/gpl.html - */ - -if (!defined('MEDIAWIKI')) { - // Eclipse helper - will be ignored in production - require_once ('ApiQueryBase.php'); -} - -/** - * Query module to get information about a list of users - * - * @addtogroup API - */ - - class ApiQueryUsers extends ApiQueryBase { - - public function __construct($query, $moduleName) { - parent :: __construct($query, $moduleName, 'us'); - } - - public function execute() { - $params = $this->extractRequestParams(); - $result = $this->getResult(); - $r = array(); - - if (!is_null($params['prop'])) { - $this->prop = array_flip($params['prop']); - } else { - $this->prop = array(); - } - - if(is_array($params['users'])) { - $r = $this->getOtherUsersInfo($params['users']); - $result->setIndexedTagName($r, 'user'); - } - $result->addValue("query", $this->getModuleName(), $r); - } - - protected function getOtherUsersInfo($users) { - $goodNames = $retval = array(); - // Canonicalize user names - foreach($users as $u) { - $n = User::getCanonicalName($u); - if($n === false) - $retval[] = array('name' => $u, 'invalid' => ''); - else - $goodNames[] = $n; - } - - $db = $this->getDb(); - $userTable = $db->tableName('user'); - $tables = "$userTable AS u1"; - $this->addFields('u1.user_name'); - $this->addWhereFld('u1.user_name', $goodNames); - $this->addFieldsIf('u1.user_editcount', isset($this->prop['editcount'])); - - if(isset($this->prop['groups'])) { - $ug = $db->tableName('user_groups'); - $tables = "$tables LEFT JOIN $ug ON ug_user=u1.user_id"; - $this->addFields('ug_group'); - } - if(isset($this->prop['blockinfo'])) { - $ipb = $db->tableName('ipblocks'); - $tables = "$tables LEFT JOIN $ipb ON ipb_user=u1.user_id"; - $tables = "$tables LEFT JOIN $userTable AS u2 ON ipb_by=u2.user_id"; - $this->addFields(array('ipb_reason', 'u2.user_name AS blocker_name')); - } - $this->addTables($tables); - - $data = array(); - $res = $this->select(__METHOD__); - while(($r = $db->fetchObject($res))) { - $data[$r->user_name]['name'] = $r->user_name; - if(isset($this->prop['editcount'])) - $data[$r->user_name]['editcount'] = $r->user_editcount; - if(isset($this->prop['groups'])) - // This row contains only one group, others will be added from other rows - if(!is_null($r->ug_group)) - $data[$r->user_name]['groups'][] = $r->ug_group; - if(isset($this->prop['blockinfo'])) - if(!is_null($r->blocker_name)) { - $data[$r->user_name]['blockedby'] = $r->blocker_name; - $data[$r->user_name]['blockreason'] = $r->ipb_reason; - } - } - - // Second pass: add result data to $retval - foreach($goodNames as $u) { - if(!isset($data[$u])) - $retval[] = array('name' => $u, 'missing' => ''); - else { - if(isset($this->prop['groups']) && isset($data[$u]['groups'])) - $this->getResult()->setIndexedTagName($data[$u]['groups'], 'g'); - $retval[] = $data[$u]; - } - } - return $retval; - } - - protected function getAllowedParams() { - return array ( - 'prop' => array ( - ApiBase :: PARAM_DFLT => NULL, - ApiBase :: PARAM_ISMULTI => true, - ApiBase :: PARAM_TYPE => array ( - 'blockinfo', - 'groups', - 'editcount' - ) - ), - 'users' => array( - ApiBase :: PARAM_ISMULTI => true - ) - ); - } - - protected function getParamDescription() { - return array ( - 'prop' => array( - 'What pieces of information to include', - ' blockinfo - tags if the user is blocked, by whom, and for what reason', - ' groups - lists all the groups the user belongs to', - ' editcount - adds the user\'s edit count' - ), - 'users' => 'A list of users to obtain the same information for' - ); - } - - protected function getDescription() { - return 'Get information about a list of users'; - } - - protected function getExamples() { - return 'api.php?action=query&list=users&ususers=brion|TimStarling&usprop=groups|editcount'; - } - - public function getVersion() { - return __CLASS__ . ': $Id: ApiQueryUserInfo.php 30128 2008-01-24 17:59:07Z catrope $'; - } -} +.@home.nl + * + * 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., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * http://www.gnu.org/copyleft/gpl.html + */ + +if (!defined('MEDIAWIKI')) { + // Eclipse helper - will be ignored in production + require_once ('ApiQueryBase.php'); +} + +/** + * Query module to get information about a list of users + * + * @addtogroup API + */ + + class ApiQueryUsers extends ApiQueryBase { + + public function __construct($query, $moduleName) { + parent :: __construct($query, $moduleName, 'us'); + } + + public function execute() { + $params = $this->extractRequestParams(); + $result = $this->getResult(); + $r = array(); + + if (!is_null($params['prop'])) { + $this->prop = array_flip($params['prop']); + } else { + $this->prop = array(); + } + + if(is_array($params['users'])) { + $r = $this->getOtherUsersInfo($params['users']); + $result->setIndexedTagName($r, 'user'); + } + $result->addValue("query", $this->getModuleName(), $r); + } + + protected function getOtherUsersInfo($users) { + $goodNames = $retval = array(); + // Canonicalize user names + foreach($users as $u) { + $n = User::getCanonicalName($u); + if($n === false) + $retval[] = array('name' => $u, 'invalid' => ''); + else + $goodNames[] = $n; + } + + $db = $this->getDb(); + $userTable = $db->tableName('user'); + $tables = "$userTable AS u1"; + $this->addFields('u1.user_name'); + $this->addWhereFld('u1.user_name', $goodNames); + $this->addFieldsIf('u1.user_editcount', isset($this->prop['editcount'])); + + if(isset($this->prop['groups'])) { + $ug = $db->tableName('user_groups'); + $tables = "$tables LEFT JOIN $ug ON ug_user=u1.user_id"; + $this->addFields('ug_group'); + } + if(isset($this->prop['blockinfo'])) { + $ipb = $db->tableName('ipblocks'); + $tables = "$tables LEFT JOIN $ipb ON ipb_user=u1.user_id"; + $tables = "$tables LEFT JOIN $userTable AS u2 ON ipb_by=u2.user_id"; + $this->addFields(array('ipb_reason', 'u2.user_name AS blocker_name')); + } + $this->addTables($tables); + + $data = array(); + $res = $this->select(__METHOD__); + while(($r = $db->fetchObject($res))) { + $data[$r->user_name]['name'] = $r->user_name; + if(isset($this->prop['editcount'])) + $data[$r->user_name]['editcount'] = $r->user_editcount; + if(isset($this->prop['groups'])) + // This row contains only one group, others will be added from other rows + if(!is_null($r->ug_group)) + $data[$r->user_name]['groups'][] = $r->ug_group; + if(isset($this->prop['blockinfo'])) + if(!is_null($r->blocker_name)) { + $data[$r->user_name]['blockedby'] = $r->blocker_name; + $data[$r->user_name]['blockreason'] = $r->ipb_reason; + } + } + + // Second pass: add result data to $retval + foreach($goodNames as $u) { + if(!isset($data[$u])) + $retval[] = array('name' => $u, 'missing' => ''); + else { + if(isset($this->prop['groups']) && isset($data[$u]['groups'])) + $this->getResult()->setIndexedTagName($data[$u]['groups'], 'g'); + $retval[] = $data[$u]; + } + } + return $retval; + } + + public function getAllowedParams() { + return array ( + 'prop' => array ( + ApiBase :: PARAM_DFLT => NULL, + ApiBase :: PARAM_ISMULTI => true, + ApiBase :: PARAM_TYPE => array ( + 'blockinfo', + 'groups', + 'editcount' + ) + ), + 'users' => array( + ApiBase :: PARAM_ISMULTI => true + ) + ); + } + + public function getParamDescription() { + return array ( + 'prop' => array( + 'What pieces of information to include', + ' blockinfo - tags if the user is blocked, by whom, and for what reason', + ' groups - lists all the groups the user belongs to', + ' editcount - adds the user\'s edit count' + ), + 'users' => 'A list of users to obtain the same information for' + ); + } + + public function getDescription() { + return 'Get information about a list of users'; + } + + protected function getExamples() { + return 'api.php?action=query&list=users&ususers=brion|TimStarling&usprop=groups|editcount'; + } + + public function getVersion() { + return __CLASS__ . ': $Id: ApiQueryUserInfo.php 30128 2008-01-24 17:59:07Z catrope $'; + } +} diff --git a/includes/api/ApiQueryWatchlist.php b/includes/api/ApiQueryWatchlist.php index 12ac7a1ea4..8960664458 100644 --- a/includes/api/ApiQueryWatchlist.php +++ b/includes/api/ApiQueryWatchlist.php @@ -243,7 +243,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { return $vals; } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'allrev' => false, 'start' => array ( @@ -298,7 +298,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'allrev' => 'Include multiple revisions of the same page within given timeframe.', 'start' => 'The timestamp to start enumerating from.', @@ -314,7 +314,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { ); } - protected function getDescription() { + public function getDescription() { return ''; } diff --git a/includes/api/ApiRollback.php b/includes/api/ApiRollback.php index 0f37ef9301..5e2178945c 100644 --- a/includes/api/ApiRollback.php +++ b/includes/api/ApiRollback.php @@ -88,7 +88,7 @@ class ApiRollback extends ApiBase { public function mustBePosted() { return true; } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'title' => null, 'user' => null, @@ -98,7 +98,7 @@ class ApiRollback extends ApiBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'title' => 'Title of the page you want to rollback.', 'user' => 'Name of the user whose edits are to be rolled back. If set incorrectly, you\'ll get a badtoken error.', @@ -108,7 +108,7 @@ class ApiRollback extends ApiBase { ); } - protected function getDescription() { + public function getDescription() { return array( 'Undoes the last edit to the page. If the last user who edited the page made multiple edits in a row,', 'they will all be rolled back. You need to be logged in as a sysop to use this function, see also action=login.' diff --git a/includes/api/ApiUnblock.php b/includes/api/ApiUnblock.php index 7aaa1d5065..f1d8753e05 100644 --- a/includes/api/ApiUnblock.php +++ b/includes/api/ApiUnblock.php @@ -85,7 +85,7 @@ class ApiUnblock extends ApiBase { public function mustBePosted() { return true; } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'id' => null, 'user' => null, @@ -95,7 +95,7 @@ class ApiUnblock extends ApiBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'id' => 'ID of the block you want to unblock (obtained through list=blocks). Cannot be used together with user', 'user' => 'Username, IP address or IP range you want to unblock. Cannot be used together with id', @@ -105,7 +105,7 @@ class ApiUnblock extends ApiBase { ); } - protected function getDescription() { + public function getDescription() { return array( 'Unblock a user.' ); diff --git a/includes/api/ApiUndelete.php b/includes/api/ApiUndelete.php index 510b7777c8..04ba074fc1 100644 --- a/includes/api/ApiUndelete.php +++ b/includes/api/ApiUndelete.php @@ -83,7 +83,7 @@ class ApiUndelete extends ApiBase { public function mustBePosted() { return true; } - protected function getAllowedParams() { + public function getAllowedParams() { return array ( 'title' => null, 'token' => null, @@ -94,7 +94,7 @@ class ApiUndelete extends ApiBase { ); } - protected function getParamDescription() { + public function getParamDescription() { return array ( 'title' => 'Title of the page you want to restore.', 'token' => 'An undelete token previously retrieved through list=deletedrevs', @@ -103,7 +103,7 @@ class ApiUndelete extends ApiBase { ); } - protected function getDescription() { + public function getDescription() { return array( 'Restore certain revisions of a deleted page. A list of deleted revisions (including timestamps) can be', 'retrieved through list=deletedrevs' -- 2.20.1