From 972b72f879c4cb2d4d45123643426d346484e245 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Tue, 26 Sep 2006 05:43:02 +0000 Subject: [PATCH] * API: All pages list * API: Reworked parameter processing --- api.php | 3 +- includes/api/ApiBase.php | 149 +++++++++++++++++++++-------- includes/api/ApiMain.php | 13 ++- includes/api/ApiQuery.php | 87 +++++++++-------- includes/api/ApiQueryAllpages.php | 140 +++++++++++++++++++++++++++ includes/api/ApiQueryBase.php | 38 ++++++-- includes/api/ApiQueryInfo.php | 6 +- includes/api/ApiQueryRevisions.php | 82 ++++++++++++++++ includes/api/ApiQuerySiteinfo.php | 6 +- 9 files changed, 428 insertions(+), 96 deletions(-) create mode 100644 includes/api/ApiQueryAllpages.php create mode 100644 includes/api/ApiQueryRevisions.php diff --git a/api.php b/api.php index 48ae7e4485..28b56c8fbc 100644 --- a/api.php +++ b/api.php @@ -61,7 +61,8 @@ $wgApiAutoloadClasses = array ( // Query items (meta/prop/list=...) 'ApiQuerySiteinfo' => 'ApiQuerySiteinfo.php', 'ApiQueryInfo' => 'ApiQueryInfo.php', - 'ApiQueryContent' => 'ApiQueryContent.php' + 'ApiQueryRevisions' => 'ApiQueryRevisions.php', + 'ApiQueryAllpages' => 'ApiQueryAllpages.php' ); /** diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index a6b4229434..8d8a5831e6 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -27,8 +27,10 @@ // Multi-valued enums, limit the values user can supply for the parameter define('GN_ENUM_DFLT', 'dflt'); define('GN_ENUM_ISMULTI', 'multi'); -define('GN_ENUM_CHOICES', 'choices'); define('GN_ENUM_TYPE', 'type'); +define('GN_ENUM_MAX1', 'max1'); +define('GN_ENUM_MAX2', 'max2'); +define('GN_ENUM_MIN', 'min'); abstract class ApiBase { @@ -156,47 +158,79 @@ abstract class ApiBase { $params = $this->GetAllowedParams(); $results = array (); - foreach ($params as $param => $dflt) { - switch (gettype($dflt)) { - case 'NULL' : - case 'string' : - $result = $wgRequest->getVal($param, $dflt); - break; - case 'integer' : - $result = $wgRequest->getInt($param, $dflt); - break; - case 'boolean' : - // Having a default value of 'true' is pointless - $result = $wgRequest->getCheck($param); - break; - case 'array' : - $enumParams = $dflt; - $dflt = isset ($enumParams[GN_ENUM_DFLT]) ? $enumParams[GN_ENUM_DFLT] : null; - $multi = isset ($enumParams[GN_ENUM_ISMULTI]) ? $enumParams[GN_ENUM_ISMULTI] : false; - $choices = isset ($enumParams[GN_ENUM_CHOICES]) ? $enumParams[GN_ENUM_CHOICES] : null; - $type = isset ($enumParams[GN_ENUM_TYPE]) ? $enumParams[GN_ENUM_TYPE] : null; - - $value = $wgRequest->getVal($param, $dflt); - - // Allow null when default is not set - if (isset ($dflt) || isset ($value)) { - $result = $this->ParseMultiValue($param, $value, $multi, $choices); - - // When choices are not given, and the default is an integer, make sure all values are integers - if (!isset ($choices) && isset ($dflt) && $type === 'integer') { - if (is_array($result)) - $result = array_map('intval', $result); - else - $result = intval($result); - } - } else { - $result = null; - } - break; - default : - $this->DieDebug("In '$param', unprocessed type " . gettype($dflt)); + foreach ($params as $param => $enumParams) { + + if (!is_array($enumParams)) { + $default = $enumParams; + $multi = false; + $type = gettype($enumParams); + } else { + $default = isset ($enumParams[GN_ENUM_DFLT]) ? $enumParams[GN_ENUM_DFLT] : null; + $multi = isset ($enumParams[GN_ENUM_ISMULTI]) ? $enumParams[GN_ENUM_ISMULTI] : false; + $type = isset ($enumParams[GN_ENUM_TYPE]) ? $enumParams[GN_ENUM_TYPE] : null; + + // When type is not given, and no choices, the type is the same as $default + if (!isset ($type)) { + if (isset ($default)) + $type = gettype($default); + else + $type = 'NULL'; // allow everything + } + } + + if ($type == 'boolean') { + if (!isset ($default)) + $default = false; + + if ($default !== false) { + // Having a default value of anything other than 'false' is pointless + $this->DieDebug("Boolean param $param's default is set to '$default'"); + } } - $results[$param] = $result; + + $value = $wgRequest->getVal($param, $default); + + if (isset ($value) && ($multi || is_array($type))) + $value = $this->ParseMultiValue($param, $value, $multi, is_array($type) ? $type : null); + + // More validation only when choices were not given + // choices were validated in ParseMultiValue() + if (!is_array ($type) && isset ($value)) { + + switch ($type) { + case 'NULL' : // nothing to do + break; + case 'string' : // nothing to do + break; + case 'integer' : // Force everything using intval() + $value = is_array($value) ? array_map('intval', $value) : intval($value); + break; + case 'limit': + if (!isset ($enumParams[GN_ENUM_MAX1]) || !isset($enumParams[GN_ENUM_MAX2])) + $this->DieDebug("MAX1 or MAX2 are not defined for the limit $param"); + if ($multi) + $this->DieDebug("Multi-values not supported for $param"); + $min = isset($enumParams[GN_ENUM_MIN]) ? $enumParams[GN_ENUM_MIN] : 0; + $value = intval($value); + $this->ValidateLimit($param, $value, $min, $enumParams[GN_ENUM_MAX1], $enumParams[GN_ENUM_MAX2]); + break; + case 'boolean' : + if ($multi) + $this->DieDebug("Multi-values not supported for $param"); + $value = isset ($value); + break; + case 'timestamp' : + if ($multi) + $this->DieDebug("Multi-values not supported for $param"); + $value = $this->prepareTimestamp($value); // Adds quotes around timestamp + break; + default : + $this->DieDebug("Param $param's type is unknown - $type"); + + } + } + + $results[$param] = $value; } return $results; @@ -228,6 +262,39 @@ abstract class ApiBase { return $allowMultiple ? $valuesList : $valuesList[0]; } + /** + * Validate the proper format of the timestamp string (14 digits), and add quotes to it. + */ + function prepareTimestamp($value) { + if (preg_match('/^[0-9]{14}$/', $value)) { + return $this->db->addQuotes($value); + } else { + $this->dieUsage('Incorrect timestamp format', 'badtimestamp'); + } + } + + /** + * Validate the value against the minimum and user/bot maximum limits. Prints usage info on failure. + */ + function ValidateLimit( $varname, $value, $min, $max, $botMax ) + { + global $wgUser; + + if ( $value < $min ) { + $this->dieUsage( "$varname may not be less than $min (set to $value)", $varname ); + } + + if( $this->GetMain()->IsBot() ) { + if ( $value > $botMax ) { + $this->dieUsage( "$varname may not be over $botMax (set to $value) for bots", $varname ); + } + } else { + if( $value > $max ) { + $this->dieUsage( "$varname may not be over $max (set to $value) for users", $varname ); + } + } + } + /** * Call main module's error handler */ diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 2b61f25483..8b7a1ca2a4 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -73,11 +73,11 @@ class ApiMain extends ApiBase { return array ( 'format' => array ( GN_ENUM_DFLT => API_DEFAULT_FORMAT, - GN_ENUM_CHOICES => $this->mFormatNames + GN_ENUM_TYPE => $this->mFormatNames ), 'action' => array ( GN_ENUM_DFLT => 'help', - GN_ENUM_CHOICES => $this->mModuleNames + GN_ENUM_TYPE => $this->mModuleNames ) ); } @@ -172,5 +172,14 @@ class ApiMain extends ApiBase { return $msg; } + + private $mIsBot = null; + public function IsBot() { + if (!isset($this->mIsBot)) { + global $wgUser; + $this->mIsBot = $wgUser->isAllowed( 'bot' ); + } + return $this->mIsBot; + } } ?> \ No newline at end of file diff --git a/includes/api/ApiQuery.php b/includes/api/ApiQuery.php index 26d045c761..c6e3b1653e 100644 --- a/includes/api/ApiQuery.php +++ b/includes/api/ApiQuery.php @@ -34,39 +34,32 @@ class ApiQuery extends ApiBase { var $mMetaModuleNames, $mPropModuleNames, $mListModuleNames; private $mQueryMetaModules = array ( - 'siteinfo' => 'ApiQuerySiteinfo', - //'userinfo' => 'ApiQueryUserinfo' - - + 'siteinfo' => 'ApiQuerySiteinfo' ); + // 'userinfo' => 'ApiQueryUserinfo', private $mQueryPropModules = array ( 'info' => 'ApiQueryInfo', - // 'categories' => 'ApiQueryCategories', - // 'imageinfo' => 'ApiQueryImageinfo', - // 'langlinks' => 'ApiQueryLanglinks', - // 'links' => 'ApiQueryLinks', - // 'templates' => 'ApiQueryTemplates', - // 'revisions' => 'ApiQueryRevisions', - - // Should be removed - 'content' => 'ApiQueryContent' + 'revisions' => 'ApiQueryRevisions' ); + // 'categories' => 'ApiQueryCategories', + // 'imageinfo' => 'ApiQueryImageinfo', + // 'langlinks' => 'ApiQueryLanglinks', + // 'links' => 'ApiQueryLinks', + // 'templates' => 'ApiQueryTemplates', private $mQueryListModules = array ( - // 'allpages' => 'ApiQueryAllpages', - // 'backlinks' => 'ApiQueryBacklinks', - // 'categorymembers' => 'ApiQueryCategorymembers', - // 'embeddedin' => 'ApiQueryEmbeddedin', - // 'imagelinks' => 'ApiQueryImagelinks', - // 'logevents' => 'ApiQueryLogevents', - // 'recentchanges' => 'ApiQueryRecentchanges', - // 'usercontribs' => 'ApiQueryUsercontribs', - // 'users' => 'ApiQueryUsers', - // 'watchlist' => 'ApiQueryWatchlist' - - + 'allpages' => 'ApiQueryAllpages' ); + // 'backlinks' => 'ApiQueryBacklinks', + // 'categorymembers' => 'ApiQueryCategorymembers', + // 'embeddedin' => 'ApiQueryEmbeddedin', + // 'imagelinks' => 'ApiQueryImagelinks', + // 'logevents' => 'ApiQueryLogevents', + // 'recentchanges' => 'ApiQueryRecentchanges', + // 'usercontribs' => 'ApiQueryUsercontribs', + // 'users' => 'ApiQueryUsers', + // 'watchlist' => 'ApiQueryWatchlist', private $mSlaveDB = null; @@ -76,6 +69,8 @@ class ApiQuery extends ApiBase { $this->mPropModuleNames = array_keys($this->mQueryPropModules); $this->mListModuleNames = array_keys($this->mQueryListModules); + // Allow the entire list of modules at first, + // but during module instantiation check if it can be used as a generator. $this->mAllowedGenerators = array_merge($this->mListModuleNames, $this->mPropModuleNames); } @@ -145,15 +140,15 @@ class ApiQuery extends ApiBase { // During instantiation, modules may optimize data requests through the $data object // $data will be lazy loaded when modules begin to request data during execution $modules = array (); - if (isset($meta)) + if (isset ($meta)) foreach ($meta as $moduleName) - $modules[] = new $this->mQueryMetaModules[$moduleName] ($this->GetMain(), $moduleName, $data); - if (isset($prop)) + $modules[] = new $this->mQueryMetaModules[$moduleName] ($this->GetMain(), $this, $moduleName, $data); + if (isset ($prop)) foreach ($prop as $moduleName) - $modules[] = new $this->mQueryPropModules[$moduleName] ($this->GetMain(), $moduleName, $data); - if (isset($list)) + $modules[] = new $this->mQueryPropModules[$moduleName] ($this->GetMain(), $this, $moduleName, $data); + if (isset ($list)) foreach ($list as $moduleName) - $modules[] = new $this->mQueryListModules[$moduleName] ($this->GetMain(), $moduleName, $data); + $modules[] = new $this->mQueryListModules[$moduleName] ($this->GetMain(), $this, $moduleName, $data); // Title normalizations foreach ($data->GetNormalizedTitles() as $rawTitleStr => $titleStr) { @@ -179,6 +174,18 @@ class ApiQuery extends ApiBase { } protected function ExecuteGenerator($generator, $data, $redirects) { + + // Find class that implements requested generator + if (isset ($this->mQueryListModules[$generator])) + $className = $this->mQueryListModules[$generator]; + else if (isset ($this->mQueryPropModules[$generator])) + $className = $this->mQueryPropModules[$generator]; + else + $this->DieDebug("Unknown generator=$generator"); + + + $module = new $className($this->GetMain(), $this, $generator, $data, true); + // TODO: implement $this->DieUsage("Generator execution has not been implemented", 'notimplemented'); } @@ -187,18 +194,18 @@ class ApiQuery extends ApiBase { return array ( 'meta' => array ( GN_ENUM_ISMULTI => true, - GN_ENUM_CHOICES => $this->mMetaModuleNames + GN_ENUM_TYPE => $this->mMetaModuleNames ), 'prop' => array ( GN_ENUM_ISMULTI => true, - GN_ENUM_CHOICES => $this->mPropModuleNames + GN_ENUM_TYPE => $this->mPropModuleNames ), 'list' => array ( GN_ENUM_ISMULTI => true, - GN_ENUM_CHOICES => $this->mListModuleNames + GN_ENUM_TYPE => $this->mListModuleNames ), // 'generator' => array ( - // GN_ENUM_CHOICES => $this->mAllowedGenerators + // GN_ENUM_TYPE => $this->mAllowedGenerators // ), 'titles' => array ( GN_ENUM_ISMULTI => true @@ -225,21 +232,21 @@ class ApiQuery extends ApiBase { $astriks = str_repeat('--- ', 8); $msg .= "\n$astriks Query: Meta $astriks\n\n"; - $msg .= $this->MakeHelpMsgHelper($this->mQueryMetaModules, 'meta'); + $msg .= $this->MakeHelpMsgHelper($this->mQueryMetaModules, 'meta'); $msg .= "\n$astriks Query: Prop $astriks\n\n"; - $msg .= $this->MakeHelpMsgHelper($this->mQueryPropModules, 'prop'); + $msg .= $this->MakeHelpMsgHelper($this->mQueryPropModules, 'prop'); $msg .= "\n$astriks Query: List $astriks\n\n"; - $msg .= $this->MakeHelpMsgHelper($this->mQueryListModules, 'list'); + $msg .= $this->MakeHelpMsgHelper($this->mQueryListModules, 'list'); return $msg; } - + private function MakeHelpMsgHelper($moduleList, $paramName) { $msg = ''; foreach ($moduleList as $moduleName => $moduleClass) { $msg .= "* $paramName=$moduleName *"; - $module = new $moduleClass ($this->GetMain(), $moduleName, null); + $module = new $moduleClass ($this->GetMain(), $this, $moduleName, null); $msg2 = $module->MakeHelpMsg(); if ($msg2 !== false) $msg .= $msg2; diff --git a/includes/api/ApiQueryAllpages.php b/includes/api/ApiQueryAllpages.php new file mode 100644 index 0000000000..b0530b9b4b --- /dev/null +++ b/includes/api/ApiQueryAllpages.php @@ -0,0 +1,140 @@ + + * + * 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"); +} + +class ApiQueryAllpages extends ApiQueryBase { + + public function __construct($main, $query, $moduleName, $data, $generator = false) { + parent :: __construct($main, $query, $moduleName, $data, $generator); + } + + public function Execute() { + $aplimit = $apfrom = $apnamespace = $apfilterredir = null; + extract($this->ExtractRequestParams()); + + $db = $this->GetQuery()->GetDB(); + $where = array( 'page_namespace' => $apnamespace ); + if( isset($apfrom)) + $where[] = 'page_title>=' . $db->addQuotes(ApiQueryBase::TitleToKey($apfrom)); + + if ($apfilterredir === 'redirects') + $where['page_is_redirect'] = 1; + else if ($apfilterredir === 'nonredirects') + $where['page_is_redirect'] = 0; + + $res = $db->select( + 'page', + array( 'page_id', 'page_namespace', 'page_title' ), + $where, + __CLASS__ . '::' . __METHOD__, + array( 'USE INDEX' => 'name_title', 'LIMIT' => $aplimit+1, 'ORDER BY' => 'page_namespace, page_title' )); + + $data = array(); + $data['_element'] = 'p'; + $count = 0; + while ( $row = $db->fetchObject( $res ) ) { + if( ++$count > $aplimit ) { + // We've reached the one extra which shows that there are additional pages to be had. Stop here... + $msg = array('continue' => 'apfrom=' . ApiQueryBase::KeyToTitle($row->page_title)); + $this->GetResult()->AddMessage('query-status', 'allpages', $msg); + break; + } + + $title = Title::makeTitle( $row->page_namespace, $row->page_title ); + // skip any pages that user has no rights to read + if ( $title->userCanRead() ) { + + $id = intval($row->page_id); + $pagedata = array(); + $pagedata['id'] = $id; + if ($title->getNamespace() !== 0) + $pagedata['ns'] = $title->getNamespace(); + $pagedata['title'] = $title->getPrefixedText(); + $pagedata['*'] = ''; + + $data[$id] = $pagedata; + } + } + $db->freeResult( $res ); + $this->GetResult()->AddMessage('query', 'allpages', $data); + } + + protected function GetAllowedParams() { + + global $wgContLang; + $validNamespaces = array(); + foreach (array_keys($wgContLang->getNamespaces()) as $ns) { + if ($ns >= 0) + $validNamespaces[] = $ns; // strval($ns); + } + + return array ( + 'apfrom' => null, + 'apnamespace' => array ( + GN_ENUM_DFLT => 0, + GN_ENUM_TYPE => $validNamespaces + ), + 'apfilterredir' => array ( + GN_ENUM_DFLT => 'all', + GN_ENUM_TYPE => array ( + 'all', + 'redirects', + 'nonredirects' + ) + ), + 'aplimit' => array ( + GN_ENUM_DFLT => 10, + GN_ENUM_TYPE => 'limit', + GN_ENUM_MIN => 1, + GN_ENUM_MAX1 => 500, + GN_ENUM_MAX2 => 5000 + ) + ); + } + + protected function GetParamDescription() { + return array (); + } + + protected function GetDescription() { + return 'Enumerate all pages sequentially in a given namespace'; + } + + protected function GetExamples() { + return array ( + 'api.php?action=query&list=allpages', + 'api.php?action=query&list=allpages&apfrom=B&aplimit=5' + ); + } + public function GetCanGenerate() { + return true; + } +} +?> \ No newline at end of file diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php index ff6cd5672e..176604ff8f 100644 --- a/includes/api/ApiQueryBase.php +++ b/includes/api/ApiQueryBase.php @@ -31,32 +31,58 @@ if (!defined('MEDIAWIKI')) { abstract class ApiQueryBase extends ApiBase { - private $mQueryModule; + private $mQueryModule, $mModuleName, $mData, $mGenerator; - public function __construct($main, $query) { + public function __construct($main, $query, $moduleName, $data, $generator=false) { parent :: __construct($main); $this->mQueryModule = $query; + $this->mModuleName = $moduleName; + $this->mData = $data; + $this->mGenerator = $generator; } /** - * Get the name of the query being executed by this instance + * Get the main Query module */ public function GetQuery() { return $this->mQueryModule; } /** - * Derived classes return true when they can be used as title generators for other query modules. + * Get the name of the query being executed by this instance + */ + public function GetModuleName() { + return $this->mModuleName; + } + + /** + * Get the PageSet object to work on */ - public function GetCanGenerate() { - return false; + protected function GetData() { + return $this->mData; } /** * Return true if this instance is being used as a generator. */ protected function GetIsGenerator() { + return $this->mGenerator; + } + + /** + * Derived classes return true when they can be used as title generators for other query modules. + */ + public function GetCanGenerate() { return false; } + + public static function TitleToKey($title) + { + return str_replace(' ', '_', $title); + } + public static function KeyToTitle($key) + { + return str_replace('_', ' ', $key); + } } ?> \ No newline at end of file diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php index 32b095dee8..7caed4f2ea 100644 --- a/includes/api/ApiQueryInfo.php +++ b/includes/api/ApiQueryInfo.php @@ -31,8 +31,8 @@ if (!defined('MEDIAWIKI')) { class ApiQueryInfo extends ApiQueryBase { - public function __construct($main, $query, $data) { - parent :: __construct($main, $query); + public function __construct($main, $moduleName, $query, $data) { + parent :: __construct($main, $moduleName, $query, $data); } public function Execute() { @@ -45,7 +45,7 @@ class ApiQueryInfo extends ApiQueryBase { 'enumparam' => array ( GN_ENUM_DFLT => 'default', GN_ENUM_ISMULTI => false, - GN_ENUM_CHOICES => array ( + GN_ENUM_TYPE => array ( 'a', 'b' ) diff --git a/includes/api/ApiQueryRevisions.php b/includes/api/ApiQueryRevisions.php new file mode 100644 index 0000000000..499af5cb7c --- /dev/null +++ b/includes/api/ApiQueryRevisions.php @@ -0,0 +1,82 @@ + + * + * 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"); +} + +class ApiQueryRevisions extends ApiQueryBase { + + public function __construct($main, $query, $moduleName, $data, $generator=false) { + parent :: __construct($main, $query, $moduleName, $data, $generator); + } + + public function Execute() { + + } + + protected function GetAllowedParams() { + return array ( + 'rvlimit' => 0, + 'rvstartid' => 0, + 'rvendid' => 0, + 'rvstart' => array ( + GN_ENUM_TYPE => 'timestamp' + ), + 'rvend' => array ( + GN_ENUM_TYPE => 'timestamp' + ), + 'rvdir' => array ( + GN_ENUM_DFLT => 'newer', + GN_ENUM_TYPE => array ( + 'newer', + 'older' + ) + ), + 'rvprop' => array ( + GN_ENUM_ISMULTI => true, + GN_ENUM_TYPE => array ( + 'timestamp', + 'user', + 'comment', + 'content' + ) + ) + ); + } + + protected function GetDescription() { + return 'module a'; + } + + protected function GetExamples() { + return array ( + 'http://...' + ); + } +} +?> \ No newline at end of file diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index 16ba59ab6d..50e9c271f7 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -31,8 +31,8 @@ if (!defined('MEDIAWIKI')) { class ApiQuerySiteinfo extends ApiQueryBase { - public function __construct($main, $query, $data) { - parent :: __construct($main, $query); + public function __construct($main, $query, $moduleName, $data) { + parent :: __construct($main, $query, $moduleName, $data); } public function Execute() { @@ -79,7 +79,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { 'siprop' => array ( GN_ENUM_DFLT => 'general', GN_ENUM_ISMULTI => true, - GN_ENUM_CHOICES => array ( + GN_ENUM_TYPE => array ( 'general', 'namespaces' ) -- 2.20.1