Siebrand has uploaded a new change for review.
https://gerrit.wikimedia.org/r/95367
Change subject: Update formatting
......................................................................
Update formatting
Change-Id: I526be68e21836201c992b391a81f4d41e1fa801e
---
M includes/api/ApiOpenSearch.php
M includes/api/ApiPageSet.php
M includes/api/ApiParamInfo.php
M includes/api/ApiParse.php
M includes/api/ApiPatrol.php
M includes/api/ApiProtect.php
M includes/api/ApiPurge.php
M includes/api/ApiQuery.php
M includes/api/ApiQueryAllCategories.php
M includes/api/ApiQueryAllImages.php
10 files changed, 62 insertions(+), 21 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/67/95367/1
diff --git a/includes/api/ApiOpenSearch.php b/includes/api/ApiOpenSearch.php
index 315ace3..433b743 100644
--- a/includes/api/ApiOpenSearch.php
+++ b/includes/api/ApiOpenSearch.php
@@ -40,6 +40,7 @@
if ( in_array( $format, $allowed ) ) {
return $this->getMain()->createPrinterByName( $format );
}
+
return $this->getMain()->createPrinterByName( $allowed[0] );
}
diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php
index b05cb2b..cfbc095 100644
--- a/includes/api/ApiPageSet.php
+++ b/includes/api/ApiPageSet.php
@@ -244,6 +244,7 @@
if ( isset( $this->mParams['revids'] ) ) {
return 'revids';
}
+
return null;
}
@@ -289,6 +290,7 @@
$this->mRequestedPageFields = array_diff_key(
$this->mRequestedPageFields, $pageFlds );
$pageFlds = array_merge( $pageFlds, $this->mRequestedPageFields
);
+
return array_keys( $pageFlds );
}
@@ -391,6 +393,7 @@
if ( !empty( $values ) && $result ) {
$result->setIndexedTagName( $values, 'r' );
}
+
return $values;
}
@@ -421,6 +424,7 @@
if ( !empty( $values ) && $result ) {
$result->setIndexedTagName( $values, 'n' );
}
+
return $values;
}
@@ -451,6 +455,7 @@
if ( !empty( $values ) && $result ) {
$result->setIndexedTagName( $values, 'c' );
}
+
return $values;
}
@@ -487,6 +492,7 @@
if ( !empty( $values ) && $result ) {
$result->setIndexedTagName( $values, 'i' );
}
+
return $values;
}
@@ -522,6 +528,7 @@
if ( !empty( $values ) && $result ) {
$result->setIndexedTagName( $values, 'rev' );
}
+
return $values;
}
@@ -642,7 +649,7 @@
// Get pageIDs data from the `page` table
$this->profileDBIn();
$res = $db->select( 'page', $this->getPageTableFields(), $set,
- __METHOD__ );
+ __METHOD__ );
$this->profileDBOut();
// Hack: get the ns:titles stored in array(ns => array(titles))
format
@@ -676,7 +683,7 @@
// Get pageIDs data from the `page` table
$this->profileDBIn();
$res = $db->select( 'page',
$this->getPageTableFields(), $set,
- __METHOD__ );
+ __METHOD__ );
$this->profileDBOut();
}
@@ -886,6 +893,7 @@
unset( $this->mPendingRedirectIDs[$id] );
}
}
+
return $lb;
}
@@ -941,8 +949,9 @@
// Variants checking
global $wgContLang;
if ( $this->mConvertTitles &&
- count(
$wgContLang->getVariants() ) > 1 &&
- !$titleObj->exists() ) {
+ count( $wgContLang->getVariants() ) > 1
&&
+ !$titleObj->exists()
+ ) {
// Language::findVariantLink will
modify titleText and titleObj into
// the canonical variant if possible
$titleText = is_string( $title ) ?
$title : $titleObj->getPrefixedText();
@@ -1040,6 +1049,7 @@
$result['generator'] = null;
}
}
+
return $result;
}
@@ -1067,6 +1077,7 @@
sort( $gens );
self::$generators = $gens;
}
+
return self::$generators;
}
diff --git a/includes/api/ApiParamInfo.php b/includes/api/ApiParamInfo.php
index 3e1a753..7ecf71f 100644
--- a/includes/api/ApiParamInfo.php
+++ b/includes/api/ApiParamInfo.php
@@ -317,6 +317,7 @@
sort( $querymodules );
$formatmodules =
$this->getMain()->getModuleManager()->getNames( 'format' );
sort( $formatmodules );
+
return array(
'modules' => array(
ApiBase::PARAM_ISMULTI => true,
diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php
index 301affb..91a3a99 100644
--- a/includes/api/ApiParse.php
+++ b/includes/api/ApiParse.php
@@ -125,7 +125,7 @@
'action' => 'query',
'redirects' => '',
);
- if ( !is_null ( $pageid ) ) {
+ if ( !is_null( $pageid ) ) {
$reqParams['pageids'] = $pageid;
} else { // $page
$reqParams['titles'] = $page;
@@ -219,6 +219,7 @@
ApiResult::setContent(
$result_array['wikitext'], $this->content->serialize( $format ) );
}
$result->addValue( null,
$this->getModuleName(), $result_array );
+
return;
}
@@ -300,8 +301,8 @@
if ( isset( $prop['displaytitle'] ) ) {
$result_array['displaytitle'] =
$p_result->getDisplayTitle() ?
-
$p_result->getDisplayTitle() :
-
$titleObj->getPrefixedText();
+ $p_result->getDisplayTitle() :
+ $titleObj->getPrefixedText();
}
if ( isset( $prop['headitems'] ) || isset( $prop['headhtml'] )
) {
@@ -395,6 +396,7 @@
$popts->setIsSectionPreview( $params['sectionpreview'] );
wfProfileOut( __METHOD__ );
+
return $popts;
}
@@ -425,6 +427,7 @@
if ( $getWikitext ) {
$this->content = $page->getContent(
Revision::RAW );
}
+
return $pout;
}
}
@@ -439,6 +442,7 @@
$this->dieUsage( "Sections are not supported by " .
$what, 'nosuchsection' );
$section = false;
}
+
return $section;
}
@@ -456,6 +460,7 @@
ApiResult::setContent( $entry, $bits[1] );
$result[] = $entry;
}
+
return $result;
}
@@ -502,6 +507,7 @@
private function categoriesHtml( $categories ) {
$context = $this->getContext();
$context->getOutput()->addCategoryLinks( $categories );
+
return $context->getSkin()->getCategories();
}
@@ -554,6 +560,7 @@
$result[] = $entry;
}
}
+
return $result;
}
@@ -573,6 +580,7 @@
$result[] = $entry;
}
}
+
return $result;
}
@@ -584,6 +592,7 @@
ApiResult::setContent( $entry, $content );
$result[] = $entry;
}
+
return $result;
}
@@ -595,6 +604,7 @@
ApiResult::setContent( $entry, $value );
$result[] = $entry;
}
+
return $result;
}
@@ -606,6 +616,7 @@
ApiResult::setContent( $entry, $link );
$result[] = $entry;
}
+
return $result;
}
@@ -674,6 +685,7 @@
public function getParamDescription() {
$p = $this->getModulePrefix();
$wikitext = CONTENT_MODEL_WIKITEXT;
+
return array(
'text' => "Text to parse. Use {$p}title or
{$p}contentmodel to control the content model",
'summary' => 'Summary to parse',
@@ -736,6 +748,7 @@
public function getDescription() {
$p = $this->getModulePrefix();
+
return array(
'Parses content and returns parser output',
'See the various prop-Modules of action=query to get
information from the current version of a page',
diff --git a/includes/api/ApiPatrol.php b/includes/api/ApiPatrol.php
index bd2fde2..46bd94e 100644
--- a/includes/api/ApiPatrol.php
+++ b/includes/api/ApiPatrol.php
@@ -123,7 +123,8 @@
'code' => 'notpatrollable',
'info' => "The revision can't be
patrolled as it's too old"
)
- ) );
+ )
+ );
}
public function needsToken() {
diff --git a/includes/api/ApiProtect.php b/includes/api/ApiProtect.php
index 428eef3..25727d0 100644
--- a/includes/api/ApiProtect.php
+++ b/includes/api/ApiProtect.php
@@ -90,9 +90,9 @@
$expiryarray[$p[0]] = $exp;
}
$resultProtections[] = array( $p[0] =>
$protections[$p[0]],
- 'expiry' => ( $expiryarray[$p[0]] ==
$db->getInfinity() ?
- 'infinite' :
- wfTimestamp(
TS_ISO_8601, $expiryarray[$p[0]] ) ) );
+ 'expiry' => ( $expiryarray[$p[0]] ==
$db->getInfinity() ?
+ 'infinite' :
+ wfTimestamp( TS_ISO_8601,
$expiryarray[$p[0]] ) ) );
}
$cascade = $params['cascade'];
@@ -167,16 +167,17 @@
public function getParamDescription() {
$p = $this->getModulePrefix();
+
return array(
'title' => "Title of the page you want to (un)protect.
Cannot be used together with {$p}pageid",
'pageid' => "ID of the page you want to (un)protect.
Cannot be used together with {$p}title",
'token' => 'A protect token previously retrieved
through prop=info',
'protections' => 'List of protection levels, formatted
action=group (e.g. edit=sysop)',
'expiry' => array( 'Expiry timestamps. If only one
timestamp is set, it\'ll be used for all protections.',
- 'Use \'infinite\', \'indefinite\' or
\'never\', for a never-expiring protection.' ),
+ 'Use \'infinite\', \'indefinite\' or \'never\',
for a never-expiring protection.' ),
'reason' => 'Reason for (un)protecting',
'cascade' => array( 'Enable cascading protection (i.e.
protect pages included in this page)',
- 'Ignored if not all protection levels
are \'sysop\' or \'protect\'' ),
+ 'Ignored if not all protection levels are
\'sysop\' or \'protect\'' ),
'watch' => 'If set, add the page being (un)protected to
your watchlist',
'watchlist' => 'Unconditionally add or remove the page
from your watchlist, use preferences or do not change watch',
);
diff --git a/includes/api/ApiPurge.php b/includes/api/ApiPurge.php
index 0812ba5..4c7981e 100644
--- a/includes/api/ApiPurge.php
+++ b/includes/api/ApiPurge.php
@@ -139,6 +139,7 @@
if ( !isset( $this->mPageSet ) ) {
$this->mPageSet = new ApiPageSet( $this );
}
+
return $this->mPageSet;
}
@@ -159,6 +160,7 @@
if ( $flags ) {
$result += $this->getPageSet()->getFinalParams( $flags
);
}
+
return $result;
}
diff --git a/includes/api/ApiQuery.php b/includes/api/ApiQuery.php
index e03837f..ea57196 100644
--- a/includes/api/ApiQuery.php
+++ b/includes/api/ApiQuery.php
@@ -163,6 +163,7 @@
$this->mNamedDB[$name] = wfGetDB( $db, $groups );
$this->profileDBOut();
}
+
return $this->mNamedDB[$name];
}
@@ -181,6 +182,7 @@
*/
public function getModules() {
wfDeprecated( __METHOD__, '1.21' );
+
return $this->getModuleManager()->getNamesWithClasses();
}
@@ -197,6 +199,7 @@
$gens[$name] = $class;
}
}
+
return $gens;
}
@@ -216,8 +219,8 @@
public function getCustomPrinter() {
// If &exportnowrap is set, use the raw formatter
if ( $this->getParameter( 'export' ) &&
- $this->getParameter( 'exportnowrap' ) )
- {
+ $this->getParameter( 'exportnowrap' )
+ ) {
return new ApiFormatRaw( $this->getMain(),
$this->getMain()->createPrinterByName( 'xml' )
);
} else {
@@ -407,6 +410,7 @@
}
}
$this->dieContinueUsageIf( $completeModules !== null && count(
$tmp ) !== 0 );
+
return $modules;
}
@@ -429,6 +433,7 @@
} else { // private
$cacheMode = 'private';
}
+
return $cacheMode;
}
@@ -514,10 +519,12 @@
ApiQueryBase::addTitleInfo( $vals, $title );
$vals['special'] = '';
if ( $title->isSpecialPage() &&
- !SpecialPageFactory::exists(
$title->getDBkey() ) ) {
+ !SpecialPageFactory::exists( $title->getDBkey()
)
+ ) {
$vals['missing'] = '';
} elseif ( $title->getNamespace() == NS_MEDIA &&
- !wfFindFile( $title ) ) {
+ !wfFindFile( $title )
+ ) {
$vals['missing'] = '';
}
$pages[$fakeId] = $vals;
@@ -566,6 +573,7 @@
$this->mGeneratorContinue = array();
}
$this->mGeneratorContinue[$paramName] = $paramValue;
+
return true;
}
@@ -638,6 +646,7 @@
if ( $flags ) {
$result += $this->getPageSet()->getFinalParams( $flags
);
}
+
return $result;
}
diff --git a/includes/api/ApiQueryAllCategories.php
b/includes/api/ApiQueryAllCategories.php
index 3f5c6ee..5ef71f0 100644
--- a/includes/api/ApiQueryAllCategories.php
+++ b/includes/api/ApiQueryAllCategories.php
@@ -109,7 +109,7 @@
$result = $this->getResult();
$count = 0;
foreach ( $res as $row ) {
- if ( ++ $count > $params['limit'] ) {
+ if ( ++$count > $params['limit'] ) {
// We've reached the one extra which shows that
there are additional cats to be had. Stop here...
$this->setContinueEnumParameter( 'continue',
$row->cat_title );
break;
diff --git a/includes/api/ApiQueryAllImages.php
b/includes/api/ApiQueryAllImages.php
index ccc7a3a..5baee8d 100644
--- a/includes/api/ApiQueryAllImages.php
+++ b/includes/api/ApiQueryAllImages.php
@@ -107,7 +107,7 @@
}
}
if ( $params['filterbots'] != 'all' ) {
- $this->dieUsage( "Parameter
'{$prefix}filterbots' can only be used with {$prefix}sort=timestamp",
'badparams' );
+ $this->dieUsage( "Parameter
'{$prefix}filterbots' can only be used with {$prefix}sort=timestamp",
'badparams' );
}
// Pagination
@@ -156,7 +156,7 @@
'ug_user = img_user'
)
) ) );
- $groupCond = ( $params['filterbots'] ==
'nobots' ? 'NULL': 'NOT NULL' );
+ $groupCond = ( $params['filterbots'] ==
'nobots' ? 'NULL' : 'NOT NULL' );
$this->addWhere( "ug_group IS $groupCond" );
}
}
@@ -222,7 +222,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['sort'] == 'name' ) {
$this->setContinueEnumParameter(
'continue', $row->img_name );
@@ -326,6 +326,7 @@
public function getParamDescription() {
$p = $this->getModulePrefix();
+
return array(
'sort' => 'Property to sort by',
'dir' => 'The direction in which to list',
@@ -368,6 +369,7 @@
public function getPossibleErrors() {
$p = $this->getModulePrefix();
+
return array_merge( parent::getPossibleErrors(), array(
array( 'code' => 'params', 'info' => 'Use
"gaifilterredir=nonredirects" option instead of "redirects" when using
allimages as a generator' ),
array( 'code' => 'badparams', 'info' =>
"Parameter'{$p}start' can only be used with {$p}sort=timestamp" ),
--
To view, visit https://gerrit.wikimedia.org/r/95367
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I526be68e21836201c992b391a81f4d41e1fa801e
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