summaryrefslogtreecommitdiff
path: root/includes/api/ApiHelp.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2014-12-27 15:41:37 +0100
committerPierre Schmitz <pierre@archlinux.de>2014-12-31 11:43:28 +0100
commitc1f9b1f7b1b77776192048005dcc66dcf3df2bfb (patch)
tree2b38796e738dd74cb42ecd9bfd151803108386bc /includes/api/ApiHelp.php
parentb88ab0086858470dd1f644e64cb4e4f62bb2be9b (diff)
Update to MediaWiki 1.24.1
Diffstat (limited to 'includes/api/ApiHelp.php')
-rw-r--r--includes/api/ApiHelp.php32
1 files changed, 20 insertions, 12 deletions
diff --git a/includes/api/ApiHelp.php b/includes/api/ApiHelp.php
index 9cafc5bb..bcd6c12e 100644
--- a/includes/api/ApiHelp.php
+++ b/includes/api/ApiHelp.php
@@ -30,7 +30,6 @@
* @ingroup API
*/
class ApiHelp extends ApiBase {
-
/**
* Module for displaying help
*/
@@ -52,6 +51,7 @@ class ApiHelp extends ApiBase {
}
if ( is_array( $params['querymodules'] ) ) {
+ $this->logFeatureUsage( 'action=help&querymodules' );
$queryModules = $params['querymodules'];
foreach ( $queryModules as $m ) {
$modules[] = 'query+' . $m;
@@ -68,19 +68,22 @@ class ApiHelp extends ApiBase {
// In case the '+' was typed into URL, it resolves as a space
$subNames = explode( ' ', $m );
}
+
$module = $this->getMain();
- for ( $i = 0; $i < count( $subNames ); $i++ ) {
+ $subNamesCount = count( $subNames );
+ for ( $i = 0; $i < $subNamesCount; $i++ ) {
$subs = $module->getModuleManager();
if ( $subs === null ) {
$module = null;
} else {
$module = $subs->getModule( $subNames[$i] );
}
+
if ( $module === null ) {
if ( count( $subNames ) === 2
- && $i === 1
- && $subNames[0] === 'query'
- && in_array( $subNames[1], $queryModules )
+ && $i === 1
+ && $subNames[0] === 'query'
+ && in_array( $subNames[1], $queryModules )
) {
// Legacy: This is one of the renamed 'querymodule=...' parameters,
// do not use '+' notation in the output, use submodule's name instead.
@@ -94,6 +97,7 @@ class ApiHelp extends ApiBase {
$type = $subs->getModuleGroup( $subNames[$i] );
}
}
+
if ( $module !== null ) {
$r[] = $this->buildModuleHelp( $module, $type );
}
@@ -104,8 +108,8 @@ class ApiHelp extends ApiBase {
}
/**
- * @param $module ApiBase
- * @param $type String What type of request is this? e.g. action, query, list, prop, meta, format
+ * @param ApiBase $module
+ * @param string $type What type of request is this? e.g. action, query, list, prop, meta, format
* @return string
*/
private function buildModuleHelp( $module, $type ) {
@@ -141,21 +145,25 @@ class ApiHelp extends ApiBase {
public function getParamDescription() {
return array(
- 'modules' => 'List of module names (value of the action= parameter). Can specify submodules with a \'+\'',
- 'querymodules' => 'Use modules=query+value instead. List of query module names (value of prop=, meta= or list= parameter)',
+ 'modules' => 'List of module names (value of the action= parameter). ' .
+ 'Can specify submodules with a \'+\'',
+ 'querymodules' => 'Use modules=query+value instead. List of query ' .
+ 'module names (value of prop=, meta= or list= parameter)',
);
}
public function getDescription() {
- return 'Display this help screen. Or the help screen for the specified module';
+ return 'Display this help screen. Or the help screen for the specified module.';
}
public function getExamples() {
return array(
'api.php?action=help' => 'Whole help page',
'api.php?action=help&modules=protect' => 'Module (action) help page',
- 'api.php?action=help&modules=query+categorymembers' => 'Help for the query/categorymembers module',
- 'api.php?action=help&modules=login|query+info' => 'Help for the login and query/info modules',
+ 'api.php?action=help&modules=query+categorymembers'
+ => 'Help for the query/categorymembers module',
+ 'api.php?action=help&modules=login|query+info'
+ => 'Help for the login and query/info modules',
);
}