// Query items (meta/prop/list=...)\r
'ApiQuerySiteinfo' => 'ApiQuerySiteinfo.php',\r
'ApiQueryInfo' => 'ApiQueryInfo.php',\r
- 'ApiQueryContent' => 'ApiQueryContent.php'\r
+ 'ApiQueryRevisions' => 'ApiQueryRevisions.php',\r
+ 'ApiQueryAllpages' => 'ApiQueryAllpages.php' \r
);\r
\r
/**\r
// Multi-valued enums, limit the values user can supply for the parameter\r
define('GN_ENUM_DFLT', 'dflt');\r
define('GN_ENUM_ISMULTI', 'multi');\r
-define('GN_ENUM_CHOICES', 'choices');\r
define('GN_ENUM_TYPE', 'type');\r
+define('GN_ENUM_MAX1', 'max1');\r
+define('GN_ENUM_MAX2', 'max2');\r
+define('GN_ENUM_MIN', 'min');\r
\r
abstract class ApiBase {\r
\r
$params = $this->GetAllowedParams();\r
$results = array ();\r
\r
- foreach ($params as $param => $dflt) {\r
- switch (gettype($dflt)) {\r
- case 'NULL' :\r
- case 'string' :\r
- $result = $wgRequest->getVal($param, $dflt);\r
- break;\r
- case 'integer' :\r
- $result = $wgRequest->getInt($param, $dflt);\r
- break;\r
- case 'boolean' :\r
- // Having a default value of 'true' is pointless\r
- $result = $wgRequest->getCheck($param);\r
- break;\r
- case 'array' :\r
- $enumParams = $dflt;\r
- $dflt = isset ($enumParams[GN_ENUM_DFLT]) ? $enumParams[GN_ENUM_DFLT] : null;\r
- $multi = isset ($enumParams[GN_ENUM_ISMULTI]) ? $enumParams[GN_ENUM_ISMULTI] : false;\r
- $choices = isset ($enumParams[GN_ENUM_CHOICES]) ? $enumParams[GN_ENUM_CHOICES] : null;\r
- $type = isset ($enumParams[GN_ENUM_TYPE]) ? $enumParams[GN_ENUM_TYPE] : null;\r
-\r
- $value = $wgRequest->getVal($param, $dflt);\r
-\r
- // Allow null when default is not set\r
- if (isset ($dflt) || isset ($value)) {\r
- $result = $this->ParseMultiValue($param, $value, $multi, $choices);\r
-\r
- // When choices are not given, and the default is an integer, make sure all values are integers\r
- if (!isset ($choices) && isset ($dflt) && $type === 'integer') {\r
- if (is_array($result))\r
- $result = array_map('intval', $result);\r
- else\r
- $result = intval($result);\r
- }\r
- } else {\r
- $result = null;\r
- }\r
- break;\r
- default :\r
- $this->DieDebug("In '$param', unprocessed type " . gettype($dflt));\r
+ foreach ($params as $param => $enumParams) {\r
+\r
+ if (!is_array($enumParams)) {\r
+ $default = $enumParams;\r
+ $multi = false;\r
+ $type = gettype($enumParams);\r
+ } else {\r
+ $default = isset ($enumParams[GN_ENUM_DFLT]) ? $enumParams[GN_ENUM_DFLT] : null;\r
+ $multi = isset ($enumParams[GN_ENUM_ISMULTI]) ? $enumParams[GN_ENUM_ISMULTI] : false;\r
+ $type = isset ($enumParams[GN_ENUM_TYPE]) ? $enumParams[GN_ENUM_TYPE] : null;\r
+\r
+ // When type is not given, and no choices, the type is the same as $default\r
+ if (!isset ($type)) {\r
+ if (isset ($default))\r
+ $type = gettype($default);\r
+ else\r
+ $type = 'NULL'; // allow everything\r
+ }\r
+ }\r
+\r
+ if ($type == 'boolean') {\r
+ if (!isset ($default))\r
+ $default = false;\r
+\r
+ if ($default !== false) {\r
+ // Having a default value of anything other than 'false' is pointless\r
+ $this->DieDebug("Boolean param $param's default is set to '$default'");\r
+ }\r
}\r
- $results[$param] = $result;\r
+\r
+ $value = $wgRequest->getVal($param, $default);\r
+\r
+ if (isset ($value) && ($multi || is_array($type)))\r
+ $value = $this->ParseMultiValue($param, $value, $multi, is_array($type) ? $type : null);\r
+\r
+ // More validation only when choices were not given\r
+ // choices were validated in ParseMultiValue()\r
+ if (!is_array ($type) && isset ($value)) {\r
+\r
+ switch ($type) {\r
+ case 'NULL' : // nothing to do\r
+ break;\r
+ case 'string' : // nothing to do\r
+ break;\r
+ case 'integer' : // Force everything using intval()\r
+ $value = is_array($value) ? array_map('intval', $value) : intval($value);\r
+ break;\r
+ case 'limit':\r
+ if (!isset ($enumParams[GN_ENUM_MAX1]) || !isset($enumParams[GN_ENUM_MAX2]))\r
+ $this->DieDebug("MAX1 or MAX2 are not defined for the limit $param");\r
+ if ($multi)\r
+ $this->DieDebug("Multi-values not supported for $param");\r
+ $min = isset($enumParams[GN_ENUM_MIN]) ? $enumParams[GN_ENUM_MIN] : 0;\r
+ $value = intval($value);\r
+ $this->ValidateLimit($param, $value, $min, $enumParams[GN_ENUM_MAX1], $enumParams[GN_ENUM_MAX2]); \r
+ break;\r
+ case 'boolean' :\r
+ if ($multi)\r
+ $this->DieDebug("Multi-values not supported for $param");\r
+ $value = isset ($value);\r
+ break;\r
+ case 'timestamp' :\r
+ if ($multi)\r
+ $this->DieDebug("Multi-values not supported for $param");\r
+ $value = $this->prepareTimestamp($value); // Adds quotes around timestamp \r
+ break;\r
+ default :\r
+ $this->DieDebug("Param $param's type is unknown - $type");\r
+ \r
+ }\r
+ }\r
+\r
+ $results[$param] = $value;\r
}\r
\r
return $results;\r
return $allowMultiple ? $valuesList : $valuesList[0];\r
}\r
\r
+ /**\r
+ * Validate the proper format of the timestamp string (14 digits), and add quotes to it.\r
+ */\r
+ function prepareTimestamp($value) {\r
+ if (preg_match('/^[0-9]{14}$/', $value)) {\r
+ return $this->db->addQuotes($value);\r
+ } else {\r
+ $this->dieUsage('Incorrect timestamp format', 'badtimestamp');\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Validate the value against the minimum and user/bot maximum limits. Prints usage info on failure.\r
+ */\r
+ function ValidateLimit( $varname, $value, $min, $max, $botMax )\r
+ {\r
+ global $wgUser;\r
+ \r
+ if ( $value < $min ) {\r
+ $this->dieUsage( "$varname may not be less than $min (set to $value)", $varname );\r
+ }\r
+ \r
+ if( $this->GetMain()->IsBot() ) {\r
+ if ( $value > $botMax ) {\r
+ $this->dieUsage( "$varname may not be over $botMax (set to $value) for bots", $varname );\r
+ }\r
+ } else {\r
+ if( $value > $max ) {\r
+ $this->dieUsage( "$varname may not be over $max (set to $value) for users", $varname );\r
+ }\r
+ }\r
+ }\r
+\r
/**\r
* Call main module's error handler \r
*/\r
return array (\r
'format' => array (\r
GN_ENUM_DFLT => API_DEFAULT_FORMAT,\r
- GN_ENUM_CHOICES => $this->mFormatNames\r
+ GN_ENUM_TYPE => $this->mFormatNames\r
),\r
'action' => array (\r
GN_ENUM_DFLT => 'help',\r
- GN_ENUM_CHOICES => $this->mModuleNames\r
+ GN_ENUM_TYPE => $this->mModuleNames\r
)\r
);\r
}\r
\r
return $msg;\r
}\r
+ \r
+ private $mIsBot = null;\r
+ public function IsBot() {\r
+ if (!isset($this->mIsBot)) {\r
+ global $wgUser;\r
+ $this->mIsBot = $wgUser->isAllowed( 'bot' );\r
+ }\r
+ return $this->mIsBot;\r
+ }\r
}\r
?>
\ No newline at end of file
var $mMetaModuleNames, $mPropModuleNames, $mListModuleNames;\r
\r
private $mQueryMetaModules = array (\r
- 'siteinfo' => 'ApiQuerySiteinfo',\r
- //'userinfo' => 'ApiQueryUserinfo' \r
-\r
- \r
+ 'siteinfo' => 'ApiQuerySiteinfo'\r
);\r
+ // 'userinfo' => 'ApiQueryUserinfo',\r
\r
private $mQueryPropModules = array (\r
'info' => 'ApiQueryInfo',\r
- // 'categories' => 'ApiQueryCategories',\r
- // 'imageinfo' => 'ApiQueryImageinfo',\r
- // 'langlinks' => 'ApiQueryLanglinks',\r
- // 'links' => 'ApiQueryLinks',\r
- // 'templates' => 'ApiQueryTemplates',\r
- // 'revisions' => 'ApiQueryRevisions',\r
-\r
- // Should be removed\r
- 'content' => 'ApiQueryContent'\r
+ 'revisions' => 'ApiQueryRevisions'\r
);\r
+ // 'categories' => 'ApiQueryCategories',\r
+ // 'imageinfo' => 'ApiQueryImageinfo',\r
+ // 'langlinks' => 'ApiQueryLanglinks',\r
+ // 'links' => 'ApiQueryLinks',\r
+ // 'templates' => 'ApiQueryTemplates',\r
\r
private $mQueryListModules = array (\r
- // 'allpages' => 'ApiQueryAllpages',\r
- // 'backlinks' => 'ApiQueryBacklinks',\r
- // 'categorymembers' => 'ApiQueryCategorymembers',\r
- // 'embeddedin' => 'ApiQueryEmbeddedin',\r
- // 'imagelinks' => 'ApiQueryImagelinks',\r
- // 'logevents' => 'ApiQueryLogevents',\r
- // 'recentchanges' => 'ApiQueryRecentchanges',\r
- // 'usercontribs' => 'ApiQueryUsercontribs',\r
- // 'users' => 'ApiQueryUsers',\r
- // 'watchlist' => 'ApiQueryWatchlist'\r
-\r
- \r
+ 'allpages' => 'ApiQueryAllpages'\r
);\r
+ // 'backlinks' => 'ApiQueryBacklinks',\r
+ // 'categorymembers' => 'ApiQueryCategorymembers',\r
+ // 'embeddedin' => 'ApiQueryEmbeddedin',\r
+ // 'imagelinks' => 'ApiQueryImagelinks',\r
+ // 'logevents' => 'ApiQueryLogevents',\r
+ // 'recentchanges' => 'ApiQueryRecentchanges',\r
+ // 'usercontribs' => 'ApiQueryUsercontribs',\r
+ // 'users' => 'ApiQueryUsers',\r
+ // 'watchlist' => 'ApiQueryWatchlist',\r
\r
private $mSlaveDB = null;\r
\r
$this->mPropModuleNames = array_keys($this->mQueryPropModules);\r
$this->mListModuleNames = array_keys($this->mQueryListModules);\r
\r
+ // Allow the entire list of modules at first,\r
+ // but during module instantiation check if it can be used as a generator.\r
$this->mAllowedGenerators = array_merge($this->mListModuleNames, $this->mPropModuleNames);\r
}\r
\r
// During instantiation, modules may optimize data requests through the $data object \r
// $data will be lazy loaded when modules begin to request data during execution\r
$modules = array ();\r
- if (isset($meta))\r
+ if (isset ($meta))\r
foreach ($meta as $moduleName)\r
- $modules[] = new $this->mQueryMetaModules[$moduleName] ($this->GetMain(), $moduleName, $data);\r
- if (isset($prop))\r
+ $modules[] = new $this->mQueryMetaModules[$moduleName] ($this->GetMain(), $this, $moduleName, $data);\r
+ if (isset ($prop))\r
foreach ($prop as $moduleName)\r
- $modules[] = new $this->mQueryPropModules[$moduleName] ($this->GetMain(), $moduleName, $data);\r
- if (isset($list))\r
+ $modules[] = new $this->mQueryPropModules[$moduleName] ($this->GetMain(), $this, $moduleName, $data);\r
+ if (isset ($list))\r
foreach ($list as $moduleName)\r
- $modules[] = new $this->mQueryListModules[$moduleName] ($this->GetMain(), $moduleName, $data);\r
+ $modules[] = new $this->mQueryListModules[$moduleName] ($this->GetMain(), $this, $moduleName, $data);\r
\r
// Title normalizations\r
foreach ($data->GetNormalizedTitles() as $rawTitleStr => $titleStr) {\r
}\r
\r
protected function ExecuteGenerator($generator, $data, $redirects) {\r
+ \r
+ // Find class that implements requested generator\r
+ if (isset ($this->mQueryListModules[$generator]))\r
+ $className = $this->mQueryListModules[$generator];\r
+ else if (isset ($this->mQueryPropModules[$generator]))\r
+ $className = $this->mQueryPropModules[$generator];\r
+ else\r
+ $this->DieDebug("Unknown generator=$generator");\r
+ \r
+ \r
+ $module = new $className($this->GetMain(), $this, $generator, $data, true);\r
+\r
// TODO: implement\r
$this->DieUsage("Generator execution has not been implemented", 'notimplemented');\r
}\r
return array (\r
'meta' => array (\r
GN_ENUM_ISMULTI => true,\r
- GN_ENUM_CHOICES => $this->mMetaModuleNames\r
+ GN_ENUM_TYPE => $this->mMetaModuleNames\r
),\r
'prop' => array (\r
GN_ENUM_ISMULTI => true,\r
- GN_ENUM_CHOICES => $this->mPropModuleNames\r
+ GN_ENUM_TYPE => $this->mPropModuleNames\r
),\r
'list' => array (\r
GN_ENUM_ISMULTI => true,\r
- GN_ENUM_CHOICES => $this->mListModuleNames\r
+ GN_ENUM_TYPE => $this->mListModuleNames\r
),\r
// 'generator' => array (\r
- // GN_ENUM_CHOICES => $this->mAllowedGenerators\r
+ // GN_ENUM_TYPE => $this->mAllowedGenerators\r
// ),\r
'titles' => array (\r
GN_ENUM_ISMULTI => true\r
\r
$astriks = str_repeat('--- ', 8);\r
$msg .= "\n$astriks Query: Meta $astriks\n\n";\r
- $msg .= $this->MakeHelpMsgHelper($this->mQueryMetaModules, 'meta');\r
+ $msg .= $this->MakeHelpMsgHelper($this->mQueryMetaModules, 'meta');\r
$msg .= "\n$astriks Query: Prop $astriks\n\n";\r
- $msg .= $this->MakeHelpMsgHelper($this->mQueryPropModules, 'prop');\r
+ $msg .= $this->MakeHelpMsgHelper($this->mQueryPropModules, 'prop');\r
$msg .= "\n$astriks Query: List $astriks\n\n";\r
- $msg .= $this->MakeHelpMsgHelper($this->mQueryListModules, 'list');\r
+ $msg .= $this->MakeHelpMsgHelper($this->mQueryListModules, 'list');\r
\r
return $msg;\r
}\r
- \r
+\r
private function MakeHelpMsgHelper($moduleList, $paramName) {\r
$msg = '';\r
\r
foreach ($moduleList as $moduleName => $moduleClass) {\r
$msg .= "* $paramName=$moduleName *";\r
- $module = new $moduleClass ($this->GetMain(), $moduleName, null);\r
+ $module = new $moduleClass ($this->GetMain(), $this, $moduleName, null);\r
$msg2 = $module->MakeHelpMsg();\r
if ($msg2 !== false)\r
$msg .= $msg2;\r
--- /dev/null
+<?php
+
+
+/*
+ * Created on Sep 25, 2006
+ *
+ * API for MediaWiki 1.8+
+ *
+ * Copyright (C) 2006 Yuri Astrakhan <FirstnameLastname@gmail.com>
+ *
+ * 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
\r
abstract class ApiQueryBase extends ApiBase {\r
\r
- private $mQueryModule;\r
+ private $mQueryModule, $mModuleName, $mData, $mGenerator;\r
\r
- public function __construct($main, $query) {\r
+ public function __construct($main, $query, $moduleName, $data, $generator=false) {\r
parent :: __construct($main);\r
$this->mQueryModule = $query;\r
+ $this->mModuleName = $moduleName;\r
+ $this->mData = $data;\r
+ $this->mGenerator = $generator;\r
}\r
\r
/**\r
- * Get the name of the query being executed by this instance \r
+ * Get the main Query module \r
*/\r
public function GetQuery() {\r
return $this->mQueryModule;\r
}\r
\r
/**\r
- * Derived classes return true when they can be used as title generators for other query modules.\r
+ * Get the name of the query being executed by this instance \r
+ */ \r
+ public function GetModuleName() {\r
+ return $this->mModuleName;\r
+ } \r
+ \r
+ /**\r
+ * Get the PageSet object to work on\r
*/\r
- public function GetCanGenerate() {\r
- return false;\r
+ protected function GetData() {\r
+ return $this->mData;\r
}\r
\r
/**\r
* Return true if this instance is being used as a generator.\r
*/\r
protected function GetIsGenerator() {\r
+ return $this->mGenerator;\r
+ }\r
+\r
+ /**\r
+ * Derived classes return true when they can be used as title generators for other query modules.\r
+ */\r
+ public function GetCanGenerate() {\r
return false;\r
}\r
+ \r
+ public static function TitleToKey($title)\r
+ {\r
+ return str_replace(' ', '_', $title);\r
+ }\r
+ public static function KeyToTitle($key)\r
+ {\r
+ return str_replace('_', ' ', $key);\r
+ }\r
}\r
?>
\ No newline at end of file
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() {
'enumparam' => array (
GN_ENUM_DFLT => 'default',
GN_ENUM_ISMULTI => false,
- GN_ENUM_CHOICES => array (
+ GN_ENUM_TYPE => array (
'a',
'b'
)
--- /dev/null
+<?php
+
+
+/*
+ * Created on Sep 7, 2006
+ *
+ * API for MediaWiki 1.8+
+ *
+ * Copyright (C) 2006 Yuri Astrakhan <FirstnameLastname@gmail.com>
+ *
+ * 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
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() {
'siprop' => array (
GN_ENUM_DFLT => 'general',
GN_ENUM_ISMULTI => true,
- GN_ENUM_CHOICES => array (
+ GN_ENUM_TYPE => array (
'general',
'namespaces'
)