&$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
* @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
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');
# 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
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'] ) {
$r .= '<td valign="top" style="white-space: nowrap"><tt>'.$tl.' ';
# Main line
- $r .= $this->recentChangesFlags( $isnew, false, $unpatrolled, ' ', $bot, $newbie );
+ $r .= $this->recentChangesFlags( $isnew, false, $unpatrolled, ' ', $bot );
# Timestamp
$r .= ' '.$block[0]->timestamp.' </tt></td><td>';
#$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, ' ', $rc_bot, $newbie );
+ $r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled, ' ', $rc_bot );
$r .= ' </tt></td><td valign="top">';
$o = '';
$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() . ' ';
# 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.' </tt></td><td>';
}
# 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' ) . ')';
}
# 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;
# 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'] );
}
# Writes the data in this object to the database
- function save() {
+ function save()
+ {
global $wgLocalInterwiki, $wgPutIPinRC, $wgRC2UDPAddress,
$wgRC2UDPPort, $wgRC2UDPPrefix, $wgRC2UDPOmitBots;
$fname = 'RecentChange::save';
# 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
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']);
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 );
// 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.
}
/**
- * 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
}
$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__ );
} 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
font-weight:bold;
color:red;
}
-span.newuser {
- font-weight:bold;
- color:orange;
-}
span.updatedmarker {
color:black;
}
/*
- * 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;
span.newpage, span.minor, span.searchmatch, span.bot {
font-weight: bold;
}
+span.unpatrolled {
+ font-weight: bold;
+ color: red;
+}
span.searchmatch {
color: red;
span.newpage, span.minor, span.bot {
font-weight: bold;
}
+span.unpatrolled {
+ font-weight: bold;
+ color: red;
+}
.sharedUploadNotice {
font-style: italic;