Siebrand has uploaded a new change for review.
https://gerrit.wikimedia.org/r/95366
Change subject: Update formatting
......................................................................
Update formatting
Change-Id: I1e6325b628359a557ceaa1e1ae30043aa5fc1402
---
M includes/api/ApiFormatRaw.php
M includes/api/ApiFormatWddx.php
M includes/api/ApiFormatXml.php
M includes/api/ApiHelp.php
M includes/api/ApiImageRotate.php
M includes/api/ApiImport.php
M includes/api/ApiLogin.php
M includes/api/ApiMain.php
M includes/api/ApiModuleManager.php
M includes/api/ApiMove.php
10 files changed, 55 insertions(+), 15 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/66/95366/1
diff --git a/includes/api/ApiFormatRaw.php b/includes/api/ApiFormatRaw.php
index d278efa..45003e9 100644
--- a/includes/api/ApiFormatRaw.php
+++ b/includes/api/ApiFormatRaw.php
@@ -58,6 +58,7 @@
$data = $this->getResultData();
if ( isset( $data['error'] ) ) {
$this->mErrorFallback->execute();
+
return;
}
diff --git a/includes/api/ApiFormatWddx.php b/includes/api/ApiFormatWddx.php
index 5685d93..eb83198 100644
--- a/includes/api/ApiFormatWddx.php
+++ b/includes/api/ApiFormatWddx.php
@@ -40,8 +40,9 @@
// to avoid this.
$expected = "<wddxPacket
version='1.0'><header/><data><string>\xc2\xa0</string></data></wddxPacket>";
if ( function_exists( 'wddx_serialize_value' )
- && !$this->getIsHtml()
- && wddx_serialize_value( "\xc2\xa0" ) ==
$expected ) {
+ && !$this->getIsHtml()
+ && wddx_serialize_value( "\xc2\xa0" ) == $expected
+ ) {
$this->printText( wddx_serialize_value(
$this->getResultData() ) );
} else {
// Don't do newlines and indentation if we weren't asked
diff --git a/includes/api/ApiFormatXml.php b/includes/api/ApiFormatXml.php
index 4ec149c..0917ac7 100644
--- a/includes/api/ApiFormatXml.php
+++ b/includes/api/ApiFormatXml.php
@@ -69,7 +69,7 @@
$this->printText(
self::recXmlPrint( $this->mRootElemName,
$data,
- $this->getIsHtml() ? - 2 : null
+ $this->getIsHtml() ? -2 : null
)
);
}
@@ -193,6 +193,7 @@
$retval .= $indstr . Xml::element( $elemName,
null, $elemValue );
}
}
+
return $retval;
}
@@ -200,14 +201,17 @@
$nt = Title::newFromText( $this->mXslt );
if ( is_null( $nt ) || !$nt->exists() ) {
$this->setWarning( 'Invalid or non-existent stylesheet
specified' );
+
return;
}
if ( $nt->getNamespace() != NS_MEDIAWIKI ) {
$this->setWarning( 'Stylesheet should be in the
MediaWiki namespace.' );
+
return;
}
- if ( substr( $nt->getText(), - 4 ) !== '.xsl' ) {
+ if ( substr( $nt->getText(), -4 ) !== '.xsl' ) {
$this->setWarning( 'Stylesheet should have .xsl
extension.' );
+
return;
}
$this->printText( '<?xml-stylesheet href="' . htmlspecialchars(
$nt->getLocalURL( 'action=raw' ) ) . '" type="text/xsl" ?>' );
diff --git a/includes/api/ApiHelp.php b/includes/api/ApiHelp.php
index 9cafc5b..1aa300a 100644
--- a/includes/api/ApiHelp.php
+++ b/includes/api/ApiHelp.php
@@ -78,9 +78,9 @@
}
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.
diff --git a/includes/api/ApiImageRotate.php b/includes/api/ApiImageRotate.php
index 7a60e83..1a8f2a6 100644
--- a/includes/api/ApiImageRotate.php
+++ b/includes/api/ApiImageRotate.php
@@ -145,6 +145,7 @@
if ( $this->mPageSet === null ) {
$this->mPageSet = new ApiPageSet( $this, 0, NS_FILE );
}
+
return $this->mPageSet;
}
@@ -163,6 +164,7 @@
if ( $permissionErrors ) {
// Just return the first error
$msg = $this->parseMsg( $permissionErrors[0] );
+
return $msg['info'];
}
@@ -191,11 +193,13 @@
if ( $flags ) {
$result += $this->getPageSet()->getFinalParams( $flags
);
}
+
return $result;
}
public function getParamDescription() {
$pageSet = $this->getPageSet();
+
return $pageSet->getFinalParamDescription() + array(
'rotation' => 'Degrees to rotate image clockwise',
'token' => 'Edit token. You can get one of these
through action=tokens',
@@ -216,6 +220,7 @@
public function getPossibleErrors() {
$pageSet = $this->getPageSet();
+
return array_merge(
parent::getPossibleErrors(),
$pageSet->getFinalPossibleErrors()
diff --git a/includes/api/ApiImport.php b/includes/api/ApiImport.php
index f48a822..9253964 100644
--- a/includes/api/ApiImport.php
+++ b/includes/api/ApiImport.php
@@ -99,6 +99,7 @@
public function getAllowedParams() {
global $wgImportSources;
+
return array(
'token' => array(
ApiBase::PARAM_TYPE => 'string',
diff --git a/includes/api/ApiLogin.php b/includes/api/ApiLogin.php
index 13e58b8..18fd0c7 100644
--- a/includes/api/ApiLogin.php
+++ b/includes/api/ApiLogin.php
@@ -52,6 +52,7 @@
'result' => 'Aborted',
'reason' => 'Cannot log in when using a
callback',
) );
+
return;
}
diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php
index c11f16c..61577cb 100644
--- a/includes/api/ApiMain.php
+++ b/includes/api/ApiMain.php
@@ -191,7 +191,7 @@
$this->mResult = new ApiResult( $this );
$this->mEnableWrite = $enableWrite;
- $this->mSquidMaxage = - 1; // flag for
executeActionWithErrorHandling()
+ $this->mSquidMaxage = -1; // flag for
executeActionWithErrorHandling()
$this->mCommit = false;
}
@@ -270,6 +270,7 @@
public function setCacheMode( $mode ) {
if ( !in_array( $mode, array( 'private', 'public',
'anon-public-user-private' ) ) ) {
wfDebug( __METHOD__ . ": unrecognised cache mode
\"$mode\"\n" );
+
// Ignore for forwards-compatibility
return;
}
@@ -278,6 +279,7 @@
// Private wiki, only private headers
if ( $mode !== 'private' ) {
wfDebug( __METHOD__ . ": ignoring request for
$mode cache mode, private wiki\n" );
+
return;
}
}
@@ -337,6 +339,7 @@
if ( $printer === null ) {
$this->dieUsage( "Unrecognized format: {$format}",
'unknown_format' );
}
+
return $printer;
}
@@ -463,6 +466,7 @@
$response->header( "HTTP/1.1 403 $message", true, 403 );
$response->header( 'Cache-Control: no-cache' );
echo "'origin' parameter does not match Origin
header\n";
+
return false;
}
if ( self::matchOrigin( $originParam, $wgCrossSiteAJAXdomains,
$wgCrossSiteAJAXdomainExceptions ) ) {
@@ -470,6 +474,7 @@
$response->header( 'Access-Control-Allow-Credentials:
true' );
$this->getOutput()->addVaryHeader( 'Origin' );
}
+
return true;
}
@@ -489,9 +494,11 @@
return false;
}
}
+
return true;
}
}
+
return false;
}
@@ -510,6 +517,7 @@
array( '.*?', '.' ),
$wildcard
);
+
return "/https?:\/\/$wildcard/";
}
@@ -524,6 +532,7 @@
if ( $this->mCacheMode == 'private' ) {
$response->header( 'Cache-Control: private' );
+
return;
}
@@ -535,6 +544,7 @@
if ( $out->haveCacheVaryCookies() ) {
// Logged in, mark this request private
$response->header( 'Cache-Control:
private' );
+
return;
}
// Logged out, send normal public headers below
@@ -542,6 +552,7 @@
// Logged in or otherwise has session (e.g.
anonymous users who have edited)
// Mark request private
$response->header( 'Cache-Control: private' );
+
return;
} // else no XVO and anonymous, send public headers
below
}
@@ -565,6 +576,7 @@
// Sending a Vary header in this case is harmless, and
protects us
// against conditional calls of setCacheMaxAge().
$response->header( 'Cache-Control: private' );
+
return;
}
@@ -720,6 +732,7 @@
}
}
}
+
return $module;
}
@@ -746,9 +759,11 @@
} else {
$this->dieUsage( "Waiting for a
database server: $lag seconds lagged", 'maxlag' );
}
+
return false;
}
}
+
return true;
}
@@ -759,8 +774,8 @@
protected function checkExecutePermissions( $module ) {
$user = $this->getUser();
if ( $module->isReadMode() && !User::isEveryoneAllowed( 'read'
) &&
- !$user->isAllowed( 'read' ) )
- {
+ !$user->isAllowed( 'read' )
+ ) {
$this->dieUsageMsg( 'readrequired' );
}
if ( $module->isWriteMode() ) {
@@ -881,6 +896,7 @@
$table[rawurlencode( $chars[$i] )] = $chars[$i];
}
}
+
return strtr( rawurlencode( $s ), $table );
}
@@ -896,6 +912,7 @@
*/
public function getVal( $name, $default = null ) {
$this->mParamsUsed[$name] = true;
+
return $this->getRequest()->getVal( $name, $default );
}
@@ -905,6 +922,7 @@
*/
public function getCheck( $name ) {
$this->mParamsUsed[$name] = true;
+
return $this->getRequest()->getCheck( $name );
}
@@ -917,6 +935,7 @@
*/
public function getUpload( $name ) {
$this->mParamsUsed[$name] = true;
+
return $this->getRequest()->getUpload( $name );
}
@@ -932,7 +951,7 @@
// Printer has not yet executed; don't warn that its
parameters are unused
$printerParams = array_map(
array( $this->mPrinter, 'encodeParamName' ),
- array_keys( $this->mPrinter->getFinalParams()
?: array() )
+ array_keys( $this->mPrinter->getFinalParams() ?
: array() )
);
$unusedParams = array_diff( $allParams, $paramsUsed,
$printerParams );
} else {
@@ -1150,6 +1169,7 @@
if ( $wgAPICacheHelpTimeout > 0 ) {
$wgMemc->set( $key, $retval, $wgAPICacheHelpTimeout );
}
+
return $retval;
}
@@ -1180,7 +1200,7 @@
foreach ( self::$mRights as $right => $rightMsg ) {
$groups = User::getGroupsWithPermission( $right );
$msg .= "* " . $right . " *\n " . wfMsgReplaceArgs(
$rightMsg['msg'], $rightMsg['params'] ) .
- "\nGranted to:\n " .
str_replace( '*', 'all', implode( ', ', $groups ) ) . "\n\n";
+ "\nGranted to:\n " . str_replace( '*', 'all',
implode( ', ', $groups ) ) . "\n\n";
}
$msg .= "\n$astriks Formats $astriks\n\n";
@@ -1234,6 +1254,7 @@
*/
public function getShowVersions() {
wfDeprecated( __METHOD__, '1.21' );
+
return false;
}
@@ -1336,6 +1357,7 @@
if ( is_array( $this->mExtraData ) ) {
$result = array_merge( $result, $this->mExtraData );
}
+
return $result;
}
diff --git a/includes/api/ApiModuleManager.php
b/includes/api/ApiModuleManager.php
index 100392b..407e089 100644
--- a/includes/api/ApiModuleManager.php
+++ b/includes/api/ApiModuleManager.php
@@ -97,6 +97,7 @@
// cache this instance in case it is needed
later
$this->mInstances[$moduleName] = $instance;
}
+
return $instance;
}
}
@@ -116,6 +117,7 @@
$result[] = $name;
}
}
+
return $result;
}
@@ -131,6 +133,7 @@
$result[$name] = $grpCls[1];
}
}
+
return $result;
}
diff --git a/includes/api/ApiMove.php b/includes/api/ApiMove.php
index c18036c..c2d0959 100644
--- a/includes/api/ApiMove.php
+++ b/includes/api/ApiMove.php
@@ -61,8 +61,8 @@
if ( $toTitle->getNamespace() == NS_FILE
&& !RepoGroup::singleton()->getLocalRepo()->findFile(
$toTitle )
- && wfFindFile( $toTitle ) )
- {
+ && wfFindFile( $toTitle )
+ ) {
if ( !$params['ignorewarnings'] && $user->isAllowed(
'reupload-shared' ) ) {
$this->dieUsageMsg( 'sharedfile-exists' );
} elseif ( !$user->isAllowed( 'reupload-shared' ) ) {
@@ -115,7 +115,7 @@
// Move subpages
if ( $params['movesubpages'] ) {
$r['subpages'] = $this->moveSubpages( $fromTitle,
$toTitle,
- $params['reason'],
$params['noredirect'] );
+ $params['reason'], $params['noredirect'] );
$result->setIndexedTagName( $r['subpages'], 'subpage' );
if ( $params['movetalk'] ) {
@@ -167,6 +167,7 @@
$retval[] = $r;
}
}
+
return $retval;
}
@@ -219,6 +220,7 @@
public function getParamDescription() {
$p = $this->getModulePrefix();
+
return array(
'from' => "Title of the page you want to move. Cannot
be used together with {$p}fromid",
'fromid' => "Page ID of the page you want to move.
Cannot be used together with {$p}from",
--
To view, visit https://gerrit.wikimedia.org/r/95366
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1e6325b628359a557ceaa1e1ae30043aa5fc1402
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