From 6730363fa10f78b5df5610a86736ce862f05f7f2 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Tue, 16 Sep 2008 05:56:43 +0000 Subject: [PATCH] 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. --- docs/hooks.txt | 1 - includes/ChangesList.php | 48 +++---------- includes/RecentChange.php | 84 ++++++++++++---------- includes/specials/SpecialRecentchanges.php | 13 ++-- includes/specials/SpecialWatchlist.php | 5 +- skins/common/oldshared.css | 4 -- skins/common/shared.css | 14 +--- skins/modern/main.css | 4 ++ skins/monobook/main.css | 4 ++ 9 files changed, 72 insertions(+), 105 deletions(-) diff --git a/docs/hooks.txt b/docs/hooks.txt index 9f6b3abcd4..641b613b44 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -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 diff --git a/includes/ChangesList.php b/includes/ChangesList.php index f778b1f7e4..41d20398b2 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -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 ? '' . $this->message['newpageletter'] . '' : $nothing; $f .= $minor ? '' . $this->message['minoreditletter'] . '' : $nothing; $f .= $bot ? '' . $this->message['boteditletter'] . '' : $nothing; $f .= $patrolled ? '!' : $nothing; - $f .= $newbie ? '*' : $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 .= ''.$tl.' '; # Main line - $r .= $this->recentChangesFlags( $isnew, false, $unpatrolled, ' ', $bot, $newbie ); + $r .= $this->recentChangesFlags( $isnew, false, $unpatrolled, ' ', $bot ); # Timestamp $r .= ' '.$block[0]->timestamp.' '; @@ -713,8 +689,7 @@ class EnhancedChangesList extends ChangesList { #$r .= ''.$this->spacerArrow(); $r .= ''; $r .= ''.$this->spacerIndent() . $this->spacerIndent(); - $newbie = self::userIsNew( $rcObj->mAttribs ); - $r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled, ' ', $rc_bot, $newbie ); + $r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled, ' ', $rc_bot ); $r .= ' '; $o = ''; @@ -840,15 +815,14 @@ class EnhancedChangesList extends ChangesList { $curIdEq = 'curid='.$rc_cur_id; $r = ''; + $r .= '
' . $this->spacerArrow() . ' '; # Flag and Timestamp if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) { $r .= '    '; // 4 flags -> 4 spaces } else { - $newbie = self::userIsNew( $rcObj->mAttribs ); - $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, - ' ', $rc_bot, $newbie ); + $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, ' ', $rc_bot ); } $r .= ' '.$rcObj->timestamp.' '; @@ -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' ) . ')'; } diff --git a/includes/RecentChange.php b/includes/RecentChange.php index a308c26f63..c22c9ea5a5 100644 --- a/includes/RecentChange.php +++ b/includes/RecentChange.php @@ -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']); diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index 591f9ce48e..0fe134580f 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -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 diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index 9257c61b55..ccdc722977 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -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 diff --git a/skins/common/oldshared.css b/skins/common/oldshared.css index e0931112d3..d9b2a3c2ab 100644 --- a/skins/common/oldshared.css +++ b/skins/common/oldshared.css @@ -212,10 +212,6 @@ span.unpatrolled { font-weight:bold; color:red; } -span.newuser { - font-weight:bold; - color:orange; -} span.updatedmarker { color:black; diff --git a/skins/common/shared.css b/skins/common/shared.css index b54f22a5ca..21194403b6 100644 --- a/skins/common/shared.css +++ b/skins/common/shared.css @@ -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; diff --git a/skins/modern/main.css b/skins/modern/main.css index 27d6a993f7..5917a7bb7c 100644 --- a/skins/modern/main.css +++ b/skins/modern/main.css @@ -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; diff --git a/skins/monobook/main.css b/skins/monobook/main.css index 06e7f65963..1662b333df 100644 --- a/skins/monobook/main.css +++ b/skins/monobook/main.css @@ -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; -- 2.20.1