jenkins-bot has submitted this change and it was merged.
Change subject: Try to make a dent in CodeSniffer reports on includes/ (1)
......................................................................
Try to make a dent in CodeSniffer reports on includes/ (1)
Change-Id: Iaf3120b4e32cc5835ef9ed86236d98679e2b87fa
---
M includes/AjaxResponse.php
M includes/Article.php
M includes/Autopromote.php
M includes/Block.php
M includes/CacheHelper.php
M includes/Category.php
M includes/CategoryViewer.php
M includes/ChangeTags.php
M includes/DefaultSettings.php
M includes/Export.php
10 files changed, 248 insertions(+), 98 deletions(-)
Approvals:
Chad: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/AjaxResponse.php b/includes/AjaxResponse.php
index 334cee3..4b5ca75 100644
--- a/includes/AjaxResponse.php
+++ b/includes/AjaxResponse.php
@@ -28,7 +28,6 @@
* @ingroup Ajax
*/
class AjaxResponse {
-
/**
* Number of seconds to get the response cached by a proxy
* @var int $mCacheDuration
@@ -184,10 +183,10 @@
}
} else {
-
# Let the client do the caching. Cache is not
purged.
header ( "Expires: " . gmdate( "D, d M Y
H:i:s", time() + $this->mCacheDuration ) . " GMT" );
- header ( "Cache-Control:
s-maxage={$this->mCacheDuration},public,max-age={$this->mCacheDuration}" );
+ header ( "Cache-Control:
s-maxage={$this->mCacheDuration}," .
+
"public,max-age={$this->mCacheDuration}" );
}
} else {
@@ -237,17 +236,22 @@
wfDebug( "$fname: -- client send If-Modified-Since: " .
$modsince . "\n", 'log' );
wfDebug( "$fname: -- we might send Last-Modified :
$lastmod\n", 'log' );
- if ( ( $ismodsince >= $timestamp ) &&
$wgUser->validateCache( $ismodsince ) && $ismodsince >= $wgCacheEpoch ) {
+ if ( ( $ismodsince >= $timestamp )
+ && $wgUser->validateCache( $ismodsince ) &&
+ $ismodsince >= $wgCacheEpoch
+ ) {
ini_set( 'zlib.output_compression', 0 );
$this->setResponseCode( "304 Not Modified" );
$this->disable();
$this->mLastModified = $lastmod;
- wfDebug( "$fname: CACHED client: $ismodsince ;
user: {$wgUser->getTouched()} ; page: $timestamp ; site $wgCacheEpoch\n", 'log'
);
+ wfDebug( "$fname: CACHED client: $ismodsince ;
user: {$wgUser->getTouched()} ; " .
+ "page: $timestamp ; site
$wgCacheEpoch\n", 'log' );
return true;
} else {
- wfDebug( "$fname: READY client: $ismodsince ;
user: {$wgUser->getTouched()} ; page: $timestamp ; site $wgCacheEpoch\n", 'log'
);
+ wfDebug( "$fname: READY client: $ismodsince ;
user: {$wgUser->getTouched()} ; " .
+ "page: $timestamp ; site
$wgCacheEpoch\n", 'log' );
$this->mLastModified = $lastmod;
}
} else {
diff --git a/includes/Article.php b/includes/Article.php
index b132ca9..d45b332 100644
--- a/includes/Article.php
+++ b/includes/Article.php
@@ -367,9 +367,11 @@
* Does *NOT* follow redirects.
*
* @protected
- * @note this is really internal functionality that should really NOT
be used by other functions. For accessing
- * article content, use the WikiPage class, especially
WikiBase::getContent(). However, a lot of legacy code
- * uses this method to retrieve page text from the database, so
the function has to remain public for now.
+ * @note This is really internal functionality that should really NOT be
+ * used by other functions. For accessing article content, use the
WikiPage
+ * class, especially WikiBase::getContent(). However, a lot of legacy
code
+ * uses this method to retrieve page text from the database, so the
function
+ * has to remain public for now.
*
* @return mixed string containing article contents, or false if null
* @deprecated in 1.21, use WikiPage::getContent() instead
@@ -397,9 +399,10 @@
/**
* Get text content object
* Does *NOT* follow redirects.
- * TODO: when is this null?
+ * @todo When is this null?
*
- * @note code that wants to retrieve page content from the database
should use WikiPage::getContent().
+ * @note Code that wants to retrieve page content from the database
should
+ * use WikiPage::getContent().
*
* @return Content|null|boolean false
*
@@ -434,7 +437,8 @@
}
} else {
if ( !$this->mPage->getLatest() ) {
- wfDebug( __METHOD__ . " failed to find page
data for title " . $this->getTitle()->getPrefixedText() . "\n" );
+ wfDebug( __METHOD__ . " failed to find page
data for title " .
+ $this->getTitle()->getPrefixedText() .
"\n" );
wfProfileOut( __METHOD__ );
return false;
}
@@ -442,7 +446,8 @@
$this->mRevision = $this->mPage->getRevision();
if ( !$this->mRevision ) {
- wfDebug( __METHOD__ . " failed to retrieve
current page, rev_id " . $this->mPage->getLatest() . "\n" );
+ wfDebug( __METHOD__ . " failed to retrieve
current page, rev_id " .
+ $this->mPage->getLatest() . "\n" );
wfProfileOut( __METHOD__ );
return false;
}
@@ -450,7 +455,11 @@
// @todo FIXME: Horrible, horrible! This content-loading
interface just plain sucks.
// We should instead work with the Revision object when we need
it...
- $this->mContentObject = $this->mRevision->getContent(
Revision::FOR_THIS_USER, $this->getContext()->getUser() ); // Loads if user is
allowed
+ // Loads if user is allowed
+ $this->mContentObject = $this->mRevision->getContent(
+ Revision::FOR_THIS_USER,
+ $this->getContext()->getUser()
+ );
$this->mRevIdFetched = $this->mRevision->getId();
wfRunHooks( 'ArticleAfterFetchContentObject', array( &$this,
&$this->mContentObject ) );
@@ -711,7 +720,8 @@
# Don't cache a dirty ParserOutput
object
if ( $poolArticleView->getIsDirty() ) {
$outputPage->setSquidMaxage( 0
);
- $outputPage->addHTML( "<!--
parser cache is expired, sending anyway due to pool overload-->\n" );
+ $outputPage->addHTML( "<!--
parser cache is expired, " .
+ "sending anyway due to
pool overload-->\n" );
}
$outputDone = true;
@@ -794,13 +804,21 @@
}
$contentHandler = $rev->getContentHandler();
- $de = $contentHandler->createDifferenceEngine(
$this->getContext(), $oldid, $diff, $rcid, $purge, $unhide );
+ $de = $contentHandler->createDifferenceEngine(
+ $this->getContext(),
+ $oldid,
+ $diff,
+ $rcid,
+ $purge,
+ $unhide
+ );
// DifferenceEngine directly fetched the revision:
$this->mRevIdFetched = $de->mNewid;
$de->showDiffPage( $diffOnly );
- // Run view updates for the newer revision being diffed (and
shown below the diff if not $diffOnly)
+ // Run view updates for the newer revision being diffed (and
shown
+ // below the diff if not $diffOnly).
list( $old, $new ) = $de->mapDiffPrevNext( $oldid, $diff );
// New can be false, convert it to 0 - this conveniently means
the latest revision
$this->mPage->doViewUpdates( $user, (int)$new );
@@ -813,7 +831,8 @@
* This is hooked by SyntaxHighlight_GeSHi to do syntax highlighting of
these
* page views.
*
- * @param bool $showCacheHint whether to show a message telling the
user to clear the browser cache (default: true).
+ * @param bool $showCacheHint whether to show a message telling the user
+ * to clear the browser cache (default: true).
*/
protected function showCssOrJsPage( $showCacheHint = true ) {
$outputPage = $this->getContext()->getOutput();
@@ -822,15 +841,20 @@
$dir = $this->getContext()->getLanguage()->getDir();
$lang = $this->getContext()->getLanguage()->getCode();
- $outputPage->wrapWikiMsg( "<div id='mw-clearyourcache'
lang='$lang' dir='$dir' class='mw-content-$dir'>\n$1\n</div>",
- 'clearyourcache' );
+ $outputPage->wrapWikiMsg(
+ "<div id='mw-clearyourcache' lang='$lang'
dir='$dir' class='mw-content-$dir'>\n$1\n</div>",
+ 'clearyourcache'
+ );
}
$this->fetchContentObject();
if ( $this->mContentObject ) {
// Give hooks a chance to customise the output
- if ( ContentHandler::runLegacyHooks( 'ShowRawCssJs',
array( $this->mContentObject, $this->getTitle(), $outputPage ) ) ) {
+ if ( ContentHandler::runLegacyHooks(
+ 'ShowRawCssJs',
+ array( $this->mContentObject,
$this->getTitle(), $outputPage ) )
+ ) {
$po = $this->mContentObject->getParserOutput(
$this->getTitle() );
$outputPage->addHTML( $po->getText() );
}
@@ -1007,7 +1031,10 @@
public function showNamespaceHeader() {
if ( $this->getTitle()->isTalkPage() ) {
if ( !wfMessage( 'talkpageheader' )->isDisabled() ) {
- $this->getContext()->getOutput()->wrapWikiMsg(
"<div class=\"mw-talkpageheader\">\n$1\n</div>", array( 'talkpageheader' ) );
+ $this->getContext()->getOutput()->wrapWikiMsg(
+ "<div
class=\"mw-talkpageheader\">\n$1\n</div>",
+ array( 'talkpageheader' )
+ );
}
}
}
@@ -1017,7 +1044,9 @@
*/
public function showViewFooter() {
# check if we're displaying a [[User talk:x.x.x.x]] anonymous
talk page
- if ( $this->getTitle()->getNamespace() == NS_USER_TALK &&
IP::isValid( $this->getTitle()->getText() ) ) {
+ if ( $this->getTitle()->getNamespace() == NS_USER_TALK
+ && IP::isValid( $this->getTitle()->getText() )
+ ) {
$this->getContext()->getOutput()->addWikiMsg(
'anontalkpagetext' );
}
@@ -1025,7 +1054,6 @@
$patrolFooterShown = $this->showPatrolFooter();
wfRunHooks( 'ArticleViewFooter', array( $this,
$patrolFooterShown ) );
-
}
/**
@@ -1045,7 +1073,9 @@
$cache = wfGetMainCache();
$rc = false;
- if ( !$this->getTitle()->quickUserCan( 'patrol', $user ) || !(
$wgUseRCPatrol || $wgUseNPPatrol ) ) {
+ if ( !$this->getTitle()->quickUserCan( 'patrol', $user )
+ || !( $wgUseRCPatrol || $wgUseNPPatrol )
+ ) {
// Patrolling is disabled or the user isn't allowed to
return false;
}
@@ -1064,7 +1094,9 @@
return false;
}
- if ( $this->mRevision && !RecentChange::isInRCLifespan(
$this->mRevision->getTimestamp(), 21600 ) ) {
+ if ( $this->mRevision
+ && !RecentChange::isInRCLifespan(
$this->mRevision->getTimestamp(), 21600 )
+ ) {
// The current revision is already older than what
could be in the RC table
// 6h tolerance because the RC might not be cleaned out
regularly
wfProfileOut( __METHOD__ );
@@ -1079,7 +1111,9 @@
__METHOD__
);
- if ( $oldestRevisionTimestamp && RecentChange::isInRCLifespan(
$oldestRevisionTimestamp, 21600 ) ) {
+ if ( $oldestRevisionTimestamp
+ && RecentChange::isInRCLifespan(
$oldestRevisionTimestamp, 21600 )
+ ) {
// 6h tolerance because the RC might not be cleaned out
regularly
$rc = RecentChange::newFromConds(
array(
@@ -1153,7 +1187,9 @@
$validUserPage = false;
# Show info in user (talk) namespace. Does the user exist? Is
he blocked?
- if ( $this->getTitle()->getNamespace() == NS_USER ||
$this->getTitle()->getNamespace() == NS_USER_TALK ) {
+ if ( $this->getTitle()->getNamespace() == NS_USER
+ || $this->getTitle()->getNamespace() == NS_USER_TALK
+ ) {
$parts = explode( '/', $this->getTitle()->getText() );
$rootPart = $parts[0];
$user = User::newFromName( $rootPart, false /* allow IP
users*/ );
@@ -1446,9 +1482,7 @@
// the loop prepends the arrow image before the link, so the
first case needs to be outside
- /**
- * @var $title Title
- */
+ /** @var $title Title */
$title = array_shift( $target );
if ( $forceKnown ) {
@@ -1459,13 +1493,27 @@
$nextRedirect = $wgStylePath . '/common/images/nextredirect' .
$imageDir . '.png';
$alt = $lang->isRTL() ? '←' : '→';
- // Automatically append redirect=no to each link, since most of
them are redirect pages themselves.
+
+ // Automatically append redirect=no to each link, since most of
them are
+ // redirect pages themselves.
+ /** @var Title $rt */
foreach ( $target as $rt ) {
$link .= Html::element( 'img', array( 'src' =>
$nextRedirect, 'alt' => $alt ) );
if ( $forceKnown ) {
- $link .= Linker::linkKnown( $rt,
htmlspecialchars( $rt->getFullText(), array(), array( 'redirect' => 'no' ) ) );
+ $link .= Linker::linkKnown(
+ $rt,
+ htmlspecialchars( $rt->getFullText(),
+ array(),
+ array( 'redirect' => 'no' )
+ )
+ );
} else {
- $link .= Linker::link( $rt, htmlspecialchars(
$rt->getFullText() ), array(), array( 'redirect' => 'no' ) );
+ $link .= Linker::link(
+ $rt,
+ htmlspecialchars( $rt->getFullText() ),
+ array(),
+ array( 'redirect' => 'no' )
+ );
}
}
@@ -1572,7 +1620,8 @@
try {
$reason = $this->generateReason( $hasHistory );
} catch ( MWException $e ) {
- # if a page is horribly broken, we still want
to be able to delete it. so be lenient about errors here.
+ # if a page is horribly broken, we still want
to be able to
+ # delete it. So be lenient about errors here.
wfDebug( "Error while building auto delete
summary: $e" );
$reason = '';
}
@@ -1594,7 +1643,11 @@
if ( $this->mTitle->isBigDeletion() ) {
global $wgDeleteRevisionsLimit;
$this->getContext()->getOutput()->wrapWikiMsg(
"<div class='error'>\n$1\n</div>\n",
- array( 'delete-warning-toobig',
$this->getContext()->getLanguage()->formatNum( $wgDeleteRevisionsLimit ) ) );
+ array(
+ 'delete-warning-toobig',
+
$this->getContext()->getLanguage()->formatNum( $wgDeleteRevisionsLimit )
+ )
+ );
}
}
@@ -1647,9 +1700,14 @@
Xml::label( wfMessage( 'deletecomment'
)->text(), 'wpDeleteReasonList' ) .
"</td>
<td class='mw-input'>" .
- Xml::listDropDown( 'wpDeleteReasonList',
+ Xml::listDropDown(
+ 'wpDeleteReasonList',
wfMessage(
'deletereason-dropdown' )->inContentLanguage()->text(),
- wfMessage(
'deletereasonotherlist' )->inContentLanguage()->text(), '', 'wpReasonDropDown',
1 ) .
+ wfMessage(
'deletereasonotherlist' )->inContentLanguage()->text(),
+ '',
+ 'wpReasonDropDown',
+ 1
+ ) .
"</td>
</tr>
<tr id=\"wpDeleteReasonRow\">
@@ -1690,7 +1748,10 @@
</tr>" .
Xml::closeElement( 'table' ) .
Xml::closeElement( 'fieldset' ) .
- Html::hidden( 'wpEditToken', $user->getEditToken(
array( 'delete', $this->getTitle()->getPrefixedText() ) ) ) .
+ Html::hidden(
+ 'wpEditToken',
+ $user->getEditToken( array( 'delete',
$this->getTitle()->getPrefixedText() ) )
+ ) .
Xml::closeElement( 'form' );
if ( $user->isAllowed( 'editinterface' ) ) {
@@ -1715,13 +1776,14 @@
/**
* Perform a deletion and output success or failure messages
- * @param $reason
- * @param $suppress bool
+ * @param string $reason
+ * @param bool $suppress
*/
public function doDelete( $reason, $suppress = false ) {
$error = '';
$outputPage = $this->getContext()->getOutput();
$status = $this->mPage->doDeleteArticleReal( $reason,
$suppress, 0, true, $error );
+
if ( $status->isGood() ) {
$deleted = $this->getTitle()->getPrefixedText();
@@ -1733,7 +1795,11 @@
$outputPage->addWikiMsg( 'deletedtext',
wfEscapeWikiText( $deleted ), $loglink );
$outputPage->returnToMain( false );
} else {
- $outputPage->setPageTitle( wfMessage(
'cannotdelete-title', $this->getTitle()->getPrefixedText() ) );
+ $outputPage->setPageTitle(
+ wfMessage( 'cannotdelete-title',
+ $this->getTitle()->getPrefixedText() )
+ );
+
if ( $error == '' ) {
$outputPage->addWikiText(
"<div class=\"error
mw-error-cannotdelete\">\n" . $status->getWikiText() . "\n</div>"
@@ -1878,7 +1944,8 @@
if ( $this->mContext instanceof IContextSource ) {
return $this->mContext;
} else {
- wfDebug( __METHOD__ . " called and \$mContext is null.
Return RequestContext::getMain(); for sanity\n" );
+ wfDebug( __METHOD__ . " called and \$mContext is null.
" .
+ "Return RequestContext::getMain(); for
sanity\n" );
return RequestContext::getMain();
}
}
@@ -1978,7 +2045,9 @@
* @param $user User
* @return Status
*/
- public function doUpdateRestrictions( array $limit, array $expiry,
&$cascade, $reason, User $user ) {
+ public function doUpdateRestrictions( array $limit, array $expiry,
&$cascade,
+ $reason, User $user
+ ) {
return $this->mPage->doUpdateRestrictions( $limit, $expiry,
$cascade, $reason, $user );
}
@@ -1989,7 +2058,9 @@
* @param $expiry array
* @return bool
*/
- public function updateRestrictions( $limit = array(), $reason = '',
&$cascade = 0, $expiry = array() ) {
+ public function updateRestrictions( $limit = array(), $reason = '',
+ &$cascade = 0, $expiry = array()
+ ) {
return $this->mPage->doUpdateRestrictions(
$limit,
$expiry,
@@ -2007,7 +2078,9 @@
* @param $error string
* @return bool
*/
- public function doDeleteArticle( $reason, $suppress = false, $id = 0,
$commit = true, &$error = '' ) {
+ public function doDeleteArticle( $reason, $suppress = false, $id = 0,
+ $commit = true, &$error = ''
+ ) {
return $this->mPage->doDeleteArticle( $reason, $suppress, $id,
$commit, $error );
}
diff --git a/includes/Autopromote.php b/includes/Autopromote.php
index 170d7ab..197ad9c 100644
--- a/includes/Autopromote.php
+++ b/includes/Autopromote.php
@@ -197,7 +197,8 @@
return in_array( 'bot',
User::getGroupPermissions( $user->getGroups() ) );
default:
$result = null;
- wfRunHooks( 'AutopromoteCondition', array(
$cond[0], array_slice( $cond, 1 ), $user, &$result ) );
+ wfRunHooks( 'AutopromoteCondition', array(
$cond[0],
+ array_slice( $cond, 1 ), $user,
&$result ) );
if ( $result === null ) {
throw new MWException( "Unrecognized
condition {$cond[0]} for autopromotion!" );
}
diff --git a/includes/Block.php b/includes/Block.php
index 3575b9d..c366052 100644
--- a/includes/Block.php
+++ b/includes/Block.php
@@ -435,7 +435,8 @@
* Update a block in the DB with new parameters.
* The ID field needs to be loaded first.
*
- * @return bool|array False on failure, array on success: ('id' =>
block ID, 'autoIds' => array of autoblock IDs)
+ * @return bool|array False on failure, array on success:
+ * ('id' => block ID, 'autoIds' => array of autoblock IDs)
*/
public function update() {
wfDebug( "Block::update; timestamp {$this->mTimestamp}\n" );
@@ -676,7 +677,8 @@
wfDebug( "Autoblocking {$this->getTarget()}@" . $autoblockIP .
"\n" );
$autoblock->setTarget( $autoblockIP );
$autoblock->setBlocker( $this->getBlocker() );
- $autoblock->mReason = wfMessage( 'autoblocker',
$this->getTarget(), $this->mReason )->inContentLanguage()->plain();
+ $autoblock->mReason = wfMessage( 'autoblocker',
$this->getTarget(), $this->mReason )
+ ->inContentLanguage()->plain();
$timestamp = wfTimestampNow();
$autoblock->mTimestamp = $timestamp;
$autoblock->mAuto = 1;
@@ -973,7 +975,10 @@
# passed by some callers (bug 29116)
return null;
- } elseif ( in_array( $type, array( Block::TYPE_USER,
Block::TYPE_IP, Block::TYPE_RANGE, null ) ) ) {
+ } elseif ( in_array(
+ $type,
+ array( Block::TYPE_USER, Block::TYPE_IP,
Block::TYPE_RANGE, null ) )
+ ) {
$block = new Block();
$block->fromMaster( $fromMaster );
diff --git a/includes/CacheHelper.php b/includes/CacheHelper.php
index f6cd3a6..cfa4160 100644
--- a/includes/CacheHelper.php
+++ b/includes/CacheHelper.php
@@ -28,7 +28,6 @@
* @since 1.20
*/
interface ICacheHelper {
-
/**
* Sets if the cache should be enabled or not.
*
@@ -81,7 +80,6 @@
* @param integer $cacheExpiry
*/
function setExpiry( $cacheExpiry );
-
}
/**
@@ -103,7 +101,6 @@
* @since 1.20
*/
class CacheHelper implements ICacheHelper {
-
/**
* The time to live for the cache, in seconds or a unix timestamp
indicating the point of expiry.
*
@@ -275,7 +272,8 @@
$itemKey = array_shift( $itemKey );
if ( !is_integer( $itemKey ) ) {
- wfWarn( "Attempted to get item with
non-numeric key while the next item in the queue has a key ($itemKey) in " .
__METHOD__ );
+ wfWarn( "Attempted to get item with
non-numeric key while " .
+ "the next item in the queue has
a key ($itemKey) in " . __METHOD__ );
} elseif ( is_null( $itemKey ) ) {
wfWarn( "Attempted to get an item while
the queue is empty in " . __METHOD__ );
} else {
@@ -316,7 +314,11 @@
*/
public function saveCache() {
if ( $this->cacheEnabled && $this->hasCached === false &&
!empty( $this->cachedChunks ) ) {
- wfGetCache( CACHE_ANYTHING )->set(
$this->getCacheKeyString(), $this->cachedChunks, $this->cacheExpiry );
+ wfGetCache( CACHE_ANYTHING )->set(
+ $this->getCacheKeyString(),
+ $this->cachedChunks,
+ $this->cacheExpiry
+ );
}
}
@@ -381,5 +383,4 @@
public function setOnInitializedHandler( $handlerFunction ) {
$this->onInitHandler = $handlerFunction;
}
-
}
diff --git a/includes/Category.php b/includes/Category.php
index df5ad7d..e326ce2 100644
--- a/includes/Category.php
+++ b/includes/Category.php
@@ -26,7 +26,7 @@
* like to refresh link counts, the objects will be appropriately
reinitialized.
* Member variables are lazy-initialized.
*
- * TODO: Move some stuff from CategoryPage.php to here, and use that.
+ * @todo Move some stuff from CategoryPage.php to here, and use that.
*/
class Category {
/** Name of the category, normalized to DB-key form */
@@ -75,7 +75,8 @@
if ( !$row ) {
# Okay, there were no contents. Nothing to initialize.
if ( $this->mTitle ) {
- # If there is a title object but no record in
the category table, treat this as an empty category
+ # If there is a title object but no record in
the category table,
+ # treat this as an empty category.
$this->mID = false;
$this->mName = $this->mTitle->getDBkey();
$this->mPages = 0;
@@ -155,11 +156,13 @@
/**
* Factory function, for constructing a Category object from a result
set
*
- * @param $row result set row, must contain the cat_xxx fields. If the
fields are null,
- * the resulting Category object will represent an empty
category if a title object
- * was given. If the fields are null and no title was given,
this method fails and returns false.
- * @param Title $title optional title object for the category
represented by the given row.
- * May be provided if it is already known, to avoid having to
re-create a title object later.
+ * @param $row Result set row, must contain the cat_xxx fields. If the
+ * fields are null, the resulting Category object will represent an
empty
+ * category if a title object was given. If the fields are null and no
+ * title was given, this method fails and returns false.
+ * @param Title $title optional title object for the category
represented by
+ * the given row. May be provided if it is already known, to avoid
having
+ * to re-create a title object later.
* @return Category
*/
public static function newFromRow( $row, $title = null ) {
@@ -177,7 +180,8 @@
# but we can't know that here...
return false;
} else {
- $cat->mName = $title->getDBkey(); # if we have
a title object, fetch the category name from there
+ # if we have a title object, fetch the category
name from there
+ $cat->mName = $title->getDBkey();
}
$cat->mID = false;
diff --git a/includes/CategoryViewer.php b/includes/CategoryViewer.php
index 4027bef..183c5f2 100644
--- a/includes/CategoryViewer.php
+++ b/includes/CategoryViewer.php
@@ -76,7 +76,9 @@
* @param array $until An array with 3 keys for until of each section
(since 1.17)
* @param $query Array
*/
- function __construct( $title, IContextSource $context, $from = array(),
$until = array(), $query = array() ) {
+ function __construct( $title, IContextSource $context, $from = array(),
+ $until = array(), $query = array()
+ ) {
global $wgCategoryPagingLimit;
$this->title = $title;
$this->setContext( $context );
@@ -423,7 +425,12 @@
$countmsg = $this->getCountMessage( $rescnt, $dbcnt,
'file' );
$r .= "<div id=\"mw-category-media\">\n";
- $r .= '<h2>' . $this->msg( 'category-media-header',
wfEscapeWikiText( $this->title->getText() ) )->text() . "</h2>\n";
+ $r .= '<h2>' .
+ $this->msg(
+ 'category-media-header',
+ wfEscapeWikiText(
$this->title->getText() )
+ )->text() .
+ "</h2>\n";
$r .= $countmsg;
$r .= $this->getSectionPagingLinks( 'file' );
if ( $this->showGallery ) {
@@ -447,7 +454,9 @@
private function getSectionPagingLinks( $type ) {
if ( isset( $this->until[$type] ) && $this->until[$type] !==
null ) {
return $this->pagingLinks( $this->nextPage[$type],
$this->until[$type], $type );
- } elseif ( $this->nextPage[$type] !== null || ( isset(
$this->from[$type] ) && $this->from[$type] !== null ) ) {
+ } elseif ( $this->nextPage[$type] !== null
+ || ( isset( $this->from[$type] ) && $this->from[$type]
!== null )
+ ) {
return $this->pagingLinks( $this->from[$type],
$this->nextPage[$type], $type );
} else {
return '';
@@ -562,7 +571,8 @@
static function shortList( $articles, $articles_start_char ) {
$r = '<h3>' . htmlspecialchars( $articles_start_char[0] ) .
"</h3>\n";
$r .= '<ul><li>' . $articles[0] . '</li>';
- for ( $index = 1; $index < count( $articles ); $index++ ) {
+ $articleCount = count( $articles );
+ for ( $index = 1; $index < $articleCount; $index++ ) {
if ( $articles_start_char[$index] !=
$articles_start_char[$index - 1] ) {
$r .= "</ul><h3>" . htmlspecialchars(
$articles_start_char[$index] ) . "</h3>\n<ul>";
}
diff --git a/includes/ChangeTags.php b/includes/ChangeTags.php
index 53f2955..f73ec1f 100644
--- a/includes/ChangeTags.php
+++ b/includes/ChangeTags.php
@@ -21,18 +21,15 @@
*/
class ChangeTags {
-
/**
* Creates HTML for the given tags
*
* @param string $tags Comma-separated list of tags
* @param string $page A label for the type of action which is being
displayed,
- * for example: 'history', 'contributions' or
'newpages'
- *
- * @return Array with two items: (html, classes)
- * - html: String: HTML for displaying the tags (empty
string when param $tags is empty)
- * - classes: Array of strings: CSS classes used in the
generated html, one class for each tag
- *
+ * for example: 'history', 'contributions' or 'newpages'
+ * @return array Array with two items: (html, classes)
+ * - html: String: HTML for displaying the tags (empty string when
param $tags is empty)
+ * - classes: Array of strings: CSS classes used in the generated
html, one class for each tag
*/
public static function formatSummaryRow( $tags, $page ) {
global $wgLang;
@@ -90,7 +87,9 @@
*
* @exception MWException when $rc_id, $rev_id and $log_id are all null
*/
- public static function addTags( $tags, $rc_id = null, $rev_id = null,
$log_id = null, $params = null ) {
+ public static function addTags( $tags, $rc_id = null, $rev_id = null,
+ $log_id = null, $params = null
+ ) {
if ( !is_array( $tags ) ) {
$tags = array( $tags );
}
@@ -106,19 +105,45 @@
// Might as well look for rcids and so on.
if ( !$rc_id ) {
- $dbr = wfGetDB( DB_MASTER ); // Info might be out of
date, somewhat fractionally, on slave.
+ // Info might be out of date, somewhat fractionally, on
slave.
+ $dbr = wfGetDB( DB_MASTER );
if ( $log_id ) {
- $rc_id = $dbr->selectField( 'recentchanges',
'rc_id', array( 'rc_logid' => $log_id ), __METHOD__ );
+ $rc_id = $dbr->selectField(
+ 'recentchanges',
+ 'rc_id',
+ array( 'rc_logid' => $log_id ),
+ __METHOD__
+ );
} elseif ( $rev_id ) {
- $rc_id = $dbr->selectField( 'recentchanges',
'rc_id', array( 'rc_this_oldid' => $rev_id ), __METHOD__ );
+ $rc_id = $dbr->selectField(
+ 'recentchanges',
+ 'rc_id',
+ array( 'rc_this_oldid' => $rev_id ),
+ __METHOD__
+ );
}
} elseif ( !$log_id && !$rev_id ) {
- $dbr = wfGetDB( DB_MASTER ); // Info might be out of
date, somewhat fractionally, on slave.
- $log_id = $dbr->selectField( 'recentchanges',
'rc_logid', array( 'rc_id' => $rc_id ), __METHOD__ );
- $rev_id = $dbr->selectField( 'recentchanges',
'rc_this_oldid', array( 'rc_id' => $rc_id ), __METHOD__ );
+ // Info might be out of date, somewhat fractionally, on
slave.
+ $dbr = wfGetDB( DB_MASTER );
+ $log_id = $dbr->selectField(
+ 'recentchanges',
+ 'rc_logid',
+ array( 'rc_id' => $rc_id ),
+ __METHOD__
+ );
+ $rev_id = $dbr->selectField(
+ 'recentchanges',
+ 'rc_this_oldid',
+ array( 'rc_id' => $rc_id ),
+ __METHOD__
+ );
}
- $tsConds = array_filter( array( 'ts_rc_id' => $rc_id,
'ts_rev_id' => $rev_id, 'ts_log_id' => $log_id ) );
+ $tsConds = array_filter( array(
+ 'ts_rc_id' => $rc_id,
+ 'ts_rev_id' => $rev_id,
+ 'ts_log_id' => $log_id )
+ );
## Update the summary row.
$prevTags = $dbr->selectField( 'tag_summary', 'ts_tags',
$tsConds, __METHOD__ );
@@ -222,24 +247,45 @@
* - if $fullForm is false: Array with
* - if $fullForm is true: String, html fragment
*/
- public static function buildTagFilterSelector( $selected = '',
$fullForm = false, Title $title = null ) {
+ public static function buildTagFilterSelector( $selected = '',
+ $fullForm = false, Title $title = null
+ ) {
global $wgUseTagFilter;
if ( !$wgUseTagFilter || !count( self::listDefinedTags() ) ) {
return $fullForm ? '' : array();
}
- $data = array( Html::rawElement( 'label', array( 'for' =>
'tagfilter' ), wfMessage( 'tag-filter' )->parse() ),
- Xml::input( 'tagfilter', 20, $selected, array( 'class'
=> 'mw-tagfilter-input', 'id' => 'tagfilter' ) ) );
+ $data = array(
+ Html::rawElement(
+ 'label',
+ array( 'for' => 'tagfilter' ),
+ wfMessage( 'tag-filter' )->parse()
+ ),
+ Xml::input(
+ 'tagfilter',
+ 20,
+ $selected,
+ array( 'class' => 'mw-tagfilter-input', 'id' =>
'tagfilter' )
+ )
+ );
if ( !$fullForm ) {
return $data;
}
$html = implode( ' ', $data );
- $html .= "\n" . Xml::element( 'input', array( 'type' =>
'submit', 'value' => wfMessage( 'tag-filter-submit' )->text() ) );
+ $html .= "\n" .
+ Xml::element(
+ 'input',
+ array( 'type' => 'submit', 'value' =>
wfMessage( 'tag-filter-submit' )->text() )
+ );
$html .= "\n" . Html::hidden( 'title',
$title->getPrefixedText() );
- $html = Xml::tags( 'form', array( 'action' =>
$title->getLocalURL(), 'class' => 'mw-tagfilter-form', 'method' => 'get' ),
$html );
+ $html = Xml::tags(
+ 'form',
+ array( 'action' => $title->getLocalURL(), 'class' =>
'mw-tagfilter-form', 'method' => 'get' ),
+ $html
+ );
return $html;
}
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index c35070a..efef9e0 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -5531,9 +5531,10 @@
* @since 1.20
*/
$wgGitRepositoryViewers = array(
- 'https://(?:[a-z0-9_]+@)?gerrit.wikimedia.org/r/(?:p/)?(.*)' =>
'https://git.wikimedia.org/commit/%r/%H',
- 'ssh://(?:[a-z0-9_]+@)?gerrit.wikimedia.org:29418/(.*)'
- => 'https://git.wikimedia.org/commit/%r/%H',
+ 'https://(?:[a-z0-9_]+@)?gerrit.wikimedia.org/r/(?:p/)?(.*)' =>
+ 'https://git.wikimedia.org/commit/%r/%H',
+ 'ssh://(?:[a-z0-9_]+@)?gerrit.wikimedia.org:29418/(.*)' =>
+ 'https://git.wikimedia.org/commit/%r/%H',
);
/** @} */ # End of maintenance }
diff --git a/includes/Export.php b/includes/Export.php
index 56fe452..4c0eb30 100644
--- a/includes/Export.php
+++ b/includes/Export.php
@@ -594,9 +594,8 @@
*
* @param $row object
* @return string
- * @access private
*/
- function openPage( $row ) {
+ public function openPage( $row ) {
$out = " <page>\n";
$title = Title::makeTitle( $row->page_namespace,
$row->page_title );
$out .= ' ' . Xml::elementClean( 'title', array(),
self::canonicalTitle( $title ) ) . "\n";
@@ -606,7 +605,9 @@
$page = WikiPage::factory( $title );
$redirect = $page->getRedirectTarget();
if ( $redirect instanceof Title &&
$redirect->isValidRedirectTarget() ) {
- $out .= ' ' . Xml::element( 'redirect',
array( 'title' => self::canonicalTitle( $redirect ) ) ) . "\n";
+ $out .= ' ';
+ $out .= Xml::element( 'redirect', array(
'title' => self::canonicalTitle( $redirect ) ) );
+ $out .= "\n";
}
}
@@ -680,7 +681,10 @@
"" ) . "\n";
}
- if ( isset( $row->rev_sha1 ) && $row->rev_sha1 && !(
$row->rev_deleted & Revision::DELETED_TEXT ) ) {
+ if ( isset( $row->rev_sha1 )
+ && $row->rev_sha1
+ && !( $row->rev_deleted & Revision::DELETED_TEXT )
+ ) {
$out .= " " . Xml::element( 'sha1', null, strval(
$row->rev_sha1 ) ) . "\n";
} else {
$out .= " <sha1/>\n";
@@ -813,7 +817,7 @@
}
/**
- * @param $file File
+ * @param File $file
* @param $dumpContents bool
* @return string
*/
@@ -828,7 +832,7 @@
$be = $file->getRepo()->getBackend();
# Dump file as base64
# Uses only XML-safe characters, so does not need
escaping
- # @TODO: too bad this loads the contents into memory
(script might swap)
+ # @todo Too bad this loads the contents into memory
(script might swap)
$contents = ' <contents encoding="base64">' .
chunk_split( base64_encode(
$be->getFileContents( array( 'src' =>
$file->getPath() ) ) ) ) .
@@ -956,7 +960,8 @@
* Use this for the last piece of a file written out
* at specified checkpoints (e.g. every n hours).
* @param $newname mixed File name. May be a string or an array with
one element
- * @param bool $open If true, a new file with the old filename will be
opened again for writing (default: false)
+ * @param bool $open If true, a new file with the old filename will be
opened
+ * again for writing (default: false)
*/
function closeAndRename( $newname, $open = false ) {
}
--
To view, visit https://gerrit.wikimedia.org/r/120336
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iaf3120b4e32cc5835ef9ed86236d98679e2b87fa
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Siebrand <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits