* rc_title non-prefixed db key
* rc_type is new entry, used to determine whether updating is necessary
* rc_minor is minor
- * rc_cur_id id of associated cur entry
+ * rc_cur_id page_id of associated page entry
* rc_user user id who made the entry
* rc_user_text user name who made the entry
* rc_comment edit summary
- * rc_this_oldid old_id associated with this entry (or zero)
- * rc_last_oldid old_id associated with the entry before this one (or zero)
+ * rc_this_oldid rev_id associated with this entry (or zero)
+ * rc_last_oldid rev_id associated with the entry before this one (or zero)
* rc_bot is bot, hidden
* rc_ip IP address of the user in dotted quad notation
* rc_new obsolete, use rc_type==RC_NEW
* lastTimestamp timestamp of previous entry, used in WHERE clause during update
* lang the interwiki prefix, automatically set in save()
*
+ * temporary: not stored in the database
+ * notificationtimestamp
+ * numberofWatchingusers
+ *
* @todo document functions and variables
* @package MediaWiki
*/
{
$rc = new RecentChange;
$rc->loadFromCurRow( $row );
+ $rc->notificationtimestamp = false;
+ $rc->numberofWatchingusers = false;
return $rc;
}
$this->mExtra = $extra;
}
- function getTitle()
+ function &getTitle()
{
if ( $this->mTitle === false ) {
$this->mTitle = Title::makeTitle( $this->mAttribs['rc_namespace'], $this->mAttribs['rc_title'] );
$this->mAttribs['rc_cur_time']=$dbw->timestamp($this->mAttribs['rc_cur_time']);
# Insert new row
- $dbw->insertArray( 'recentchanges', $this->mAttribs, $fname );
+ $dbw->insert( 'recentchanges', $this->mAttribs, $fname );
# Update old rows, if necessary
if ( $this->mAttribs['rc_type'] == RC_EDIT ) {
$now = $this->mAttribs['rc_timestamp'];
$curId = $this->mAttribs['rc_cur_id'];
- # Update rc_this_oldid for the entries which were current
- $dbw->updateArray( 'recentchanges',
- array( /* SET */
- 'rc_this_oldid' => $oldid
- ), array( /* WHERE */
- 'rc_namespace' => $ns,
- 'rc_title' => $title,
- 'rc_timestamp' => $dbw->timestamp($lastTime)
- ), $fname
- );
+ # 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 ) {
+ # Update rc_this_oldid for the entries which were current
+ $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->updateArray( 'recentchanges', array( 'rc_cur_time' => $now ),
+ $dbw->update( 'recentchanges', array( 'rc_cur_time' => $now ),
array( 'rc_cur_id' => $curId ), $fname );
}
$dbw =& wfGetDB( DB_MASTER );
- $dbw->updateArray( 'recentchanges',
+ $dbw->update( 'recentchanges',
array( /* SET */
'rc_patrolled' => 1
), array( /* WHERE */
'rc_moved_to_ns' => 0,
'rc_moved_to_title' => '',
'rc_ip' => $ip,
+ 'rc_patrolled' => 0,
'rc_new' => 0 # obsolete
);
'rc_moved_to_ns' => 0,
'rc_moved_to_title' => '',
'rc_ip' => $ip,
+ 'rc_patrolled' => 0,
'rc_new' => 1 # obsolete
);
function loadFromCurRow( $row )
{
$this->mAttribs = array(
- 'rc_timestamp' => $row->cur_timestamp,
- 'rc_cur_time' => $row->cur_timestamp,
- 'rc_user' => $row->cur_user,
- 'rc_user_text' => $row->cur_user_text,
- 'rc_namespace' => $row->cur_namespace,
- 'rc_title' => $row->cur_title,
- 'rc_comment' => $row->cur_comment,
- 'rc_minor' => !!$row->cur_minor_edit,
- 'rc_type' => $row->cur_is_new ? RC_NEW : RC_EDIT,
- 'rc_cur_id' => $row->cur_id,
+ 'rc_timestamp' => $row->rev_timestamp,
+ 'rc_cur_time' => $row->rev_timestamp,
+ 'rc_user' => $row->rev_user,
+ 'rc_user_text' => $row->rev_user_text,
+ 'rc_namespace' => $row->page_namespace,
+ 'rc_title' => $row->page_title,
+ 'rc_comment' => $row->rev_comment,
+ 'rc_minor' => !!$row->rev_minor_edit,
+ 'rc_type' => $row->page_is_new ? RC_NEW : RC_EDIT,
+ 'rc_cur_id' => $row->page_id,
'rc_this_oldid' => 0,
'rc_last_oldid' => 0,
'rc_bot' => 0,
'rc_ip' => '',
'rc_patrolled' => '1', # we can't support patrolling on the Watchlist
# currently because it uses cur, not recentchanges
- 'rc_new' => $row->cur_is_new # obsolete
+ 'rc_new' => $row->page_is_new # obsolete
);
$this->mExtra = array();