$user = $context->getUser();
$sk = $context->getSkin();
$list = null;
- if( wfRunHooks( 'FetchChangesList', array( $user, &$sk, &$list ) ) ) {
+ if ( wfRunHooks( 'FetchChangesList', array( $user, &$sk, &$list ) ) ) {
$new = $context->getRequest()->getBool( 'enhanced', $user->getOption( 'usenewrc' ) );
return $new ? new EnhancedChangesList( $context ) : new OldChangesList( $context );
} else {
* they are called often, we call them once and save them in $this->message
*/
private function preCacheMessages() {
- if( !isset( $this->message ) ) {
- foreach ( explode( ' ', 'cur diff hist last blocklink history ' .
- 'semicolon-separator pipe-separator' ) as $msg ) {
+ if ( !isset( $this->message ) ) {
+ foreach ( array(
+ 'cur', 'diff', 'hist', 'last', 'blocklink', 'history',
+ 'semicolon-separator', 'pipe-separator' ) as $msg
+ ) {
$this->message[$msg] = $this->msg( $msg )->escaped();
}
}
* @param string $nothing to use for empty space
* @return String
*/
- protected function recentChangesFlags( $flags, $nothing = ' ' ) {
+ public function recentChangesFlags( $flags, $nothing = ' ' ) {
+ global $wgRecentChangesFlags;
$f = '';
- foreach( array( 'newpage', 'minor', 'bot', 'unpatrolled' ) as $flag ) {
+ foreach ( array_keys( $wgRecentChangesFlags ) as $flag ) {
$f .= isset( $flags[$flag] ) && $flags[$flag]
? self::flag( $flag )
: $nothing;
* unpatrolled edit. By default in English it will contain "N", "m", "b",
* "!" respectively, plus it will have an appropriate title and class.
*
- * @param string $flag 'newpage', 'unpatrolled', 'minor', or 'bot'
+ * @param string $flag One key of $wgRecentChangesFlags
* @return String: Raw HTML
*/
public static function flag( $flag ) {
- static $messages = null;
- if ( is_null( $messages ) ) {
- $messages = array(
- 'newpage' => array( 'newpageletter', 'recentchanges-label-newpage' ),
- 'minoredit' => array( 'minoreditletter', 'recentchanges-label-minor' ),
- 'botedit' => array( 'boteditletter', 'recentchanges-label-bot' ),
- 'unpatrolled' => array( 'unpatrolledletter', 'recentchanges-label-unpatrolled' ),
- );
- foreach( $messages as &$value ) {
- $value[0] = wfMessage( $value[0] )->escaped();
- $value[1] = wfMessage( $value[1] )->escaped();
+ static $flagInfos = null;
+ if ( is_null( $flagInfos ) ) {
+ global $wgRecentChangesFlags;
+ $flagInfos = array();
+ foreach ( $wgRecentChangesFlags as $key => $value ) {
+ $flagInfos[$key]['letter'] = wfMessage( $value['letter'] )->escaped();
+ $flagInfos[$key]['title'] = wfMessage( $value['title'] )->escaped();
+ // Allow customized class name, fall back to flag name
+ $flagInfos[$key]['class'] = Sanitizer::escapeClass(
+ isset( $value['class'] ) ? $value['class'] : $key );
}
}
- # Inconsistent naming, bleh
+ // Inconsistent naming, bleh, kepted for b/c
$map = array(
- 'newpage' => 'newpage',
- 'minor' => 'minoredit',
- 'bot' => 'botedit',
- 'unpatrolled' => 'unpatrolled',
- 'minoredit' => 'minoredit',
- 'botedit' => 'botedit',
+ 'minoredit' => 'minor',
+ 'botedit' => 'bot',
);
- $flag = $map[$flag];
+ if ( isset( $map[$flag] ) ) {
+ $flag = $map[$flag];
+ }
- return "<abbr class='$flag' title='" . $messages[$flag][1] . "'>" . $messages[$flag][0] . '</abbr>';
+ return "<abbr class='" . $flagInfos[$flag]['class'] . "' title='" . $flagInfos[$flag]['title'] . "'>" .
+ $flagInfos[$flag]['letter'] .
+ '</abbr>';
}
/**
$formattedSize = $context->msg( 'rc-change-size', $formattedSize )->text();
}
- if( abs( $szdiff ) > abs( $wgRCChangedSizeThreshold ) ) {
+ if ( abs( $szdiff ) > abs( $wgRCChangedSizeThreshold ) ) {
$tag = 'strong';
} else {
$tag = 'span';
$newlen = $old->mAttribs['rc_new_len'];
}
- if( $oldlen === null || $newlen === null ) {
+ if ( $oldlen === null || $newlen === null ) {
return '';
}
* @return String
*/
public function endRecentChangesList() {
- if( $this->rclistOpen ) {
+ if ( $this->rclistOpen ) {
return "</ul>\n";
} else {
return '';
public function insertDateHeader( &$s, $rc_timestamp ) {
# Make date header if necessary
$date = $this->getLanguage()->userDate( $rc_timestamp, $this->getUser() );
- if( $date != $this->lastdate ) {
- if( $this->lastdate != '' ) {
+ if ( $date != $this->lastdate ) {
+ if ( $this->lastdate != '' ) {
$s .= "</ul>\n";
}
$s .= Xml::element( 'h4', null, $date ) . "\n<ul class=\"special\">";
*/
public function insertDiffHist( &$s, &$rc, $unpatrolled ) {
# Diff link
- if( $rc->mAttribs['rc_type'] == RC_NEW || $rc->mAttribs['rc_type'] == RC_LOG ) {
+ if ( $rc->mAttribs['rc_type'] == RC_NEW || $rc->mAttribs['rc_type'] == RC_LOG ) {
$diffLink = $this->message['diff'];
} elseif ( !self::userCan( $rc, Revision::DELETED_TEXT, $this->getUser() ) ) {
$diffLink = $this->message['diff'];
'oldid' => $rc->mAttribs['rc_last_oldid']
);
- if( $unpatrolled ) {
- $query['rcid'] = $rc->mAttribs['rc_id'];
- };
-
$diffLink = Linker::linkKnown(
$rc->getTitle(),
$this->message['diff'],
* @param $watched
*/
public function insertArticleLink( &$s, &$rc, $unpatrolled, $watched ) {
- # If it's a new article, there is no diff link, but if it hasn't been
- # patrolled yet, we need to give users a way to do so
$params = array();
- if ( $unpatrolled && $rc->mAttribs['rc_type'] == RC_NEW ) {
- $params['rcid'] = $rc->mAttribs['rc_id'];
- }
-
$articlelink = Linker::linkKnown(
$rc->getTitle(),
null,
array( 'class' => 'mw-changeslist-title' ),
$params
);
- if( $this->isDeleted( $rc, Revision::DELETED_TEXT ) ) {
+ if ( $this->isDeleted( $rc, Revision::DELETED_TEXT ) ) {
$articlelink = '<span class="history-deleted">' . $articlelink . '</span>';
}
# To allow for boldening pages watched by this user
* @param &$rc RecentChange
*/
public function insertUserRelatedLinks( &$s, &$rc ) {
- if( $this->isDeleted( $rc, Revision::DELETED_USER ) ) {
+ if ( $this->isDeleted( $rc, Revision::DELETED_USER ) ) {
$s .= ' <span class="history-deleted">' . $this->msg( 'rev-deleted-user' )->escaped() . '</span>';
} else {
$s .= $this->getLanguage()->getDirMark() . Linker::userLink( $rc->mAttribs['rc_user'],
* @return string
*/
public function insertComment( $rc ) {
- if( $rc->mAttribs['rc_type'] != RC_MOVE && $rc->mAttribs['rc_type'] != RC_MOVE_OVER_REDIRECT ) {
- if( $this->isDeleted( $rc, Revision::DELETED_COMMENT ) ) {
+ if ( $rc->mAttribs['rc_type'] != RC_MOVE && $rc->mAttribs['rc_type'] != RC_MOVE_OVER_REDIRECT ) {
+ if ( $this->isDeleted( $rc, Revision::DELETED_COMMENT ) ) {
return ' <span class="history-deleted">' . $this->msg( 'rev-deleted-comment' )->escaped() . '</span>';
} else {
return Linker::commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
/**
* Check whether to enable recent changes patrol features
+ *
+ * @deprecated since 1.22
* @return Boolean
*/
public static function usePatrol() {
global $wgUser;
+
+ wfDeprecated( __METHOD__, '1.22' );
+
return $wgUser->useRCPatrol();
}
*/
protected function numberofWatchingusers( $count ) {
static $cache = array();
- if( $count > 0 ) {
- if( !isset( $cache[$count] ) ) {
+ if ( $count > 0 ) {
+ if ( !isset( $cache[$count] ) ) {
$cache[$count] = $this->msg( 'number_of_watching_users_RCview' )->numParams( $count )->escaped();
}
return $cache[$count];
* @return Boolean
*/
public static function userCan( $rc, $field, User $user = null ) {
- if( $rc->mAttribs['rc_type'] == RC_LOG ) {
+ if ( $rc->mAttribs['rc_type'] == RC_LOG ) {
return LogEventsList::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
} else {
return Revision::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
* @return string
*/
protected function maybeWatchedLink( $link, $watched = false ) {
- if( $watched ) {
+ if ( $watched ) {
return '<strong class="mw-watched">' . $link . '</strong>';
} else {
return '<span class="mw-rc-unwatched">' . $link . '</span>';
* @param $rc RecentChange
*/
public function insertRollback( &$s, &$rc ) {
- if( $rc->mAttribs['rc_type'] != RC_NEW && $rc->mAttribs['rc_this_oldid'] && $rc->mAttribs['rc_cur_id'] ) {
+ if ( $rc->mAttribs['rc_type'] == RC_EDIT && $rc->mAttribs['rc_this_oldid'] && $rc->mAttribs['rc_cur_id'] ) {
$page = $rc->getTitle();
/** Check for rollback and edit permissions, disallow special pages, and only
* show a link on the top-most revision */
'user_text' => $rc->mAttribs['rc_user_text'],
'deleted' => $rc->mAttribs['rc_deleted']
) );
- $s .= ' '.Linker::generateRollback( $rev, $this->getContext() );
+ $s .= ' ' . Linker::generateRollback( $rev, $this->getContext() );
}
}
}
* @param $classes
*/
public function insertTags( &$s, &$rc, &$classes ) {
- if ( empty( $rc->mAttribs['ts_tags'] ) )
+ if ( empty( $rc->mAttribs['ts_tags'] ) ) {
return;
+ }
list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow( $rc->mAttribs['ts_tags'], 'changeslist' );
$classes = array_merge( $classes, $newClasses );
$s = '';
$classes = array();
// use mw-line-even/mw-line-odd class only if linenumber is given (feature from bug 14468)
- if( $linenumber ) {
- if( $linenumber & 1 ) {
+ if ( $linenumber ) {
+ if ( $linenumber & 1 ) {
$classes[] = 'mw-line-odd';
- }
- else {
+ } else {
$classes[] = 'mw-line-even';
}
}
// Indicate watched status on the line to allow for more
// comprehensive styling.
- $classes[] = $watched ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
+ $classes[] = $watched && $rc->mAttribs['rc_timestamp'] >= $watched
+ ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
// Moved pages (very very old, not supported anymore)
- if( $rc->mAttribs['rc_type'] == RC_MOVE || $rc->mAttribs['rc_type'] == RC_MOVE_OVER_REDIRECT ) {
+ if ( $rc->mAttribs['rc_type'] == RC_MOVE || $rc->mAttribs['rc_type'] == RC_MOVE_OVER_REDIRECT ) {
// Log entries
- } elseif( $rc->mAttribs['rc_log_type'] ) {
+ } elseif ( $rc->mAttribs['rc_log_type'] ) {
$logtitle = SpecialPage::getTitleFor( 'Log', $rc->mAttribs['rc_log_type'] );
$this->insertLog( $s, $logtitle, $rc->mAttribs['rc_log_type'] );
// Log entries (old format) or log targets, and special pages
- } elseif( $rc->mAttribs['rc_namespace'] == NS_SPECIAL ) {
+ } elseif ( $rc->mAttribs['rc_namespace'] == NS_SPECIAL ) {
list( $name, $subpage ) = SpecialPageFactory::resolveAlias( $rc->mAttribs['rc_title'] );
- if( $name == 'Log' ) {
+ if ( $name == 'Log' ) {
$this->insertLog( $s, $rc->getTitle(), $subpage );
}
// Regular entries
$this->insertExtra( $s, $rc, $classes );
# How many users watch this page
- if( $rc->numberofWatchingusers > 0 ) {
+ if ( $rc->numberofWatchingusers > 0 ) {
$s .= ' ' . $this->numberofWatchingusers( $rc->numberofWatchingusers );
}
- if( $this->watchlist ) {
+ if ( $this->watchlist ) {
$classes[] = Sanitizer::escapeClass( 'watchlist-' . $rc->mAttribs['rc_namespace'] . '-' . $rc->mAttribs['rc_title'] );
}
$this->rcCacheIndex = 0;
$this->lastdate = '';
$this->rclistOpen = false;
- $this->getOutput()->addModuleStyles( 'mediawiki.special.changeslist' );
+ $this->getOutput()->addModuleStyles( array(
+ 'mediawiki.special.changeslist',
+ 'mediawiki.special.changeslist.enhanced',
+ ) );
+ $this->getOutput()->addModules( array(
+ 'jquery.makeCollapsible',
+ 'mediawiki.icon',
+ ) );
return '';
}
/**
# If it's a new day, add the headline and flush the cache
$date = $this->getLanguage()->userDate( $rc->mAttribs['rc_timestamp'], $this->getUser() );
$ret = '';
- if( $date != $this->lastdate ) {
+ if ( $date != $this->lastdate ) {
# Process current cache
$ret = $this->recentChangesBlock();
$this->rc_cache = array();
$type = $rc->mAttribs['rc_type'];
$logType = $rc->mAttribs['rc_log_type'];
// Page moves, very old style, not supported anymore
- if( $type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT ) {
+ if ( $type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT ) {
// New unpatrolled pages
- } elseif( $rc->unpatrolled && $type == RC_NEW ) {
- $clink = Linker::linkKnown( $rc->getTitle(), null, array(),
- array( 'rcid' => $rc->mAttribs['rc_id'] ) );
+ } elseif ( $rc->unpatrolled && $type == RC_NEW ) {
+ $clink = Linker::linkKnown( $rc->getTitle() );
// Log entries
- } elseif( $type == RC_LOG ) {
- if( $logType ) {
+ } elseif ( $type == RC_LOG ) {
+ if ( $logType ) {
$logtitle = SpecialPage::getTitleFor( 'Log', $logType );
$logpage = new LogPage( $logType );
$logname = $logpage->getName()->escaped();
}
$watched = false;
// Log entries (old format) and special pages
- } elseif( $rc->mAttribs['rc_namespace'] == NS_SPECIAL ) {
+ } elseif ( $rc->mAttribs['rc_namespace'] == NS_SPECIAL ) {
wfDebug( "Unexpected special page in recentchanges\n" );
$clink = '';
// Edits
# called too many times (50% of CPU time on RecentChanges!).
$thisOldid = $rc->mAttribs['rc_this_oldid'];
$lastOldid = $rc->mAttribs['rc_last_oldid'];
- if( $rc->unpatrolled ) {
- $rcIdQuery = array( 'rcid' => $rc->mAttribs['rc_id'] );
- } else {
- $rcIdQuery = array();
- }
+
$querycur = $curIdEq + array( 'diff' => '0', 'oldid' => $thisOldid );
- $querydiff = $curIdEq + array( 'diff' => $thisOldid, 'oldid' =>
- $lastOldid ) + $rcIdQuery;
+ $querydiff = $curIdEq + array( 'diff' => $thisOldid, 'oldid' => $lastOldid );
- if( !$showdifflinks ) {
+ if ( !$showdifflinks ) {
$curLink = $this->message['cur'];
$diffLink = $this->message['diff'];
- } elseif( in_array( $type, array( RC_NEW, RC_LOG, RC_MOVE, RC_MOVE_OVER_REDIRECT ) ) ) {
+ } elseif ( in_array( $type, array( RC_NEW, RC_LOG, RC_MOVE, RC_MOVE_OVER_REDIRECT ) ) ) {
if ( $type != RC_NEW ) {
$curLink = $this->message['cur'];
} else {
}
# Make "last" link
- if( !$showdifflinks || !$lastOldid ) {
+ if ( !$showdifflinks || !$lastOldid ) {
$lastLink = $this->message['last'];
- } elseif( in_array( $type, array( RC_LOG, RC_MOVE, RC_MOVE_OVER_REDIRECT ) ) ) {
+ } elseif ( in_array( $type, array( RC_LOG, RC_MOVE, RC_MOVE_OVER_REDIRECT ) ) ) {
$lastLink = $this->message['last'];
} else {
$lastLink = Linker::linkKnown( $rc->getTitle(), $this->message['last'],
- array(), $curIdEq + array( 'diff' => $thisOldid, 'oldid' => $lastOldid ) + $rcIdQuery );
+ array(), $curIdEq + array( 'diff' => $thisOldid, 'oldid' => $lastOldid ) );
}
# Make user links
- if( $this->isDeleted( $rc, Revision::DELETED_USER ) ) {
+ if ( $this->isDeleted( $rc, Revision::DELETED_USER ) ) {
$rc->userlink = ' <span class="history-deleted">' . $this->msg( 'rev-deleted-user' )->escaped() . '</span>';
} else {
$rc->userlink = Linker::userLink( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
# Page moves go on their own line
$title = $rc->getTitle();
$secureName = $title->getPrefixedDBkey();
- if( $type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT ) {
+ if ( $type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT ) {
# Use an @ character to prevent collision with page names
- $this->rc_cache['@@' . ($this->rcMoveIndex++)] = array( $rc );
+ $this->rc_cache['@@' . ( $this->rcMoveIndex++ )] = array( $rc );
} else {
# Logs are grouped by type
- if( $type == RC_LOG ) {
+ if ( $type == RC_LOG ) {
$secureName = SpecialPage::getTitleFor( 'Log', $logType )->getPrefixedDBkey();
}
- if( !isset( $this->rc_cache[$secureName] ) ) {
+ if ( !isset( $this->rc_cache[$secureName] ) ) {
$this->rc_cache[$secureName] = array();
}
$classes[] = Sanitizer::escapeClass( 'mw-changeslist-ns'
. $block[0]->mAttribs['rc_namespace'] . '-' . $block[0]->mAttribs['rc_title'] );
}
- $classes[] = $block[0]->watched ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
+ $classes[] = $block[0]->watched && $block[0]->mAttribs['rc_timestamp'] >= $block[0]->watched
+ ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
$r = Html::openElement( 'table', array( 'class' => $classes ) ) .
Html::openElement( 'tr' );
# Some catalyst variables...
$namehidden = true;
$allLogs = true;
- foreach( $block as $rcObj ) {
+ foreach ( $block as $rcObj ) {
$oldid = $rcObj->mAttribs['rc_last_oldid'];
- if( $rcObj->mAttribs['rc_type'] == RC_NEW ) {
+ if ( $rcObj->mAttribs['rc_type'] == RC_NEW ) {
$isnew = true;
}
// If all log actions to this page were hidden, then don't
// give the name of the affected page for this block!
- if( !$this->isDeleted( $rcObj, LogPage::DELETED_ACTION ) ) {
+ if ( !$this->isDeleted( $rcObj, LogPage::DELETED_ACTION ) ) {
$namehidden = false;
}
$u = $rcObj->userlink;
- if( !isset( $userlinks[$u] ) ) {
+ if ( !isset( $userlinks[$u] ) ) {
$userlinks[$u] = 0;
}
- if( $rcObj->unpatrolled ) {
+ if ( $rcObj->unpatrolled ) {
$unpatrolled = true;
}
- if( $rcObj->mAttribs['rc_type'] != RC_LOG ) {
+ if ( $rcObj->mAttribs['rc_type'] != RC_LOG ) {
$allLogs = false;
}
# Get the latest entry with a page_id and oldid
# since logs may not have these.
- if( !$curId && $rcObj->mAttribs['rc_cur_id'] ) {
+ if ( !$curId && $rcObj->mAttribs['rc_cur_id'] ) {
$curId = $rcObj->mAttribs['rc_cur_id'];
}
- if( !$currentRevision && $rcObj->mAttribs['rc_this_oldid'] ) {
+ if ( !$currentRevision && $rcObj->mAttribs['rc_this_oldid'] ) {
$currentRevision = $rcObj->mAttribs['rc_this_oldid'];
}
- if( !$rcObj->mAttribs['rc_bot'] ) {
+ if ( !$rcObj->mAttribs['rc_bot'] ) {
$allBots = false;
}
- if( !$rcObj->mAttribs['rc_minor'] ) {
+ if ( !$rcObj->mAttribs['rc_minor'] ) {
$allMinors = false;
}
krsort( $userlinks );
asort( $userlinks );
$users = array();
- foreach( $userlinks as $userlink => $count ) {
+ foreach ( $userlinks as $userlink => $count ) {
$text = $userlink;
$text .= $this->getLanguage()->getDirMark();
- if( $count > 1 ) {
+ if ( $count > 1 ) {
$text .= ' ' . $this->msg( 'parentheses' )->rawParams( $this->getLanguage()->formatNum( $count ) . '×' )->escaped();
}
array_push( $users, $text );
implode( $this->message['semicolon-separator'], $users )
)->escaped() . '</span>';
- $tl = '<span class="mw-collapsible-toggle mw-enhancedchanges-arrow mw-enhancedchanges-arrow-space"></span>';
+ $tl = '<span class="mw-collapsible-toggle mw-collapsible-arrow mw-enhancedchanges-arrow mw-enhancedchanges-arrow-space"></span>';
$r .= "<td>$tl</td>";
# Main line
$r .= ' ' . $block[0]->timestamp . ' </td><td>';
# Article link
- if( $namehidden ) {
+ if ( $namehidden ) {
$r .= ' <span class="history-deleted">' . $this->msg( 'rev-deleted-event' )->escaped() . '</span>';
- } elseif( $allLogs ) {
+ } elseif ( $allLogs ) {
$r .= $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
} else {
$this->insertArticleLink( $r, $block[0], $block[0]->unpatrolled, $block[0]->watched );
# Total change link
$r .= ' ';
$logtext = '';
- if( !$allLogs ) {
- if( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) {
+ if ( !$allLogs ) {
+ if ( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) {
$logtext .= $nchanges[$n];
- } elseif( $isnew ) {
+ } elseif ( $isnew ) {
$logtext .= $nchanges[$n];
} else {
$params = $queryParams;
}
# History
- if( $allLogs ) {
+ if ( $allLogs ) {
// don't show history link for logs
- } elseif( $namehidden || !$block[0]->getTitle()->exists() ) {
+ } elseif ( $namehidden || !$block[0]->getTitle()->exists() ) {
$logtext .= $this->message['pipe-separator'] . $this->message['hist'];
} else {
$params = $queryParams;
);
}
- if( $logtext !== '' ) {
+ if ( $logtext !== '' ) {
$r .= $this->msg( 'parentheses' )->rawParams( $logtext )->escaped();
}
$r .= ' <span class="mw-changeslist-separator">. .</span> ';
# Character difference (does not apply if only log items)
- if( $wgRCShowChangedSize && !$allLogs ) {
+ if ( $wgRCShowChangedSize && !$allLogs ) {
$last = 0;
$first = count( $block ) - 1;
# Some events (like logs) have an "empty" size, so we need to skip those...
- while( $last < $first && $block[$last]->mAttribs['rc_new_len'] === null ) {
+ while ( $last < $first && $block[$last]->mAttribs['rc_new_len'] === null ) {
$last++;
}
- while( $first > $last && $block[$first]->mAttribs['rc_old_len'] === null ) {
+ while ( $first > $last && $block[$first]->mAttribs['rc_old_len'] === null ) {
$first--;
}
# Get net change
$chardiff = $this->formatCharacterDifference( $block[$first], $block[$last] );
- if( $chardiff == '' ) {
+ if ( $chardiff == '' ) {
$r .= ' ';
} else {
- $r .= ' ' . $chardiff. ' <span class="mw-changeslist-separator">. .</span> ';
+ $r .= ' ' . $chardiff . ' <span class="mw-changeslist-separator">. .</span> ';
}
}
$r .= $this->numberofWatchingusers( $block[0]->numberofWatchingusers );
# Sub-entries
- foreach( $block as $rcObj ) {
+ foreach ( $block as $rcObj ) {
# Classes to apply -- TODO implement
$classes = array();
$type = $rcObj->mAttribs['rc_type'];
- $r .= '<tr><td></td><td class="mw-enhanced-rc">';
+ $trClass = $rcObj->watched && $rcObj->mAttribs['rc_timestamp'] >= $rcObj->watched
+ ? ' class="mw-enhanced-watched"' : '';
+
+ $r .= '<tr' . $trClass . '><td></td><td class="mw-enhanced-rc">';
$r .= $this->recentChangesFlags( array(
'newpage' => $type == RC_NEW,
'minor' => $rcObj->mAttribs['rc_minor'],
$params = $queryParams;
- if( $rcObj->mAttribs['rc_this_oldid'] != 0 ) {
+ if ( $rcObj->mAttribs['rc_this_oldid'] != 0 ) {
$params['oldid'] = $rcObj->mAttribs['rc_this_oldid'];
}
# Log timestamp
- if( $type == RC_LOG ) {
+ if ( $type == RC_LOG ) {
$link = $rcObj->timestamp;
# Revision link
- } elseif( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) {
+ } elseif ( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) {
$link = '<span class="history-deleted">' . $rcObj->timestamp . '</span> ';
} else {
- if ( $rcObj->unpatrolled && $type == RC_NEW) {
- $params['rcid'] = $rcObj->mAttribs['rc_id'];
- }
$link = Linker::linkKnown(
$rcObj->getTitle(),
array(),
$params
);
- if( $this->isDeleted( $rcObj, Revision::DELETED_TEXT ) ) {
+ if ( $this->isDeleted( $rcObj, Revision::DELETED_TEXT ) ) {
$link = '<span class="history-deleted">' . $link . '</span> ';
}
}
$type = $rcObj->mAttribs['rc_type'];
$logType = $rcObj->mAttribs['rc_log_type'];
$classes = array( 'mw-enhanced-rc' );
- if( $logType ) {
+ if ( $logType ) {
# Log entry
$classes[] = Sanitizer::escapeClass( 'mw-changeslist-log-'
. $logType . '-' . $rcObj->mAttribs['rc_title'] );
$classes[] = Sanitizer::escapeClass( 'mw-changeslist-ns' .
$rcObj->mAttribs['rc_namespace'] . '-' . $rcObj->mAttribs['rc_title'] );
}
- $classes[] = $rcObj->watched ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
+ $classes[] = $rcObj->watched && $rcObj->mAttribs['rc_timestamp'] >= $rcObj->watched
+ ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
$r = Html::openElement( 'table', array( 'class' => $classes ) ) .
Html::openElement( 'tr' );
$r .= '<td class="mw-enhanced-rc"><span class="mw-enhancedchanges-arrow-space"></span>';
# Flag and Timestamp
- if( $type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT ) {
- $r .= '    '; // 4 flags -> 4 spaces
+ if ( $type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT ) {
+ $r .= $this->recentChangesFlags( array() ); // no flags, but need the placeholders
} else {
$r .= $this->recentChangesFlags( array(
'newpage' => $type == RC_NEW,
}
$r .= ' ' . $rcObj->timestamp . ' </td><td>';
# Article or log link
- if( $logType ) {
+ if ( $logType ) {
$logPage = new LogPage( $logType );
$logTitle = SpecialPage::getTitleFor( 'Log', $logType );
$logName = $logPage->getName()->escaped();
* @return string
*/
protected function recentChangesBlock() {
- if( count ( $this->rc_cache ) == 0 ) {
+ if ( count ( $this->rc_cache ) == 0 ) {
return '';
}
wfProfileIn( __METHOD__ );
$blockOut = '';
- foreach( $this->rc_cache as $block ) {
- if( count( $block ) < 2 ) {
+ foreach ( $this->rc_cache as $block ) {
+ if ( count( $block ) < 2 ) {
$blockOut .= $this->recentChangesBlockLine( array_shift( $block ) );
} else {
$blockOut .= $this->recentChangesBlockGroup( $block );