* @returns string
*/
public static function showCharacterDifference( $old, $new ) {
- global $wgRCChangedSizeThreshold, $wgLang;
+ global $wgRCChangedSizeThreshold, $wgLang, $wgMiserMode;
$szdiff = $new - $old;
- $formatedSize = wfMsgExt( 'rc-change-size', array( 'parsemag', 'escape'), $wgLang->formatNum($szdiff) );
+
+ $code = $wgLang->getCode();
+ static $fastCharDiff = array();
+ if ( !isset($fastCharDiff[$code]) ) {
+ $fastCharDiff[$code] = $wgMiserMode || wfMsgNoTrans( 'rc-change-size' ) === '$1';
+ }
+
+ $formatedSize = $wgLang->formatNum($szdiff);
+
+ if ( !$fastCharDiff[$code] ) {
+ $formatedSize = wfMsgExt( 'rc-change-size', array( 'parsemag', 'escape' ), $formatedSize );
+ }
+
if( abs( $szdiff ) > abs( $wgRCChangedSizeThreshold ) ) {
$tag = 'strong';
} else {
# Diff
$s .= '(' . $this->message['diff'] . ') (';
# Hist
- $s .= $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), $this->message['hist'], 'action=history' ) .
- ') . . ';
+ $s .= $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), $this->message['hist'],
+ 'action=history' ) . ') . . ';
# "[[x]] moved to [[y]]"
$msg = ( $rc->mAttribs['rc_type'] == RC_MOVE ) ? '1movedto2' : '1movedto2_redir';
$s .= wfMsg( $msg, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
protected function insertDiffHist( &$s, &$rc, $unpatrolled ) {
# Diff link
- if( !$this->userCan($rc,Revision::DELETED_TEXT) ) {
+ if( $rc->mAttribs['rc_type'] == RC_NEW || $rc->mAttribs['rc_type'] == RC_LOG ) {
$diffLink = $this->message['diff'];
- } else if( $rc->mAttribs['rc_type'] == RC_NEW || $rc->mAttribs['rc_type'] == RC_LOG ) {
+ } else if( !$this->userCan($rc,Revision::DELETED_TEXT) ) {
$diffLink = $this->message['diff'];
} else {
- $rcidparam = $unpatrolled ?
- array( 'rcid' => $rc->mAttribs['rc_id'] ) : array();
+ $rcidparam = $unpatrolled ? array( 'rcid' => $rc->mAttribs['rc_id'] ) : array();
$diffLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['diff'],
wfArrayToCGI( array(
'curid' => $rc->mAttribs['rc_cur_id'],
protected function insertTimestamp( &$s, $rc ) {
global $wgLang;
- $s .= $this->message['semicolon-separator'] . $wgLang->time( $rc->mAttribs['rc_timestamp'], true, true ) . ' . . ';
+ $s .= $this->message['semicolon-separator'] .
+ $wgLang->time( $rc->mAttribs['rc_timestamp'], true, true ) . ' . . ';
}
/** Insert links to user page, user talk page and eventually a blocking link */
- public function insertUserRelatedLinks(&$s, &$rc) {
- if ( $this->isDeleted($rc,Revision::DELETED_USER) ) {
- $s .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-user') . '</span>';
+ public function insertUserRelatedLinks( &$s, &$rc ) {
+ if( $this->isDeleted( $rc, Revision::DELETED_USER ) ) {
+ $s .= ' <span class="history-deleted">' . wfMsgHtml( 'rev-deleted-user' ) . '</span>';
} else {
$s .= $this->skin->userLink( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
$s .= $this->skin->userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
}
/** insert a formatted action */
- protected function insertAction(&$s, &$rc) {
- # Add action
+ protected function insertAction( &$s, &$rc ) {
if( $rc->mAttribs['rc_type'] == RC_LOG ) {
- // log action
- if ( $this->isDeleted($rc,LogPage::DELETED_ACTION) ) {
- $s .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
+ if( $this->isDeleted( $rc, LogPage::DELETED_ACTION ) ) {
+ $s .= ' <span class="history-deleted">' . wfMsgHtml( 'rev-deleted-event' ) . '</span>';
} else {
- $s .= ' ' . LogPage::actionText( $rc->mAttribs['rc_log_type'], $rc->mAttribs['rc_log_action'],
- $rc->getTitle(), $this->skin, LogPage::extractParams($rc->mAttribs['rc_params']), true, true );
+ $s .= ' '.LogPage::actionText( $rc->mAttribs['rc_log_type'], $rc->mAttribs['rc_log_action'],
+ $rc->getTitle(), $this->skin, LogPage::extractParams( $rc->mAttribs['rc_params'] ), true, true );
}
}
}
/** insert a formatted comment */
- protected function insertComment(&$s, &$rc) {
- # Add comment
+ protected function insertComment( &$s, &$rc ) {
if( $rc->mAttribs['rc_type'] != RC_MOVE && $rc->mAttribs['rc_type'] != RC_MOVE_OVER_REDIRECT ) {
- // log comment
- if ( $this->isDeleted($rc,Revision::DELETED_COMMENT) ) {
- $s .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-comment') . '</span>';
+ if( $this->isDeleted( $rc, Revision::DELETED_COMMENT ) ) {
+ $s .= ' <span class="history-deleted">' . wfMsgHtml( 'rev-deleted-comment' ) . '</span>';
} else {
$s .= $this->skin->commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
}
protected function numberofWatchingusers( $count ) {
global $wgLang;
static $cache = array();
- if ( $count > 0 ) {
- if ( !isset( $cache[$count] ) ) {
- $cache[$count] = wfMsgExt('number_of_watching_users_RCview',
- array('parsemag', 'escape'), $wgLang->formatNum($count));
+ if( $count > 0 ) {
+ if( !isset( $cache[$count] ) ) {
+ $cache[$count] = wfMsgExt( 'number_of_watching_users_RCview',
+ array('parsemag', 'escape' ), $wgLang->formatNum( $count ) );
}
return $cache[$count];
} else {
* @return bool
*/
public static function isDeleted( $rc, $field ) {
- return ($rc->mAttribs['rc_deleted'] & $field) == $field;
+ return ( $rc->mAttribs['rc_deleted'] & $field ) == $field;
}
/**
$permission = ( $rc->mAttribs['rc_deleted'] & Revision::DELETED_RESTRICTED ) == Revision::DELETED_RESTRICTED
? 'suppressrevision'
: 'deleterevision';
- wfDebug( "Checking for $permission due to $field match on $rc->mAttribs['rc_deleted']\n" );
+ wfDebug( "Checking for $permission due to $field match on {$rc->mAttribs['rc_deleted']}\n" );
return $wgUser->isAllowed( $permission );
} else {
return true;
protected function maybeWatchedLink( $link, $watched=false ) {
if( $watched ) {
- // FIXME: css style might be more appropriate
return '<strong class="mw-watched">' . $link . '</strong>';
} else {
return '<span class="mw-rc-unwatched">' . $link . '</span>';
}
}
+
+ /** Inserts a rollback link */
+ protected function insertRollback( &$s, &$rc ) {
+ global $wgUser;
+ if( !$rc->mAttribs['rc_new'] && $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 */
+ if ($wgUser->isAllowed('rollback') && $rc->mAttribs['page_latest'] == $rc->mAttribs['rc_this_oldid'] )
+ {
+ $rev = new Revision( array(
+ 'id' => $rc->mAttribs['rc_this_oldid'],
+ 'user' => $rc->mAttribs['rc_user'],
+ 'user_text' => $rc->mAttribs['rc_user_text'],
+ 'deleted' => $rc->mAttribs['rc_deleted']
+ ) );
+ $rev->setTitle( $page );
+ $s .= ' '.$this->skin->generateRollback( $rev );
+ }
+ }
+ }
+
+ protected function insertTags( &$s, &$rc, &$classes ) {
+ if ( empty($rc->mAttribs['ts_tags']) )
+ return;
+
+ list($tagSummary, $newClasses) = ChangeTags::formatSummaryRow( $rc->mAttribs['ts_tags'], 'changeslist' );
+ $classes = array_merge( $classes, $newClasses );
+ $s .= ' ' . $tagSummary;
+ }
+
+ protected function insertExtra( &$s, &$rc, &$classes ) {
+ ## Empty, used for subclassers to add anything special.
+ }
}
/**
* Format a line using the old system (aka without any javascript).
*/
- public function recentChangesLine( &$rc, $watched = false ) {
- global $wgContLang, $wgRCShowChangedSize, $wgUser;
-
+ public function recentChangesLine( &$rc, $watched = false, $linenumber = NULL ) {
+ global $wgLang, $wgRCShowChangedSize, $wgUser;
wfProfileIn( __METHOD__ );
-
- # Extract DB fields into local scope
- // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
- extract( $rc->mAttribs );
-
# Should patrol-related stuff be shown?
- $unpatrolled = $wgUser->useRCPatrol() && $rc_patrolled == 0;
+ $unpatrolled = $wgUser->useRCPatrol() && !$rc->mAttribs['rc_patrolled'];
- $dateheader = ""; // $s now contains only <li>...</li>, for hooks' convenience.
- $this->insertDateHeader($dateheader,$rc_timestamp);
+ $dateheader = ''; // $s now contains only <li>...</li>, for hooks' convenience.
+ $this->insertDateHeader( $dateheader, $rc->mAttribs['rc_timestamp'] );
$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 ) {
+ $classes[] = 'mw-line-odd';
+ }
+ else {
+ $classes[] = 'mw-line-even';
+ }
+ }
// Moved pages
- if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
+ if( $rc->mAttribs['rc_type'] == RC_MOVE || $rc->mAttribs['rc_type'] == RC_MOVE_OVER_REDIRECT ) {
$this->insertMove( $s, $rc );
// Log entries
- } elseif( $rc_log_type ) {
- $logtitle = Title::newFromText( "Log/$rc_log_type", NS_SPECIAL );
- $this->insertLog( $s, $logtitle, $rc_log_type );
+ } elseif( $rc->mAttribs['rc_log_type'] ) {
+ $logtitle = Title::newFromText( 'Log/'.$rc->mAttribs['rc_log_type'], NS_SPECIAL );
+ $this->insertLog( $s, $logtitle, $rc->mAttribs['rc_log_type'] );
// Log entries (old format) or log targets, and special pages
- } elseif( $rc_namespace == NS_SPECIAL ) {
- list( $specialName, $specialSubpage ) = SpecialPage::resolveAliasWithSubpage( $rc_title );
- if ( $specialName == 'Log' ) {
- $this->insertLog( $s, $rc->getTitle(), $specialSubpage );
- } else {
- wfDebug( "Unexpected special page in recentchanges\n" );
+ } elseif( $rc->mAttribs['rc_namespace'] == NS_SPECIAL ) {
+ list( $name, $subpage ) = SpecialPage::resolveAliasWithSubpage( $rc->mAttribs['rc_title'] );
+ if( $name == 'Log' ) {
+ $this->insertLog( $s, $rc->getTitle(), $subpage );
}
// Regular entries
} else {
- $this->insertDiffHist($s, $rc, $unpatrolled);
+ $this->insertDiffHist( $s, $rc, $unpatrolled );
# M, N, b and ! (minor, new, bot and unpatrolled)
- $s .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $unpatrolled, '', $rc_bot );
- $this->insertArticleLink($s, $rc, $unpatrolled, $watched);
+ $s .= $this->recentChangesFlags( $rc->mAttribs['rc_new'], $rc->mAttribs['rc_minor'],
+ $unpatrolled, '', $rc->mAttribs['rc_bot'] );
+ $this->insertArticleLink( $s, $rc, $unpatrolled, $watched );
}
-
- $this->insertTimestamp($s,$rc);
-
+ # Edit/log timestamp
+ $this->insertTimestamp( $s, $rc );
+ # Bytes added or removed
if( $wgRCShowChangedSize ) {
- $s .= ( $rc->getCharacterDifference() == '' ? '' : $rc->getCharacterDifference() . ' . . ' );
+ $cd = $rc->getCharacterDifference();
+ if( $cd != '' ) {
+ $s .= "$cd . . ";
+ }
}
# User tool links
- $this->insertUserRelatedLinks($s,$rc);
+ $this->insertUserRelatedLinks( $s, $rc );
# Log action text (if any)
- $this->insertAction($s, $rc);
+ $this->insertAction( $s, $rc );
# Edit or log comment
- $this->insertComment($s, $rc);
-
+ $this->insertComment( $s, $rc );
+ # Tags
+ $this->insertTags( $s, $rc, $classes );
+ # Rollback
+ $this->insertRollback( $s, $rc );
+ # For subclasses
+ $this->insertExtra( $s, $rc, $classes );
+
# Mark revision as deleted if so
- if ( !$rc_log_type && $this->isDeleted($rc,Revision::DELETED_TEXT) )
+ if( !$rc->mAttribs['rc_log_type'] && $this->isDeleted($rc,Revision::DELETED_TEXT) ) {
$s .= ' <tt>' . wfMsgHtml( 'deletedrev' ) . '</tt>';
- if($rc->numberofWatchingusers > 0) {
- $s .= ' ' . wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($rc->numberofWatchingusers));
+ }
+ # How many users watch this page
+ if( $rc->numberofWatchingusers > 0 ) {
+ $s .= ' ' . wfMsgExt( 'number_of_watching_users_RCview',
+ array( 'parsemag', 'escape' ), $wgLang->formatNum( $rc->numberofWatchingusers ) );
}
wfRunHooks( 'OldChangesListRecentChangesLine', array(&$this, &$s, $rc) );
-
- $s = "<li>$s</li>\n";
wfProfileOut( __METHOD__ );
- return $dateheader . $s;
+ return "$dateheader<li class=\"".implode( ' ', $classes )."\">$s</li>\n";
}
}
/**
- * Generate a list of changes using an Enhanced system (use javascript).
+ * Generate a list of changes using an Enhanced system (uses javascript).
*/
class EnhancedChangesList extends ChangesList {
-
/**
* Add the JavaScript file for enhanced changeslist
* @ return string
* Format a line for enhanced recentchange (aka with javascript and block of lines).
*/
public function recentChangesLine( &$baseRC, $watched = false ) {
- global $wgLang, $wgContLang, $wgUser;
+ global $wgLang, $wgUser;
+
+ wfProfileIn( __METHOD__ );
# Create a specialised object
$rc = RCCacheEntry::newFromParent( $baseRC );
# Extract fields from DB into the function scope (rc_xxxx variables)
- // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
+ // FIXME: Would be good to replace this extract() call with something
+ // that explicitly initializes variables.
extract( $rc->mAttribs );
- $curIdEq = 'curid=' . $rc_cur_id;
+ $curIdEq = array( 'curid' => $rc_cur_id );
# If it's a new day, add the headline and flush the cache
$date = $wgLang->date( $rc_timestamp, true );
// Page moves
if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
$msg = ( $rc_type == RC_MOVE ) ? "1movedto2" : "1movedto2_redir";
- $clink = wfMsg( $msg, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
- $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
+ $clink = wfMsg( $msg, $this->skin->linkKnown( $rc->getTitle(), null,
+ array(), array( 'redirect' => 'no' ) ),
+ $this->skin->linkKnown( $rc->getMovedToTitle() ) );
// New unpatrolled pages
} else if( $rc->unpatrolled && $rc_type == RC_NEW ) {
- $clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '', "rcid={$rc_id}" );
+ $clink = $this->skin->linkKnown( $rc->getTitle(), null, array(),
+ array( 'rcid' => $rc_id ) );
// Log entries
} else if( $rc_type == RC_LOG ) {
if( $rc_log_type ) {
$logtitle = SpecialPage::getTitleFor( 'Log', $rc_log_type );
- $clink = '(' . $this->skin->makeKnownLinkObj( $logtitle, LogPage::logName($rc_log_type) ) . ')';
+ $clink = '(' . $this->skin->linkKnown( $logtitle,
+ LogPage::logName($rc_log_type) ) . ')';
} else {
- $clink = $this->skin->makeLinkObj( $rc->getTitle(), '' );
+ $clink = $this->skin->link( $rc->getTitle() );
}
$watched = false;
// Log entries (old format) and special pages
if ( $specialName == 'Log' ) {
# Log updates, etc
$logname = LogPage::logName( $logtype );
- $clink = '(' . $this->skin->makeKnownLinkObj( $rc->getTitle(), $logname ) . ')';
+ $clink = '(' . $this->skin->linkKnown( $rc->getTitle(), $logname ) . ')';
} else {
wfDebug( "Unexpected special page in recentchanges\n" );
$clink = '';
}
// Edits
} else {
- $clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '' );
+ $clink = $this->skin->linkKnown( $rc->getTitle() );
}
# Don't show unusable diff links
$showdifflinks = false;
}
- $time = $wgContLang->time( $rc_timestamp, true, true );
+ $time = $wgLang->time( $rc_timestamp, true, true );
$rc->watched = $watched;
$rc->link = $clink;
$rc->timestamp = $time;
$rc->numberofWatchingusers = $baseRC->numberofWatchingusers;
- # Make "cur" and "diff" links
+ # Make "cur" and "diff" links. Don't use link(), it's too slow if
+ # called too many times (50% of CPU time on RecentChanges!).
if( $rc->unpatrolled ) {
- $rcIdQuery = "&rcid={$rc_id}";
+ $rcIdQuery = array( 'rcid' => $rc_id );
} else {
- $rcIdQuery = '';
+ $rcIdQuery = array();
}
- $querycur = $curIdEq."&diff=0&oldid=$rc_this_oldid";
- $querydiff = $curIdEq."&diff=$rc_this_oldid&oldid=$rc_last_oldid$rcIdQuery";
- $aprops = ' tabindex="'.$baseRC->counter.'"';
- $curLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['cur'], $querycur, '' ,'', $aprops );
+ $querycur = $curIdEq + array( 'diff' => '0', 'oldid' => $rc_this_oldid );
+ $querydiff = $curIdEq + array( 'diff' => $rc_this_oldid, 'oldid' =>
+ $rc_last_oldid ) + $rcIdQuery;
- # Make "diff" an "cur" links
if( !$showdifflinks ) {
- $curLink = $this->message['cur'];
- $diffLink = $this->message['diff'];
- } else if( $rc_type == RC_NEW || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
- if( $rc_type != RC_NEW ) {
+ $curLink = $this->message['cur'];
+ $diffLink = $this->message['diff'];
+ } else if( in_array( $rc_type, array(RC_NEW,RC_LOG,RC_MOVE,RC_MOVE_OVER_REDIRECT) ) ) {
+ if ( $rc_type != RC_NEW ) {
$curLink = $this->message['cur'];
+ } else {
+ $curUrl = htmlspecialchars( $rc->getTitle()->getLinkUrl( $querycur ) );
+ $curLink = "<a href=\"$curUrl\" tabindex=\"{$baseRC->counter}\">{$this->message['cur']}</a>";
}
$diffLink = $this->message['diff'];
} else {
- $diffLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['diff'], $querydiff, '' ,'', $aprops );
+ $diffUrl = htmlspecialchars( $rc->getTitle()->getLinkUrl( $querydiff ) );
+ $curUrl = htmlspecialchars( $rc->getTitle()->getLinkUrl( $querycur ) );
+ $diffLink = "<a href=\"$diffUrl\" tabindex=\"{$baseRC->counter}\">{$this->message['diff']}</a>";
+ $curLink = "<a href=\"$curUrl\" tabindex=\"{$baseRC->counter}\">{$this->message['cur']}</a>";
}
# Make "last" link
- if( !$showdifflinks ) {
+ if( !$showdifflinks || !$rc_last_oldid ) {
$lastLink = $this->message['last'];
- } else if( $rc_last_oldid == 0 || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
+ } else if( $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
$lastLink = $this->message['last'];
} else {
- $lastLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['last'],
- $curIdEq.'&diff='.$rc_this_oldid.'&oldid='.$rc_last_oldid . $rcIdQuery );
+ $lastLink = $this->skin->linkKnown( $rc->getTitle(), $this->message['last'],
+ array(), $curIdEq + array('diff' => $rc_this_oldid, 'oldid' => $rc_last_oldid) + $rcIdQuery );
}
# Make user links
if( $this->isDeleted($rc,Revision::DELETED_USER) ) {
- $rc->userlink = ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-user') . '</span>';
+ $rc->userlink = ' <span class="history-deleted">' . wfMsgHtml( 'rev-deleted-user' ) . '</span>';
} else {
$rc->userlink = $this->skin->userLink( $rc_user, $rc_user_text );
$rc->usertalklink = $this->skin->userToolLinks( $rc_user, $rc_user_text );
if( !isset( $this->rc_cache[$secureName] ) ) {
$this->rc_cache[$secureName] = array();
}
+
array_push( $this->rc_cache[$secureName], $rc );
}
+
+ wfProfileOut( __METHOD__ );
+
return $ret;
}
*/
protected function recentChangesBlockGroup( $block ) {
global $wgLang, $wgContLang, $wgRCShowChangedSize;
+
+ wfProfileIn( __METHOD__ );
+
$r = '<table cellpadding="0" cellspacing="0" border="0" style="background: none"><tr>';
# Collate list of users
array_push( $users, $text );
}
- $users = ' <span class="changedby">[' . implode( $this->message['semicolon-separator'], $users ) . ']</span>';
+ $users = ' <span class="changedby">[' .
+ implode( $this->message['semicolon-separator'], $users ) . ']</span>';
# ID for JS visibility toggle
$jsid = $this->rcCacheIndex;
# onclick handler to toggle hidden/expanded
$toggleLink = "onclick='toggleVisibility($jsid); return false'";
# Title for <a> tags
- $expandTitle = htmlspecialchars( wfMsg('rc-enhanced-expand') );
- $closeTitle = htmlspecialchars( wfMsg('rc-enhanced-hide') );
+ $expandTitle = htmlspecialchars( wfMsg( 'rc-enhanced-expand' ) );
+ $closeTitle = htmlspecialchars( wfMsg( 'rc-enhanced-hide' ) );
- $tl = "<span id='mw-rc-openarrow-$jsid' class='mw-changeslist-expanded' style='visibility:hidden'><a href='#' $toggleLink title='$expandTitle'>" . $this->sideArrow() . "</a></span>";
+ $tl = "<span id='mw-rc-openarrow-$jsid' class='mw-changeslist-expanded' style='visibility:hidden'><a href='#' $toggleLink title='$expandTitle'>" . $this->sideArrow() . "</a></span>";
$tl .= "<span id='mw-rc-closearrow-$jsid' class='mw-changeslist-hidden' style='display:none'><a href='#' $toggleLink title='$closeTitle'>" . $this->downArrow() . "</a></span>";
$r .= '<td valign="top" style="white-space: nowrap"><tt>'.$tl.' ';
# Article link
if( $namehidden ) {
- $r .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
+ $r .= ' <span class="history-deleted">' . wfMsgHtml( 'rev-deleted-event' ) . '</span>';
} else if( $allLogs ) {
$r .= $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
} else {
$r .= ' ';
if( !$allLogs ) {
$r .= '(';
- if( !ChangesList::userCan($rcObj,Revision::DELETED_TEXT) ) {
+ if( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT ) ) {
$r .= $nchanges[$n];
} else if( $isnew ) {
$r .= $nchanges[$n];
$r .= '<div id="mw-rc-subentries-'.$jsid.'" class="mw-changeslist-hidden">';
$r .= '<table cellpadding="0" cellspacing="0" border="0" style="background: none">';
foreach( $block as $rcObj ) {
- # Get rc_xxxx variables
- // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
+ # Extract fields from DB into the function scope (rc_xxxx variables)
+ // FIXME: Would be good to replace this extract() call with something
+ // that explicitly initializes variables.
+ # Classes to apply -- TODO implement
+ $classes = array();
extract( $rcObj->mAttribs );
#$r .= '<tr><td valign="top">'.$this->spacerArrow();
$r .= $rcObj->userlink;
$r .= $rcObj->usertalklink;
// log action
- parent::insertAction( $r, $rcObj );
+ $this->insertAction( $r, $rcObj );
// log comment
- parent::insertComment( $r, $rcObj );
+ $this->insertComment( $r, $rcObj );
+ # Rollback
+ $this->insertRollback( $r, $rcObj );
+ # Tags
+ $this->insertTags( $r, $rcObj, $classes );
+
# Mark revision as deleted
if( !$rc_log_type && $this->isDeleted($rcObj,Revision::DELETED_TEXT) ) {
$r .= ' <tt>' . wfMsgHtml( 'deletedrev' ) . '</tt>';
$r .= "</table></div>\n";
$this->rcCacheIndex++;
+
+ wfProfileOut( __METHOD__ );
+
return $r;
}
protected function sideArrow() {
global $wgContLang;
$dir = $wgContLang->isRTL() ? 'l' : 'r';
- return $this->arrow( $dir, '+', wfMsg('rc-enhanced-expand') );
+ return $this->arrow( $dir, '+', wfMsg( 'rc-enhanced-expand' ) );
}
/**
* @return string HTML <img> tag
*/
protected function downArrow() {
- return $this->arrow( 'd', '-', wfMsg('rc-enhanced-hide') );
+ return $this->arrow( 'd', '-', wfMsg( 'rc-enhanced-hide' ) );
}
/**
* @return string a HTML formated line (generated using $r)
*/
protected function recentChangesBlockLine( $rcObj ) {
- global $wgContLang, $wgRCShowChangedSize;
- # Get rc_xxxx variables
- // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
+ global $wgRCShowChangedSize;
+
+ wfProfileIn( __METHOD__ );
+
+ # Extract fields from DB into the function scope (rc_xxxx variables)
+ // FIXME: Would be good to replace this extract() call with something
+ // that explicitly initializes variables.
+ $classes = array(); // TODO implement
extract( $rcObj->mAttribs );
$curIdEq = "curid={$rc_cur_id}";
}
# Diff and hist links
if ( $rc_type != RC_LOG ) {
- $r .= ' ('. $rcObj->difflink . $this->message['semicolon-separator'];
- $r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' ) . ')';
+ $r .= ' ('. $rcObj->difflink . $this->message['semicolon-separator'];
+ $r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), $this->message['hist'],
+ $curIdEq.'&action=history' ) . ')';
}
$r .= ' . . ';
# Character diff
- if( $wgRCShowChangedSize ) {
- $r .= ( $rcObj->getCharacterDifference() == '' ? '' : $rcObj->getCharacterDifference() . ' . . ' ) ;
+ if( $wgRCShowChangedSize && ($cd = $rcObj->getCharacterDifference()) ) {
+ $r .= "$cd . . ";
}
# User/talk
$r .= ' '.$rcObj->userlink . $rcObj->usertalklink;
$this->skin, LogPage::extractParams($rc_params), true, true );
}
}
- # Edit or log comment
- if( $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
- // log comment
- if ( $this->isDeleted($rcObj,LogPage::DELETED_COMMENT) ) {
- $r .= ' <span class="history-deleted">' . wfMsg('rev-deleted-comment') . '</span>';
- } else {
- $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
- }
- }
+ $this->insertComment( $r, $rcObj );
+ $this->insertRollback( $r, $rcObj );
+ # Tags
+ $this->insertTags( $r, $rcObj, $classes );
# Show how many people are watching this if enabled
$r .= $this->numberofWatchingusers($rcObj->numberofWatchingusers);
$r .= "</td></tr></table>\n";
+
+ wfProfileOut( __METHOD__ );
+
return $r;
}
if( count ( $this->rc_cache ) == 0 ) {
return '';
}
+
+ wfProfileIn( __METHOD__ );
+
$blockOut = '';
foreach( $this->rc_cache as $block ) {
if( count( $block ) < 2 ) {
$blockOut .= $this->recentChangesBlockGroup( $block );
}
}
+
+ wfProfileOut( __METHOD__ );
+
return '<div>'.$blockOut.'</div>';
}