From 1be10f04e5b8c53fb71fc73b017ea5869f6bc10e Mon Sep 17 00:00:00 2001 From: River Tarnell Date: Fri, 1 Jul 2005 23:50:11 +0000 Subject: [PATCH] backport changes for RC-backed watchlist in recentchanges code from live site --- includes/ChangesList.php | 6 ++++-- includes/RecentChange.php | 31 ++++++++++++++++--------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/includes/ChangesList.php b/includes/ChangesList.php index a3f6923a00..c0bd215d34 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -122,6 +122,7 @@ class ChangesList { $userlinks = array () ; foreach ( $block AS $rcObj ) { $oldid = $rcObj->mAttribs['rc_last_oldid']; + $newid = $rcObj->mAttribs['rc_this_oldid']; if ( $rcObj->mAttribs['rc_new'] ) { $isnew = true ; } @@ -176,7 +177,7 @@ class ChangesList { $r .= ' ('.count($block).' ' ; if ( $isnew ) $r .= wfMsg('changes'); else $r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle() , wfMsg('changes') , - $curIdEq.'&diff=0&oldid='.$oldid ) ; + $curIdEq."&diff=$oldid&oldid=$newid" ) ; $r .= '; ' ; # History @@ -477,7 +478,8 @@ class ChangesList { $curLink = $message['cur']; $diffLink = $message['diff']; } else { - $query = $curIdEq.'&diff=0&oldid='.$rc_this_oldid; + # $query = $curIdEq.'&diff=0&oldid='.$rc_this_oldid; + $query = $curIdEq."&diff=$rc_this_oldid&oldid=$rc_last_oldid"; $aprops = ' tabindex="'.$baseRC->counter.'"'; $curLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $message['cur'], $query, '' ,'' , $aprops ); $diffLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $message['diff'], $query . $rcIdQuery, '' ,'' , $aprops ); diff --git a/includes/RecentChange.php b/includes/RecentChange.php index 2c660121ed..69cbb17c9f 100644 --- a/includes/RecentChange.php +++ b/includes/RecentChange.php @@ -137,18 +137,19 @@ class RecentChange # 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 -# ); -# } + if( $age < $wgRCMaxAge ) { + # live hack, will commit once tested - kate + # 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->update( 'recentchanges', array( 'rc_cur_time' => $now ), @@ -360,7 +361,7 @@ class RecentChange } # Makes a pseudo-RC entry from a cur row, for watchlists and things - function loadFromCurRow( $row, $rc_last_oldid = 0 ) + function loadFromCurRow( $row ) { $this->mAttribs = array( 'rc_timestamp' => $row->rev_timestamp, @@ -373,8 +374,8 @@ class RecentChange 'rc_minor' => $row->rev_minor_edit ? 1 : 0, 'rc_type' => $row->page_is_new ? RC_NEW : RC_EDIT, 'rc_cur_id' => $row->page_id, - 'rc_this_oldid' => (int)$row->rev_id, - 'rc_last_oldid' => (int)$rc_last_oldid, + 'rc_this_oldid' => $row->rev_id, + 'rc_last_oldid' => isset($row->rc_last_oldid) ? $row->rc_last_oldid : 0, 'rc_bot' => 0, 'rc_moved_to_ns' => 0, 'rc_moved_to_title' => '', -- 2.20.1