Siebrand has uploaded a new change for review.
https://gerrit.wikimedia.org/r/95368
Change subject: Update formatting
......................................................................
Update formatting
Change-Id: I3fe42e75c3029dc76d2d1d40609c9a69aae8e987
---
M includes/api/ApiQueryAllLinks.php
M includes/api/ApiQueryAllMessages.php
M includes/api/ApiQueryAllPages.php
M includes/api/ApiQueryAllUsers.php
M includes/api/ApiQueryBacklinks.php
M includes/api/ApiQueryBase.php
M includes/api/ApiQueryBlocks.php
M includes/api/ApiQueryCategories.php
M includes/api/ApiQueryCategoryInfo.php
M includes/api/ApiQueryCategoryMembers.php
10 files changed, 66 insertions(+), 43 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/68/95368/1
diff --git a/includes/api/ApiQueryAllLinks.php
b/includes/api/ApiQueryAllLinks.php
index 47d1bce..47f4505 100644
--- a/includes/api/ApiQueryAllLinks.php
+++ b/includes/api/ApiQueryAllLinks.php
@@ -177,7 +177,7 @@
$count = 0;
$result = $this->getResult();
foreach ( $res as $row ) {
- if ( ++ $count > $limit ) {
+ if ( ++$count > $limit ) {
// We've reached the one extra which shows that
there are additional pages to be had. Stop here...
if ( $params['unique'] ) {
$this->setContinueEnumParameter(
'continue', $row->pl_title );
@@ -258,6 +258,7 @@
if ( !$this->hasNamespace ) {
unset( $allowedParams['namespace'] );
}
+
return $allowedParams;
}
@@ -287,6 +288,7 @@
if ( !$this->hasNamespace ) {
unset( $paramDescription['namespace'] );
}
+
return $paramDescription;
}
@@ -309,6 +311,7 @@
public function getPossibleErrors() {
$m = $this->getModuleName();
$what = $this->descriptionWhat;
+
return array_merge( parent::getPossibleErrors(), array(
array( 'code' => 'params', 'info' => "{$m} cannot
return corresponding page ids in unique {$what}s mode" ),
) );
@@ -319,20 +322,22 @@
$name = $this->getModuleName();
$what = $this->descriptionWhat;
$targets = $this->descriptionTargets;
+
return array(
"api.php?action=query&list={$name}&{$p}from=B&{$p}prop=ids|title"
- => "List $targets with page ids they
are from, including missing ones. Start at B",
+ => "List $targets with page ids they are from,
including missing ones. Start at B",
"api.php?action=query&list={$name}&{$p}unique=&{$p}from=B"
- => "List unique $targets",
+ => "List unique $targets",
"api.php?action=query&generator={$name}&g{$p}unique=&g{$p}from=B"
- => "Gets all $targets, marking the
missing ones",
+ => "Gets all $targets, marking the missing
ones",
"api.php?action=query&generator={$name}&g{$p}from=B"
- => "Gets pages containing the {$what}s",
+ => "Gets pages containing the {$what}s",
);
}
public function getHelpUrls() {
$name = ucfirst( $this->getModuleName() );
+
return "https://www.mediawiki.org/wiki/API:{$name}";
}
}
diff --git a/includes/api/ApiQueryAllMessages.php
b/includes/api/ApiQueryAllMessages.php
index d47c7b7..6b1d5a2 100644
--- a/includes/api/ApiQueryAllMessages.php
+++ b/includes/api/ApiQueryAllMessages.php
@@ -241,10 +241,10 @@
'messages' => 'Which messages to output. "*" (default)
means all messages',
'prop' => 'Which properties to get',
'enableparser' => array( 'Set to enable parser, will
preprocess the wikitext of message',
- 'Will substitute magic
words, handle templates etc.' ),
+ 'Will substitute magic words, handle templates
etc.' ),
'nocontent' => 'If set, do not include the content of
the messages in the output.',
'includelocal' => array( "Also include local messages,
i.e. messages that don't exist in the software but do exist as a MediaWiki:
page.",
- "This lists all
MediaWiki: pages, so it will also list those that aren't 'really' messages such
as Common.js",
+ "This lists all MediaWiki: pages, so it will
also list those that aren't 'really' messages such as Common.js",
),
'title' => 'Page name to use as context when parsing
message (for enableparser option)',
'args' => 'Arguments to be substituted into message',
diff --git a/includes/api/ApiQueryAllPages.php
b/includes/api/ApiQueryAllPages.php
index d95980c..3c24405 100644
--- a/includes/api/ApiQueryAllPages.php
+++ b/includes/api/ApiQueryAllPages.php
@@ -145,7 +145,6 @@
}
$this->addOption( 'DISTINCT' );
-
} elseif ( isset( $params['prlevel'] ) ) {
$this->dieUsage( 'prlevel may not be used without
prtype', 'params' );
}
@@ -186,7 +185,7 @@
$count = 0;
$result = $this->getResult();
foreach ( $res as $row ) {
- if ( ++ $count > $limit ) {
+ if ( ++$count > $limit ) {
// We've reached the one extra which shows that
there are additional pages to be had. Stop here...
$this->setContinueEnumParameter( 'continue',
$row->page_title );
break;
@@ -291,6 +290,7 @@
public function getParamDescription() {
$p = $this->getModulePrefix();
+
return array(
'from' => 'The page title to start enumerating from',
'continue' => 'When more results are available, use
this to continue',
diff --git a/includes/api/ApiQueryAllUsers.php
b/includes/api/ApiQueryAllUsers.php
index 1948a51..68f2487 100644
--- a/includes/api/ApiQueryAllUsers.php
+++ b/includes/api/ApiQueryAllUsers.php
@@ -90,6 +90,7 @@
// no group with the given right(s) exists, no need for
a query
if ( !count( $groups ) ) {
$this->getResult()->setIndexedTagName_internal(
array( 'query', $this->getModuleName() ), '' );
+
return;
}
@@ -111,7 +112,7 @@
// Filter only users that belong to a given group
$this->addTables( 'user_groups', 'ug1' );
$this->addJoinConds( array( 'ug1' => array( 'INNER
JOIN', array( 'ug1.ug_user=user_id',
- 'ug1.ug_group' => $params['group'] ) )
) );
+ 'ug1.ug_group' => $params['group'] ) ) ) );
}
if ( !is_null( $params['excludegroup'] ) && count(
$params['excludegroup'] ) ) {
@@ -126,8 +127,7 @@
}
$this->addJoinConds( array( 'ug1' => array( 'LEFT OUTER
JOIN',
array_merge( array( 'ug1.ug_user=user_id' ),
$exclude )
- )
- ) );
+ ) ) );
$this->addWhere( 'ug1.ug_user IS NULL' );
}
@@ -201,7 +201,7 @@
// Save the last pass's user data
if ( is_array( $lastUserData ) ) {
$fit = $result->addValue( array(
'query', $this->getModuleName() ),
- null, $lastUserData );
+ null, $lastUserData );
$lastUserData = null;
@@ -312,6 +312,7 @@
public function getAllowedParams() {
$userGroups = User::getAllGroups();
+
return array(
'from' => null,
'to' => null,
@@ -360,6 +361,7 @@
public function getParamDescription() {
global $wgActiveUserDays;
+
return array(
'from' => 'The user name to start enumerating from',
'to' => 'The user name to stop enumerating at',
@@ -376,7 +378,7 @@
' rights - Lists rights that the user
has',
' editcount - Adds the edit count of the
user',
' registration - Adds the timestamp of when
the user registered if available (may be blank)',
- ),
+ ),
'limit' => 'How many total user names to return',
'witheditsonly' => 'Only list users who have made
edits',
'activeusers' => "Only list users active in the last
{$wgActiveUserDays} days(s)"
diff --git a/includes/api/ApiQueryBacklinks.php
b/includes/api/ApiQueryBacklinks.php
index 2d1089a..238c8e8 100644
--- a/includes/api/ApiQueryBacklinks.php
+++ b/includes/api/ApiQueryBacklinks.php
@@ -193,7 +193,7 @@
$redirNs = $t->getNamespace();
$redirDBkey = $t->getDBkey();
$titleWhere[] = "{$this->bl_title} = " .
$db->addQuotes( $redirDBkey ) .
- ( $this->hasNS ? " AND {$this->bl_ns} =
{$redirNs}" : '' );
+ ( $this->hasNS ? " AND {$this->bl_ns} =
{$redirNs}" : '' );
$allRedirNs[] = $redirNs;
$allRedirDBkey[] = $redirDBkey;
}
@@ -209,14 +209,14 @@
$from = $this->redirID;
if ( $this->hasNS ) {
$this->addWhere( "{$this->bl_ns} $op $ns OR " .
- "({$this->bl_ns} = $ns AND " .
- "({$this->bl_title} $op $title
OR " .
- "({$this->bl_title} = $title
AND " .
- "{$this->bl_from} $op=
$from)))" );
+ "({$this->bl_ns} = $ns AND " .
+ "({$this->bl_title} $op $title OR " .
+ "({$this->bl_title} = $title AND " .
+ "{$this->bl_from} $op= $from)))" );
} else {
$this->addWhere( "{$this->bl_title} $op $title
OR " .
- "({$this->bl_title} = $title
AND " .
- "{$this->bl_from} $op= $from)"
);
+ "({$this->bl_title} = $title AND " .
+ "{$this->bl_from} $op= $from)" );
}
}
if ( $this->params['filterredir'] == 'redirects' ) {
@@ -268,7 +268,7 @@
$count = 0;
foreach ( $res as $row ) {
- if ( ++ $count > $this->params['limit'] ) {
+ if ( ++$count > $this->params['limit'] ) {
// We've reached the one extra which shows that
there are additional pages to be had. Stop here...
// Continue string preserved in case the
redirect query doesn't pass the limit
$this->continueStr = $this->getContinueStr(
$row->page_id );
@@ -428,7 +428,6 @@
return;
}
$this->redirID = $redirID;
-
}
protected function getContinueStr( $lastPageID ) {
@@ -481,6 +480,7 @@
return $retval;
}
$retval['redirect'] = false;
+
return $retval;
}
@@ -499,6 +499,7 @@
'limit' => "How many total pages to return. If
{$this->bl_code}redirect is enabled, limit applies to each level separately
(which means you may get up to 2 * limit results)."
) );
}
+
return array_merge( $retval, array(
'filterredir' => 'How to filter for redirects',
'limit' => 'How many total pages to return'
diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php
index 8668e04..c620a8f 100644
--- a/includes/api/ApiQueryBase.php
+++ b/includes/api/ApiQueryBase.php
@@ -131,8 +131,10 @@
protected function addFieldsIf( $value, $condition ) {
if ( $condition ) {
$this->addFields( $value );
+
return true;
}
+
return false;
}
@@ -168,8 +170,10 @@
protected function addWhereIf( $value, $condition ) {
if ( $condition ) {
$this->addWhere( $value );
+
return true;
}
+
return false;
}
@@ -292,6 +296,7 @@
if ( $rowcount > $wgAPIMaxDBRows ) {
return false;
}
+
return true;
}
@@ -332,6 +337,7 @@
protected function addPageSubItems( $pageId, $data ) {
$result = $this->getResult();
$result->setIndexedTagName( $data, $this->getModulePrefix() );
+
return $result->addValue( array( 'query', 'pages', intval(
$pageId ) ),
$this->getModuleName(),
$data );
@@ -356,7 +362,8 @@
return false;
}
$result->setIndexedTagName_internal( array( 'query', 'pages',
$pageId,
- $this->getModuleName() ), $elemname );
+ $this->getModuleName() ), $elemname );
+
return true;
}
@@ -382,6 +389,7 @@
if ( is_null( $this->mDb ) ) {
$this->mDb = $this->getQuery()->getDB();
}
+
return $this->mDb;
}
@@ -419,6 +427,7 @@
if ( !$t ) {
$this->dieUsageMsg( array( 'invalidtitle', $title ) );
}
+
return $t->getPrefixedDBkey();
}
@@ -437,6 +446,7 @@
if ( !$t ) {
$this->dieUsageMsg( array( 'invalidtitle', $key ) );
}
+
return $t->getPrefixedText();
}
@@ -446,7 +456,7 @@
* @return string Title part with underscores
*/
public function titlePartToKey( $titlePart ) {
- return substr( $this->titleToKey( $titlePart . 'x' ), 0, - 1 );
+ return substr( $this->titleToKey( $titlePart . 'x' ), 0, -1 );
}
/**
@@ -455,7 +465,7 @@
* @return string Key part with underscores
*/
public function keyPartToTitle( $keyPart ) {
- return substr( $this->keyToTitle( $keyPart . 'x' ), 0, - 1 );
+ return substr( $this->keyToTitle( $keyPart . 'x' ), 0, -1 );
}
/**
@@ -467,10 +477,10 @@
*/
public function getDirectionDescription( $p = '', $extraDirText = '' ) {
return array(
- "In which direction to
enumerate{$extraDirText}",
- " newer - List oldest first. Note:
{$p}start has to be before {$p}end.",
- " older - List newest first (default).
Note: {$p}start has to be later than {$p}end.",
- );
+ "In which direction to enumerate{$extraDirText}",
+ " newer - List oldest first. Note: {$p}start
has to be before {$p}end.",
+ " older - List newest first (default). Note:
{$p}start has to be later than {$p}end.",
+ );
}
/**
@@ -491,6 +501,7 @@
}
$likeQuery = LinkFilter::keepOneWildcard( $likeQuery );
+
return 'el_index ' . $db->buildLike( $likeQuery );
} elseif ( !is_null( $protocol ) ) {
return 'el_index ' . $db->buildLike( "$protocol",
$db->anyString() );
@@ -553,6 +564,7 @@
array( 'invalidtitle', 'title' ),
array( 'invalidtitle', 'key' ),
) );
+
return $errors;
}
}
@@ -587,6 +599,7 @@
if ( $this->mGeneratorPageSet !== null ) {
return $this->mGeneratorPageSet;
}
+
return parent::getPageSet();
}
diff --git a/includes/api/ApiQueryBlocks.php b/includes/api/ApiQueryBlocks.php
index e3c27f5..8dad635 100644
--- a/includes/api/ApiQueryBlocks.php
+++ b/includes/api/ApiQueryBlocks.php
@@ -72,8 +72,8 @@
$this->addFieldsIf( 'ipb_reason', $fld_reason );
$this->addFieldsIf( array( 'ipb_range_start', 'ipb_range_end'
), $fld_range );
$this->addFieldsIf( array( 'ipb_anon_only',
'ipb_create_account', 'ipb_enable_autoblock',
-
'ipb_block_email', 'ipb_deleted', 'ipb_allow_usertalk' ),
- $fld_flags );
+ 'ipb_block_email', 'ipb_deleted', 'ipb_allow_usertalk'
),
+ $fld_flags );
$this->addOption( 'LIMIT', $params['limit'] + 1 );
$this->addTimestampWhereRange( 'ipb_timestamp', $params['dir'],
$params['start'], $params['end'] );
@@ -134,9 +134,9 @@
/* Check for conflicting parameters. */
if ( ( isset( $show['account'] ) && isset(
$show['!account'] ) )
- || ( isset( $show['ip'] ) && isset(
$show['!ip'] ) )
- || ( isset( $show['range'] ) && isset(
$show['!range'] ) )
- || ( isset( $show['temp'] ) && isset(
$show['!temp'] ) )
+ || ( isset( $show['ip'] ) && isset(
$show['!ip'] ) )
+ || ( isset( $show['range'] ) && isset(
$show['!range'] ) )
+ || ( isset( $show['temp'] ) && isset(
$show['!temp'] ) )
) {
$this->dieUsageMsg( 'show' );
}
@@ -309,6 +309,7 @@
public function getParamDescription() {
global $wgBlockCIDRLimit;
$p = $this->getModulePrefix();
+
return array(
'start' => 'The timestamp to start enumerating from',
'end' => 'The timestamp to stop enumerating at',
@@ -402,6 +403,7 @@
public function getPossibleErrors() {
global $wgBlockCIDRLimit;
+
return array_merge( parent::getPossibleErrors(),
$this->getRequireOnlyOneParameterErrorMessages( array(
'users', 'ip' ) ),
array(
diff --git a/includes/api/ApiQueryCategories.php
b/includes/api/ApiQueryCategories.php
index 5d714f5..e62305a 100644
--- a/includes/api/ApiQueryCategories.php
+++ b/includes/api/ApiQueryCategories.php
@@ -98,8 +98,7 @@
if ( isset( $show['hidden'] ) && isset( $show['!hidden'] ) ) {
$this->dieUsageMsg( 'show' );
}
- if ( isset( $show['hidden'] ) || isset( $show['!hidden'] ) ||
isset( $prop['hidden'] ) )
- {
+ if ( isset( $show['hidden'] ) || isset( $show['!hidden'] ) ||
isset( $prop['hidden'] ) ) {
$this->addOption( 'STRAIGHT_JOIN' );
$this->addTables( array( 'page', 'page_props' ) );
$this->addFieldsIf( 'pp_propname', isset(
$prop['hidden'] ) );
@@ -126,9 +125,9 @@
$this->addOption( 'ORDER BY', 'cl_to' . $sort );
} else {
$this->addOption( 'ORDER BY', array(
- 'cl_from' . $sort,
- 'cl_to' . $sort
- ));
+ 'cl_from' . $sort,
+ 'cl_to' . $sort
+ ) );
}
$res = $this->select( __METHOD__ );
diff --git a/includes/api/ApiQueryCategoryInfo.php
b/includes/api/ApiQueryCategoryInfo.php
index a889272..4e78f02 100644
--- a/includes/api/ApiQueryCategoryInfo.php
+++ b/includes/api/ApiQueryCategoryInfo.php
@@ -45,7 +45,7 @@
$categories = $alltitles[NS_CATEGORY];
$titles = $this->getPageSet()->getGoodTitles() +
- $this->getPageSet()->getMissingTitles();
+ $this->getPageSet()->getMissingTitles();
$cattitles = array();
foreach ( $categories as $c ) {
/** @var $t Title */
diff --git a/includes/api/ApiQueryCategoryMembers.php
b/includes/api/ApiQueryCategoryMembers.php
index 704d108..9dc7a32 100644
--- a/includes/api/ApiQueryCategoryMembers.php
+++ b/includes/api/ApiQueryCategoryMembers.php
@@ -180,7 +180,7 @@
$result = $this->getResult();
$count = 0;
foreach ( $rows as $row ) {
- if ( ++ $count > $limit ) {
+ if ( ++$count > $limit ) {
// We've reached the one extra which shows that
there are additional pages to be had. Stop here...
// TODO: Security issue - if the user has no
right to view next title, it will still be shown
if ( $params['sort'] == 'timestamp' ) {
@@ -224,7 +224,7 @@
$vals['timestamp'] = wfTimestamp(
TS_ISO_8601, $row->cl_timestamp );
}
$fit = $result->addValue( array( 'query',
$this->getModuleName() ),
- null, $vals );
+ null, $vals );
if ( !$fit ) {
if ( $params['sort'] == 'timestamp' ) {
$this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601,
$row->cl_timestamp ) );
@@ -357,6 +357,7 @@
"Note that you can use {$p}type=subcat or
{$p}type=file instead of {$p}namespace=14 or 6.",
);
}
+
return $desc;
}
--
To view, visit https://gerrit.wikimedia.org/r/95368
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3fe42e75c3029dc76d2d1d40609c9a69aae8e987
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Siebrand <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits