$this->preCacheMessages();
}
+ /**
+ * Fetch an appropriate changes list class for the specified user
+ * Some users might want to use an enhanced list format, for instance
+ *
+ * @param $user User to fetch the list class for
+ * @return ChangesList derivative
+ */
function newFromUser( &$user ) {
$sk =& $user->getSkin();
- if( $user->getOption('usenewrc') ) {
- return new EnhancedChangesList( $sk );
+ $list = NULL;
+ if( wfRunHooks( 'FetchChangesList', array( &$user, &$skin, &$list ) ) ) {
+ return $user->getOption( 'usenewrc' ) ? new EnhancedChangesList( $sk ) : new OldChangesList( $sk );
} else {
- return new OldChangesList( $sk );
+ return $list;
}
}
// Precache various messages
if( !isset( $this->message ) ) {
foreach( explode(' ', 'cur diff hist minoreditletter newpageletter last '.
- 'blocklink changes history' ) as $msg ) {
+ 'blocklink changes history boteditletter' ) as $msg ) {
$this->message[$msg] = wfMsgExt( $msg, array( 'escape') );
}
}
/**
- * Returns the appropiate flags for new page, minor change and patrolling
+ * Returns the appropriate flags for new page, minor change and patrolling
*/
- function recentChangesFlags( $new, $minor, $patrolled, $nothing = ' ' ) {
+ function recentChangesFlags( $new, $minor, $patrolled, $nothing = ' ', $bot = false ) {
$f = $new ? '<span class="newpage">' . $this->message['newpageletter'] . '</span>'
: $nothing;
$f .= $minor ? '<span class="minor">' . $this->message['minoreditletter'] . '</span>'
: $nothing;
+ $f .= $bot ? '<span class="bot">' . $this->message['boteditletter'] . '</span>' : $nothing;
$f .= $patrolled ? '<span class="unpatrolled">!</span>' : $nothing;
return $f;
}
: '';
$articlelink = ' '. $this->skin->makeKnownLinkObj( $rc->getTitle(), '', $params );
if($watched) $articlelink = '<strong>'.$articlelink.'</strong>';
+ global $wgContLang;
+ $articlelink .= $wgContLang->getDirMark();
$s .= ' '.$articlelink;
}
if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
$this->insertMove( $s, $rc );
// log entries
- } elseif( $rc_namespace == NS_SPECIAL && preg_match( '!^Log/(.*)$!', $rc_title, $matches ) ) {
- $this->insertLog($s, $rc->getTitle(), $matches[1]);
+ } 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" );
+ }
// all other stuff
} else {
wfProfileIn($fname.'-page');
$this->insertDiffHist($s, $rc, $unpatrolled);
- # M, N and ! (minor, new and unpatrolled)
- $s .= ' ' . $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $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);
wfProfileOut($fname.'-page');
$msg = ( $rc_type == RC_MOVE ) ? "1movedto2" : "1movedto2_redir";
$clink = wfMsg( $msg, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
$this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
- } elseif( $rc_namespace == NS_SPECIAL && preg_match( '!^Log/(.*)$!', $rc_title, $matches ) ) {
- # Log updates, etc
- $logtype = $matches[1];
- $logname = LogPage::logName( $logtype );
- $clink = '(' . $this->skin->makeKnownLinkObj( $rc->getTitle(), $logname ) . ')';
+ } elseif( $rc_namespace == NS_SPECIAL ) {
+ list( $specialName, $logtype ) = SpecialPage::resolveAliasWithSubpage( $rc_title );
+ if ( $specialName == 'Log' ) {
+ # Log updates, etc
+ $logname = LogPage::logName( $logtype );
+ $clink = '(' . $this->skin->makeKnownLinkObj( $rc->getTitle(), $logname ) . ')';
+ } else {
+ wfDebug( "Unexpected special page in recentchanges\n" );
+ $clink = '';
+ }
} elseif( $rc->unpatrolled && $rc_type == RC_NEW ) {
# Unpatrolled new page, give rc_id in query
$clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '', "rcid={$rc_id}" );
* Enhanced RC group
*/
function recentChangesBlockGroup( $block ) {
+ global $wgContLang;
$r = '';
# Collate list of users
if( $rcObj->unpatrolled ) {
$unpatrolled = true;
}
+ $bot = $rcObj->mAttribs['rc_bot'];
$userlinks[$u]++;
}
$users = array();
foreach( $userlinks as $userlink => $count) {
$text = $userlink;
+ $text .= $wgContLang->getDirMark();
if( $count > 1 ) {
$text .= ' ('.$count.'×)';
}
# Main line
$r .= '<tt>';
- $r .= $this->recentChangesFlags( $isnew, false, $unpatrolled );
+ $r .= $this->recentChangesFlags( $isnew, false, $unpatrolled, ' ', $bot );
# Timestamp
$r .= ' '.$block[0]->timestamp.' ';
# Article link
$r .= $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
+ $r .= $wgContLang->getDirMark();
$curIdEq = 'curid=' . $block[0]->mAttribs['rc_cur_id'];
$currentRevision = $block[0]->mAttribs['rc_this_oldid'];
$r .= $this->spacerArrow();
$r .= '<tt> ';
- $r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled );
+ $r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled, ' ', $rc_bot );
$r .= ' </tt>';
$o = '';
if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
$r .= ' ';
} else {
- $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled );
+ $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, ' ', $rc_bot );
}
$r .= ' '.$rcObj->timestamp.' </tt>';