* @ingroup Ajax
*/
class AjaxResponse {
-
/**
* Number of seconds to get the response cached by a proxy
* @var int $mCacheDuration
}
} 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 {
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 {
* 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
/**
* 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
*
}
} 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;
}
$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;
}
// @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 ) );
# 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;
}
$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 );
* 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();
$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() );
}
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' )
+ );
}
}
}
*/
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' );
}
$patrolFooterShown = $this->showPatrolFooter();
wfRunHooks( 'ArticleViewFooter', array( $this, $patrolFooterShown ) );
-
}
/**
$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;
}
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__ );
__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(
$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*/ );
// 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 ) {
$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' )
+ );
}
}
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 = '';
}
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 )
+ )
+ );
}
}
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\">
</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' ) ) {
/**
* 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();
$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>"
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();
}
}
* @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 );
}
* @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,
* @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 );
}
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!" );
}
* 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" );
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;
# 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 );
* @since 1.20
*/
interface ICacheHelper {
-
/**
* Sets if the cache should be enabled or not.
*
* @param integer $cacheExpiry
*/
function setExpiry( $cacheExpiry );
-
}
/**
* @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.
*
$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 {
*/
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
+ );
}
}
public function setOnInitializedHandler( $handlerFunction ) {
$this->onInitHandler = $handlerFunction;
}
-
}
* 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 */
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;
/**
* 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 ) {
# 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;
* @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 );
$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 ) {
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 '';
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>";
}
*/
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;
*
* @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 );
}
// 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__ );
* - 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;
}
* @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 }
*
* @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";
$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";
}
}
"" ) . "\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";
}
/**
- * @param $file File
+ * @param File $file
* @param $dumpContents bool
* @return string
*/
$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() ) ) ) ) .
* 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 ) {
}