From 4ac9fa081a7c045f6a9f1cfc529d82423f485b2e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 8 Dec 2013 09:55:49 +0100 Subject: Update to MediaWiki 1.22.0 --- includes/ChangesFeed.php | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'includes/ChangesFeed.php') diff --git a/includes/ChangesFeed.php b/includes/ChangesFeed.php index 476de5bd..0736c507 100644 --- a/includes/ChangesFeed.php +++ b/includes/ChangesFeed.php @@ -54,7 +54,7 @@ class ChangesFeed { return false; } - if( !array_key_exists( $this->format, $wgFeedClasses ) ) { + if ( !array_key_exists( $this->format, $wgFeedClasses ) ) { // falling back to atom $this->format = 'atom'; } @@ -92,7 +92,7 @@ class ChangesFeed { * gets it quick too. */ $cachedFeed = $this->loadFromCache( $lastmod, $timekey, $key ); - if( is_string( $cachedFeed ) ) { + if ( is_string( $cachedFeed ) ) { wfDebug( "RC: Outputting cached feed\n" ); $feed->httpHeaders(); echo $cachedFeed; @@ -134,7 +134,7 @@ class ChangesFeed { $feedLastmod = $messageMemc->get( $timekey ); - if( ( $wgFeedCacheTimeout > 0 ) && $feedLastmod ) { + if ( ( $wgFeedCacheTimeout > 0 ) && $feedLastmod ) { /** * If the cached feed was rendered very recently, we may * go ahead and use it even if there have been edits made @@ -146,7 +146,7 @@ class ChangesFeed { $feedLastmodUnix = wfTimestamp( TS_UNIX, $feedLastmod ); $lastmodUnix = wfTimestamp( TS_UNIX, $lastmod ); - if( $feedAge < $wgFeedCacheTimeout || $feedLastmodUnix > $lastmodUnix) { + if ( $feedAge < $wgFeedCacheTimeout || $feedLastmodUnix > $lastmodUnix ) { wfDebug( "RC: loading feed from cache ($key; $feedLastmod; $lastmod)...\n" ); if ( $feedLastmodUnix < $lastmodUnix ) { $wgOut->setLastModified( $feedLastmod ); // bug 21916 @@ -172,30 +172,32 @@ class ChangesFeed { # Merge adjacent edits by one user $sorted = array(); $n = 0; - foreach( $rows as $obj ) { - if( $n > 0 && + foreach ( $rows as $obj ) { + if ( $n > 0 && $obj->rc_type == RC_EDIT && $obj->rc_namespace >= 0 && - $obj->rc_cur_id == $sorted[$n-1]->rc_cur_id && - $obj->rc_user_text == $sorted[$n-1]->rc_user_text ) { - $sorted[$n-1]->rc_last_oldid = $obj->rc_last_oldid; + $obj->rc_cur_id == $sorted[$n - 1]->rc_cur_id && + $obj->rc_user_text == $sorted[$n - 1]->rc_user_text ) { + $sorted[$n - 1]->rc_last_oldid = $obj->rc_last_oldid; } else { $sorted[$n] = $obj; $n++; } } - foreach( $sorted as $obj ) { + foreach ( $sorted as $obj ) { $title = Title::makeTitle( $obj->rc_namespace, $obj->rc_title ); - $talkpage = MWNamespace::canTalk( $obj->rc_namespace ) ? $title->getTalkPage()->getFullUrl() : ''; + $talkpage = MWNamespace::canTalk( $obj->rc_namespace ) ? $title->getTalkPage()->getFullURL() : ''; // Skip items with deleted content (avoids partially complete/inconsistent output) - if( $obj->rc_deleted ) continue; + if ( $obj->rc_deleted ) { + continue; + } if ( $obj->rc_this_oldid ) { - $url = $title->getFullURL( - 'diff=' . $obj->rc_this_oldid . - '&oldid=' . $obj->rc_last_oldid - ); + $url = $title->getFullURL( array( + 'diff' => $obj->rc_this_oldid, + 'oldid' => $obj->rc_last_oldid, + ) ); } else { // log entry or something like that. $url = $title->getFullURL(); @@ -206,7 +208,8 @@ class ChangesFeed { FeedUtils::formatDiff( $obj ), $url, $obj->rc_timestamp, - ( $obj->rc_deleted & Revision::DELETED_USER ) ? wfMessage( 'rev-deleted-user' )->escaped() : $obj->rc_user_text, + ( $obj->rc_deleted & Revision::DELETED_USER ) + ? wfMessage( 'rev-deleted-user' )->escaped() : $obj->rc_user_text, $talkpage ); $feed->outItem( $item ); -- cgit v1.2.2