Revert r40627, r40551, r40536, r40535 (mark non-autoconfirmed users in RC and watchlist with an orange asterisk). Potentially slow, potentially controversial, so it needs a configuration option to enable/disable it.

This commit is contained in:
Tim Starling 2008-09-16 05:56:43 +00:00
parent 709b9afcc2
commit 6730363fa1
9 changed files with 72 additions and 105 deletions

View file

@ -1231,7 +1231,6 @@ $opts: FormOptions for this request
&$tables: array of tables to be queried
&$join_conds: join conditions for the tables
$opts: FormOptions for this request
&$fields: select fields
'SpecialSearchNogomatch': called when user clicked the "Go" button but the target doesn't exist
$title: title object generated from the text entred by the user

View file

@ -75,38 +75,17 @@ class ChangesList {
* @param bool $patrolled
* @param string $nothing, string to use for empty space
* @param bool $bot
* @param bool $newbie
* @return string
*/
protected function recentChangesFlags( $new, $minor, $patrolled, $nothing = ' ', $bot = false, $newbie = false ) {
protected 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;
$f .= $newbie ? '<span class="newuser">*</span>' : $nothing;
return $f;
}
protected static function userIsNew( $attribs ) {
global $wgAutoConfirmCount, $wgAutoConfirmAge;
if( !array_key_exists('user_editcount',$attribs) || !array_key_exists('user_registration',$attribs) ) {
return false; // missing input!
}
static $time;
$time = time();
$edits = $attribs['user_editcount'];
$age = $attribs['user_registration'];
if( $wgAutoConfirmCount && !$edits || $wgAutoConfirmAge && !$age ) {
return true;
} else if( $wgAutoConfirmCount && $edits < $wgAutoConfirmCount ) {
return true;
} else if( $wgAutoConfirmAge && ($time - wfTimestampOrNull(TS_UNIX,$age)) < $wgAutoConfirmAge ) {
return true;
}
return false;
}
/**
* Returns text for the start of the tabular part of RC
@ -364,10 +343,9 @@ class OldChangesList extends ChangesList {
wfProfileIn($fname.'-page');
$this->insertDiffHist($s, $rc, $unpatrolled);
# M, N, b and ! (minor, new, bot and unpatrolled)
$newbie = self::userIsNew( $rc->mAttribs );
$s .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $unpatrolled, '',
$rc_bot, $newbie );
$s .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $unpatrolled, '', $rc_bot );
$this->insertArticleLink($s, $rc, $unpatrolled, $watched);
wfProfileOut($fname.'-page');
@ -564,14 +542,15 @@ class EnhancedChangesList extends ChangesList {
# Collate list of users
$userlinks = array();
# Other properties
$unpatrolled = $isnew = $newbie = false;
$unpatrolled = false;
$isnew = false;
$curId = $currentRevision = 0;
# Some catalyst variables...
$namehidden = true;
$alllogs = true;
foreach( $block as $rcObj ) {
$oldid = $rcObj->mAttribs['rc_last_oldid'];
if( $rcObj->mAttribs['rc_type'] == RC_NEW ) {
if( $rcObj->mAttribs['rc_new'] ) {
$isnew = true;
}
// If all log actions to this page were hidden, then don't
@ -589,9 +568,6 @@ class EnhancedChangesList extends ChangesList {
if( $rcObj->mAttribs['rc_type'] != RC_LOG ) {
$alllogs = false;
}
if( self::userIsNew( $rcObj->mAttribs ) ) {
$newbie = true;
}
# Get the latest entry with a page_id and oldid
# since logs may not have these.
if( !$curId && $rcObj->mAttribs['rc_cur_id'] ) {
@ -630,7 +606,7 @@ class EnhancedChangesList extends ChangesList {
$r .= '<td valign="top" style="white-space: nowrap"><tt>'.$tl.'&nbsp;';
# Main line
$r .= $this->recentChangesFlags( $isnew, false, $unpatrolled, '&nbsp;', $bot, $newbie );
$r .= $this->recentChangesFlags( $isnew, false, $unpatrolled, '&nbsp;', $bot );
# Timestamp
$r .= '&nbsp;'.$block[0]->timestamp.'&nbsp;</tt></td><td>';
@ -713,8 +689,7 @@ class EnhancedChangesList extends ChangesList {
#$r .= '<tr><td valign="top">'.$this->spacerArrow();
$r .= '<tr><td valign="top">';
$r .= '<tt>'.$this->spacerIndent() . $this->spacerIndent();
$newbie = self::userIsNew( $rcObj->mAttribs );
$r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled, '&nbsp;', $rc_bot, $newbie );
$r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled, '&nbsp;', $rc_bot );
$r .= '&nbsp;</tt></td><td valign="top">';
$o = '';
@ -840,15 +815,14 @@ class EnhancedChangesList extends ChangesList {
$curIdEq = 'curid='.$rc_cur_id;
$r = '<table cellspacing="0" cellpadding="0" border="0" style="background: none"><tr>';
$r .= '<td valign="top" style="white-space: nowrap"><tt>' . $this->spacerArrow() . '&nbsp;';
# Flag and Timestamp
if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
$r .= '&nbsp;&nbsp;&nbsp;&nbsp;'; // 4 flags -> 4 spaces
} else {
$newbie = self::userIsNew( $rcObj->mAttribs );
$r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled,
'&nbsp;', $rc_bot, $newbie );
$r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, '&nbsp;', $rc_bot );
}
$r .= '&nbsp;'.$rcObj->timestamp.'&nbsp;</tt></td><td>';
@ -864,7 +838,7 @@ class EnhancedChangesList extends ChangesList {
}
# Diff and hist links
if( $rc_type != RC_LOG ) {
if ( $rc_type != RC_LOG ) {
$r .= ' ('. $rcObj->difflink . $this->message['semicolon-separator'];
$r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' ) . ')';
}

View file

@ -49,13 +49,15 @@ class RecentChange
# Factory methods
public static function newFromRow( $row ) {
public static function newFromRow( $row )
{
$rc = new RecentChange;
$rc->loadFromRow( $row );
return $rc;
}
public static function newFromCurRow( $row ) {
public static function newFromCurRow( $row )
{
$rc = new RecentChange;
$rc->loadFromCurRow( $row );
$rc->notificationtimestamp = false;
@ -108,22 +110,26 @@ class RecentChange
# Accessors
function setAttribs( $attribs ) {
function setAttribs( $attribs )
{
$this->mAttribs = $attribs;
}
function setExtra( $extra ) {
function setExtra( $extra )
{
$this->mExtra = $extra;
}
function &getTitle() {
function &getTitle()
{
if ( $this->mTitle === false ) {
$this->mTitle = Title::makeTitle( $this->mAttribs['rc_namespace'], $this->mAttribs['rc_title'] );
}
return $this->mTitle;
}
function getMovedToTitle() {
function getMovedToTitle()
{
if ( $this->mMovedToTitle === false ) {
$this->mMovedToTitle = Title::makeTitle( $this->mAttribs['rc_moved_to_ns'],
$this->mAttribs['rc_moved_to_title'] );
@ -132,7 +138,8 @@ class RecentChange
}
# Writes the data in this object to the database
function save() {
function save()
{
global $wgLocalInterwiki, $wgPutIPinRC, $wgRC2UDPAddress,
$wgRC2UDPPort, $wgRC2UDPPrefix, $wgRC2UDPOmitBots;
$fname = 'RecentChange::save';
@ -171,6 +178,35 @@ class RecentChange
# Update old rows, if necessary
if ( $this->mAttribs['rc_type'] == RC_EDIT ) {
$lastTime = $this->mExtra['lastTimestamp'];
#$now = $this->mAttribs['rc_timestamp'];
#$curId = $this->mAttribs['rc_cur_id'];
# Don't bother looking for entries that have probably
# been purged, it just locks up the indexes needlessly.
global $wgRCMaxAge;
$age = time() - wfTimestamp( TS_UNIX, $lastTime );
if( $age < $wgRCMaxAge ) {
# live hack, will commit once tested - kate
# Update rc_this_oldid for the entries which were current
#
#$oldid = $this->mAttribs['rc_last_oldid'];
#$ns = $this->mAttribs['rc_namespace'];
#$title = $this->mAttribs['rc_title'];
#
#$dbw->update( 'recentchanges',
# array( /* SET */
# 'rc_this_oldid' => $oldid
# ), array( /* WHERE */
# 'rc_namespace' => $ns,
# 'rc_title' => $title,
# 'rc_timestamp' => $dbw->timestamp( $lastTime )
# ), $fname
#);
}
# Update rc_cur_time
#$dbw->update( 'recentchanges', array( 'rc_cur_time' => $now ),
# array( 'rc_cur_id' => $curId ), $fname );
}
# Notify external application via UDP
@ -540,43 +576,13 @@ class RecentChange
public function getAttribute( $name ) {
return isset( $this->mAttribs[$name] ) ? $this->mAttribs[$name] : NULL;
}
/*
* Get RC select fields for changes lists
*/
public static function getSelectFields() {
return array(
'rc_timestamp',
'rc_cur_time',
'rc_user',
'rc_user_text',
'rc_namespace',
'rc_title',
'rc_comment',
'rc_minor',
'rc_type',
'rc_cur_id',
'rc_this_oldid',
'rc_last_oldid',
'rc_bot',
'rc_moved_to_ns',
'rc_moved_to_title',
'rc_patrolled',
'rc_old_len',
'rc_new_len',
'rc_params',
'rc_log_type',
'rc_log_action',
'rc_log_id',
'rc_deleted' // this one REALLY should be set...
);
}
/**
* Gets the end part of the diff URL associated with this object
* Blank if no diff link should be displayed
*/
function diffLinkTrail( $forceCur ) {
function diffLinkTrail( $forceCur )
{
if ( $this->mAttribs['rc_type'] == RC_EDIT ) {
$trail = "curid=" . (int)($this->mAttribs['rc_cur_id']) .
"&oldid=" . (int)($this->mAttribs['rc_last_oldid']);

View file

@ -264,11 +264,8 @@ class SpecialRecentChanges extends SpecialPage {
public function doMainQuery( $conds, $opts ) {
global $wgUser;
$tables = array( 'recentchanges', 'user' );
$join_conds = array( 'user' => array('LEFT JOIN','rc_user != 0 AND user_id = rc_user') );
$fields = RecentChange::getSelectFields();
$fields[] = 'user_editcount';
$fields[] = 'user_registration';
$tables = array( 'recentchanges' );
$join_conds = array();
$uid = $wgUser->getId();
$dbr = wfGetDB( DB_SLAVE );
@ -279,10 +276,10 @@ class SpecialRecentChanges extends SpecialPage {
// JOIN on watchlist for users
if( $uid ) {
$tables[] = 'watchlist';
$join_conds['watchlist'] = array('LEFT JOIN',"wl_user={$uid} AND wl_title=rc_title AND wl_namespace=rc_namespace");
$join_conds = array( 'watchlist' => array('LEFT JOIN',"wl_user={$uid} AND wl_title=rc_title AND wl_namespace=rc_namespace") );
}
wfRunHooks('SpecialRecentChangesQuery', array( &$conds, &$tables, &$join_conds, $opts, &$fields ) );
wfRunHooks('SpecialRecentChangesQuery', array( &$conds, &$tables, &$join_conds, $opts ) );
// Is there either one namespace selected or excluded?
// Also, if this is "all" or main namespace, just use timestamp index.
@ -316,7 +313,7 @@ class SpecialRecentChanges extends SpecialPage {
}
/**
* Send output to $wgOut, only called if not using feeds
* Send output to $wgOut, only called if not used feeds
*
* @param $rows array of database rows
* @param $opts FormOptions

View file

@ -91,7 +91,7 @@ function wfSpecialWatchlist( $par ) {
}
$dbr = wfGetDB( DB_SLAVE, 'watchlist' );
list($page,$watchlist,$recentchanges,$user) = $dbr->tableNamesN('page','watchlist','recentchanges','user');
list( $page, $watchlist, $recentchanges ) = $dbr->tableNamesN( 'page', 'watchlist', 'recentchanges' );
$watchlistCount = $dbr->selectField( 'watchlist', 'COUNT(*)',
array( 'wl_user' => $uid ), __METHOD__ );
@ -198,10 +198,9 @@ function wfSpecialWatchlist( $par ) {
} else {
$wltsfield = '';
}
$sql = "SELECT ${recentchanges}.* ${wltsfield}, {$user}.user_editcount, {$user}.user_registration
$sql = "SELECT ${recentchanges}.* ${wltsfield}
FROM $watchlist,$recentchanges
LEFT JOIN $page ON rc_cur_id=page_id
LEFT JOIN $user ON (rc_user !='0' AND rc_user = user_id)
WHERE wl_user=$uid
AND wl_namespace=rc_namespace
AND wl_title=rc_title

View file

@ -212,10 +212,6 @@ span.unpatrolled {
font-weight:bold;
color:red;
}
span.newuser {
font-weight:bold;
color:orange;
}
span.updatedmarker {
color:black;

View file

@ -56,19 +56,7 @@ table.filehistory td.filehistory-selected {
}
/*
* Recent changes
*/
span.unpatrolled {
font-weight: bold;
color: red;
}
span.newuser {
font-weight:bold;
color:orange;
}
/*
* RevisionDelete stuff
* rev_deleted stuff
*/
li span.deleted, span.history-deleted {
text-decoration: line-through;

View file

@ -650,6 +650,10 @@ div.patrollink {
span.newpage, span.minor, span.searchmatch, span.bot {
font-weight: bold;
}
span.unpatrolled {
font-weight: bold;
color: red;
}
span.searchmatch {
color: red;

View file

@ -1154,6 +1154,10 @@ div.patrollink {
span.newpage, span.minor, span.bot {
font-weight: bold;
}
span.unpatrolled {
font-weight: bold;
color: red;
}
.sharedUploadNotice {
font-style: italic;